InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
XMLReference.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: robin briggs
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 __XMLReference__
25 #define __XMLReference__
26 
27 typedef SBOSID LSID;
28 const LSID kInvalidLSID = kInvalidSBOSID;
29 
30 class IIDXMLElement;
31 class IPMStream;
32 
47 class XMLReference {
48 public:
51 
52 
56  fBaseUIDRef(), fSubItem(kInvalidLSID)
57  {}
58 
59 
64  XMLReference(const UIDRef& baseUIDRef, LSID subItemID = kInvalidLSID) :
65  fBaseUIDRef(baseUIDRef), fSubItem(subItemID)
66  {}
67 
68 
72  XMLReference(const XMLReference& other) :
73  fBaseUIDRef(other.fBaseUIDRef), fSubItem(other.fSubItem)
74  {}
75 
76 
80  const UIDRef& GetUIDRef() const
81  { return fBaseUIDRef; }
82 
83 
87  UID GetUID() const
88  { return fBaseUIDRef.GetUID(); }
89 
90 
95  { return fBaseUIDRef.GetDataBase(); }
96 
97 
101  LSID GetLogicalID() const
102  { return fSubItem; }
103 
104 
108  void SetLogicalID(LSID newValue)
109  { fSubItem = newValue; }
110 
111 
115  IIDXMLElement* Instantiate(void) const;
116 
117 
122  void ReadWrite(IPMStream *s, IDataBase *db = nil);
123 
124 
129  bool16 operator == (const XMLReference& other) const
130  { return fBaseUIDRef == other.fBaseUIDRef && fSubItem == other.fSubItem; }
131 
132 
137  inline bool16 operator != (const XMLReference& compareAgainst) const
138  { return (!(*this == compareAgainst)); }
139 
143  inline XMLReference& operator = (const XMLReference& other)
144  { fBaseUIDRef = other.fBaseUIDRef; fSubItem = other.fSubItem; return *this;}
145 
150  bool16 operator < (const XMLReference& compareAgainst) const;
151 
152 private:
153  UIDRef fBaseUIDRef;
154  LSID fSubItem;
155  };
156 
157 DECLARE_BASE_TYPE(XMLReference); // no special copy
158 
159 const XMLReference kInvalidXMLReference;
160 
161 #if 0
162 class XMLReferenceWrapper
163 {
164  public:
168  XMLReferenceWrapper(XMLReference element) : fElement(element) { }
169  bool16 operator<(const XMLReferenceWrapper& other) const
172  { return ((fElement.GetDataBase() <= other.fElement.GetDataBase()) &&
173  (fElement.GetUID() <= other.fElement.GetUID()) &&
174  (fElement.GetLogicalID() < other.fElement.GetLogicalID())); }
175 
176  private:
177  XMLReference fElement;
178 };
179 
180 DECLARE_BASE_TYPE(XMLReferenceWrapper); // no special copy
181 #endif
182 
183 #endif // __XMLReference__