IArrayNode.h
Go to the documentation of this file.
1 #ifndef __IArrayNode_h__
2 #define __IArrayNode_h__ 1
3 
4 // =================================================================================================
5 // ADOBE SYSTEMS INCORPORATED
6 // Copyright 2014 Adobe Systems Incorporated
7 // All Rights Reserved
8 //
9 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
10 // of the Adobe license agreement accompanying it.
11 // =================================================================================================
12 
13 
15 
16 namespace AdobeXMPCore {
17 
26  : public virtual ICompositeNode_v1
27  {
28  public:
29 
33  typedef enum {
35  kAFNone = 0,
36 
38  kAFUnordered = 1 << 0,
39 
41  kAFOrdered = 1 << 1,
42 
44  kAFAlternative = 1 << 2,
45 
47  kAFAll = kAllBits
48  } eArrayForm;
49 
54  virtual eArrayForm APICALL GetArrayForm() const = 0;
55 
61  virtual eNodeType APICALL GetChildNodeType() const = 0;
62 
71  virtual spINode APICALL GetNodeAtIndex( sizet index ) = 0;
73  return const_cast< IArrayNode_v1 * >( this )->GetNodeAtIndex( index );
74  }
76 
88  auto node = GetNodeAtIndex( index );
89  if ( node ) return node->ConvertToSimpleNode();
90  return spcISimpleNode();
91  }
92 
94  auto node = GetNodeAtIndex( index );
95  if ( node ) return node->ConvertToSimpleNode();
96  return spISimpleNode();
97  }
99 
111  auto node = GetNodeAtIndex( index );
112  if ( node ) return node->ConvertToStructureNode();
113  return spcIStructureNode();
114  }
115 
117  auto node = GetNodeAtIndex( index );
118  if ( node ) return node->ConvertToStructureNode();
119  return spIStructureNode();
120  }
122 
134  auto node = GetNodeAtIndex( index );
135  if ( node ) return node->ConvertToArrayNode();
136  return spcIArrayNode();
137  }
138 
140  auto node = GetNodeAtIndex( index );
141  if ( node ) return node->ConvertToArrayNode();
142  return spIArrayNode();
143  }
145 
158  virtual void APICALL InsertNodeAtIndex( const spINode & node, sizet index ) = 0;
159 
173  virtual spINode APICALL ReplaceNodeAtIndex( const spINode & node, sizet index ) = 0;
174 
182  virtual spINode APICALL RemoveNodeAtIndex( sizet index ) = 0;
183 
186 
192  virtual pIArrayNode APICALL GetActualIArrayNode() __NOTHROW__ = 0;
193  XMP_PRIVATE pcIArrayNode GetActualIArrayNode() const __NOTHROW__ {
194  return const_cast< IArrayNode_v1 * >( this )->GetActualIArrayNode();
195  }
198 
204  virtual AdobeXMPCore_Int::pIArrayNode_I APICALL GetIArrayNode_I() __NOTHROW__ = 0;
205 
206  XMP_PRIVATE AdobeXMPCore_Int::pcIArrayNode_I GetIArrayNode_I() const __NOTHROW__ {
207  return const_cast< IArrayNode_v1 * >( this )->GetIArrayNode_I();
208  }
211 
219  XMP_PRIVATE static spIArrayNode MakeShared( pIArrayNode_base ptr );
220  XMP_PRIVATE static spcIArrayNode MakeShared( pcIArrayNode_base ptr ) {
221  return MakeShared( const_cast< pIArrayNode_base >( ptr ) );
222  }
225 
230  XMP_PRIVATE static uint64 GetInterfaceID() { return kIArrayNodeID; }
231 
236  XMP_PRIVATE static uint32 GetInterfaceVersion() { return 1; }
238 
239  // Factories to create the array node
240 
252  XMP_PRIVATE static spIArrayNode CreateUnorderedArrayNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength );
253 
265  XMP_PRIVATE static spIArrayNode CreateOrderedArrayNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength );
266 
278  XMP_PRIVATE static spIArrayNode CreateAlternativeArrayNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength );
279 
280  protected:
284  virtual ~IArrayNode_v1() __NOTHROW__ {}
285 
287  virtual uint32 APICALL getArrayForm( pcIError_base & error ) const __NOTHROW__ = 0;
288  virtual uint32 APICALL getChildNodeType( pcIError_base & error ) const __NOTHROW__ = 0;
289  virtual pINode_base APICALL getNodeAtIndex( sizet index, pcIError_base & error ) __NOTHROW__ = 0;
290  virtual void APICALL insertNodeAtIndex( pINode_base node, sizet index, pcIError_base & error ) __NOTHROW__ = 0;
291  virtual pINode_base APICALL replaceNodeAtIndex( pINode_base node, sizet index, pcIError_base & error ) __NOTHROW__ = 0;
292  virtual pINode_base APICALL removeNodeAtIndex( sizet index, pcIError_base & error ) __NOTHROW__ = 0;
293 
294  #ifdef FRIEND_CLASS_DECLARATION
295  FRIEND_CLASS_DECLARATION();
296  #endif
299 
300  };
301 }
302 
303 #endif // __IArrayNode_h__
static const uint64 kIArrayNodeID(0x634172724e6f6465)
XMP_PRIVATE spcISimpleNode GetSimpleNodeAtIndex(sizet index) const
Get the node at the specified index as simple node, if possible.
Definition: IArrayNode.h:87
IArrayNode * pIArrayNode
#define XMP_PUBLIC
#define __NOTHROW__
shared_ptr< ISimpleNode > spISimpleNode
XMP_PRIVATE spIStructureNode GetStructureNodeAtIndex(sizet index)
Definition: IArrayNode.h:116
XMP_PRIVATE spIArrayNode GetArrayNodeAtIndex(sizet index)
Definition: IArrayNode.h:139
shared_ptr< IStructureNode > spIStructureNode
eArrayForm
Indicates different kinds of array forms possible in XMP i.e, unordered, ordered and alternative...
Definition: IArrayNode.h:33
IArrayNode_I * pIArrayNode_I
shared_ptr< const IArrayNode > spcIArrayNode
static const uint32 kAllBits(0xFFFFFFFF)
Version1 of the interface that serves as a base interface to all types of nodes in the XMP DOM...
Definition: INode.h:26
Version1 of the interface that serves as a base interface to all composite types of nodes in the XMP ...
shared_ptr< IArrayNode > spIArrayNode
const IArrayNode_I * pcIArrayNode_I
virtual ~IArrayNode_v1() __NOTHROW__
Definition: IArrayNode.h:284
Version1 of the interface that represents an Array Node of XMP DOM.
Definition: IArrayNode.h:25
Version1 of the interface that represents an error/warning encountered during processing.
Definition: IError.h:26
XMP_PRIVATE spISimpleNode GetSimpleNodeAtIndex(sizet index)
Definition: IArrayNode.h:93
XMP_PRIVATE spcINode GetNodeAtIndex(sizet index) const
Definition: IArrayNode.h:72
eNodeType
Indicates various types of node available in XMP Data Model like simple, array and structure...
Definition: INode.h:36
shared_ptr< const ISimpleNode > spcISimpleNode
const IArrayNode * pcIArrayNode
#define REQ_FRIEND_CLASS_DECLARATION()
XMP_PRIVATE spcIStructureNode GetStructureNodeAtIndex(sizet index) const
Get the node at the specified index as structure node, if possible.
Definition: IArrayNode.h:110
shared_ptr< INode > spINode
XMP_PRIVATE spcIArrayNode GetArrayNodeAtIndex(sizet index) const
Get the node at the specified index as an array node, if possible.
Definition: IArrayNode.h:133
shared_ptr< const INode > spcINode
#define XMP_PRIVATE
shared_ptr< const IStructureNode > spcIStructureNode

XMPToolkit documentation generated by doxygen 1.8.11