InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IntNodeID.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Michael Burbidge
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //========================================================================================
23 
24 #ifndef __IntNodeID_h__
25 #define __IntNodeID_h__
26 
27 #include "NodeID.h"
28 #include "IPMStream.h"
29 
30 const int kIntNodeID = 6; // This value is not used
31 
32 //========================================================================================
33 // CLASS BehaviorsTreeViewAdapter
34 //========================================================================================
35 
36 class IntNodeID : public NodeIDClass
37 {
38 public:
39  enum { kNodeType = kIntNodeID };
40 
41  static NodeID_rv Create(int32 number)
42  {
43  return new IntNodeID(number);
44  }
45 
46  virtual NodeType GetNodeType() const { return kNodeType; }
47 
48  virtual int32 Compare(const NodeIDClass* node) const
49  {
50  const IntNodeID* other = static_cast<const IntNodeID*>(node);
51 
52  if ( fNumber < other->fNumber)
53  return -1;
54  else if (fNumber > other->fNumber)
55  return 1;
56  else
57  return 0;
58  }
59 
60  virtual NodeIDClass* Clone() const
61  {
62  return new IntNodeID(fNumber);
63  }
64 
65  virtual void Read(IPMStream* stream)
66  {
67  stream->XferInt32(fNumber);
68  }
69 
70  virtual void Write(IPMStream* stream) const
71  {
72  stream->XferInt32(fNumber);
73  }
74 
75  int32 Get() const
76  {
77  return fNumber;
78  }
79 
80 private:
81  IntNodeID(int32 number) :
82  fNumber(number)
83  {
84  };
85 
86 private:
87  mutable int32 fNumber;
88 };
89 
90 #endif // __IntNodeID_h__
91