InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
XMLAttributeReference.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Daniel Guenther
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 // Note:
24 //
25 //========================================================================================
26 
27 #ifndef __XMLATTRIBUTEREFERENCE__
28 #define __XMLATTRIBUTEREFERENCE__
29 
30 #include "IPMUnknown.h"
31 #include "PMString.h"
32 #include "XMLReference.h"
33 
37 {
38  public:
42 
47  XMLAttributeReference(const XMLReference& ref, const PMString& attr) :
48  fXMLReference(ref), fAttrString(attr)
49  {}
50 
55  fXMLReference(ref), fAttrString(PMString())
56  {}
57 
63  fXMLReference(node.GetXMLReference()),
64  fAttrString(node.GetAttributeString())
65  {}
66 
70  bool16 operator<(const XMLAttributeReference &other) const
71  {
72  // If the element UID and logical ID is the same...
73  return fXMLReference.GetUID() == other.fXMLReference.GetUID() && fXMLReference.GetLogicalID() == other.fXMLReference.GetLogicalID() ?
74  // ...compare the strings...
75  fAttrString < other.fAttrString :
76  // ...otherwise if the UIDs are the same...
77  fXMLReference.GetUID() == other.fXMLReference.GetUID() ?
78  // ...compare the logical IDs compare the UIDs
79  fXMLReference.GetLogicalID() < other.fXMLReference.GetLogicalID() :
80  // ...otherwise compare the UIDs
81  fXMLReference.GetUID() < other.fXMLReference.GetUID();
82  }
83 
88  { return fXMLReference; }
89 
94  { return fAttrString; }
95 
96 // Don't remove these next two. Even though we are just POD (plain old data) and
97 // seem unnecessary (and slow). Otherwise Metrowerks will generate horrendous code
98 // for the operator! and operator void* below. Yuck.
99 
104  bool16 operator==(const XMLAttributeReference& other) const
105  { return fAttrString == other.fAttrString && fXMLReference == other.fXMLReference; }
106 
111  bool16 operator!=(const XMLAttributeReference& other) const
112  { return ((fAttrString != other.fAttrString) || (fXMLReference != other.fXMLReference)); }
113 
114 private:
115  XMLReference fXMLReference;
116  PMString fAttrString;
117 };
118 
119 DECLARE_OBJECT_TYPE(XMLAttributeReference);
120 
121 #endif // __XMLATTRIBUTEREFERENCE__