XMP Toolkit SDK  6.0.0
ICompositeNode.h
Go to the documentation of this file.
1 #ifndef __ICompositeNode_h__
2 #define __ICompositeNode_h__ 1
3 
4 // =================================================================================================
5 // Copyright Adobe
6 // Copyright 2014 Adobe
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. If you have received this file from a source other
11 // than Adobe, then your use, modification, or distribution of it requires the prior written permission
12 // of Adobe.
13 // =================================================================================================
14 
17 
18 namespace AdobeXMPCore {
19 
28  : public virtual INode_v1
29  {
30  public:
31 
39  virtual eNodeType APICALL GetNodeTypeAtPath( const spcIPath & path ) const = 0;
40 
49  XMP_PRIVATE spcINode GetNodeAtPath( const spcIPath & path ) const {
50  return const_cast< ICompositeNode_v1 * >( this )->GetNodeAtPath( path );
51  }
52  virtual spINode APICALL GetNodeAtPath( const spcIPath & path ) = 0;
54 
68  virtual void APICALL AppendNode( const spINode & node ) = 0;
69 
85  virtual void APICALL InsertNodeAtPath( const spINode & node, const spcIPath & path ) = 0;
86 
101  virtual spINode APICALL ReplaceNodeAtPath( const spINode & node, const spcIPath & path ) = 0;
102 
110  virtual spINode APICALL RemoveNodeAtPath( const spcIPath & path ) = 0;
111 
117  virtual spINodeIterator APICALL Iterator() = 0;
119  return const_cast< ICompositeNode_v1 * >( this )->Iterator();
120  }
121  // @}
122 
127  virtual sizet APICALL ChildCount() const __NOTHROW__ = 0;
128 
129  // Wrapper non virtual functions
130 
141  XMP_PRIVATE spcISimpleNode GetSimpleNodeAtPath( const spcIPath & path ) const {
142  auto node = GetNodeAtPath( path );
143  if ( node ) return node->ConvertToSimpleNode();
144  return spcISimpleNode();
145  }
146 
148  auto node = GetNodeAtPath( path );
149  if ( node ) return node->ConvertToSimpleNode();
150  return spISimpleNode();
151  }
153 
165  auto node = GetNodeAtPath( path );
166  if ( node ) return node->ConvertToStructureNode();
167  return spcIStructureNode();
168  }
169 
171  auto node = GetNodeAtPath( path );
172  if ( node ) return node->ConvertToStructureNode();
173  return spIStructureNode();
174  }
175  // !@}
176 
188  auto node = GetNodeAtPath( path );
189  if ( node ) return node->ConvertToArrayNode();
190  return spcIArrayNode();
191  }
192 
194  auto node = GetNodeAtPath( path );
195  if ( node ) return node->ConvertToArrayNode();
196  return spIArrayNode();
197  }
198  // !@}
199 
202 
208  virtual pICompositeNode APICALL GetActualICompositeNode() __NOTHROW__ = 0;
209  XMP_PRIVATE pcICompositeNode GetActualICompositeNode() const __NOTHROW__ {
210  return const_cast< ICompositeNode_v1 * >( this )->GetActualICompositeNode();
211  }
214 
220  virtual AdobeXMPCore_Int::pICompositeNode_I APICALL GetICompositeNode_I() __NOTHROW__ = 0;
221 
222  XMP_PRIVATE AdobeXMPCore_Int::pcICompositeNode_I GetICompositeNode_I() const __NOTHROW__ {
223  return const_cast< ICompositeNode_v1 * >( this )->GetICompositeNode_I();
224  }
227 
235  XMP_PRIVATE static spICompositeNode MakeShared( pICompositeNode_base ptr );
236  XMP_PRIVATE static spcICompositeNode MakeShared( pcICompositeNode_base ptr ) {
237  return const_cast< ICompositeNode_v1 * >( ptr )->MakeShared( const_cast<pICompositeNode_base>(ptr) );
238  }
241 
246  XMP_PRIVATE static uint64 GetInterfaceID() { return kICompositeNodeID; }
247 
252  XMP_PRIVATE static uint32 GetInterfaceVersion() { return 1; }
254 
255  protected:
260 
262  virtual uint32 APICALL getNodeTypeAtPath( pcIPath_base path, pcIError_base & error ) const __NOTHROW__ = 0;
263  virtual pINode_base APICALL getNodeAtPath( pcIPath_base path, pcIError_base & error ) __NOTHROW__ = 0;
264  virtual void APICALL appendNode( pINode_base node, pcIError_base & error ) __NOTHROW__ = 0;
265  virtual void APICALL insertNodeAtPath( pINode_base node, pcIPath_base path, pcIError_base & error ) __NOTHROW__ = 0;
266  virtual pINode_base APICALL replaceNodeAtPath( pINode_base node, pcIPath_base path, pcIError_base & error ) __NOTHROW__ = 0;
267  virtual pINode_base APICALL removeNodeAtPath( pcIPath_base path, pcIError_base & error ) __NOTHROW__ = 0;
268  virtual pINodeIterator_base APICALL iterator( pcIError_base & error ) __NOTHROW__ = 0;
269 
270  #ifdef FRIEND_CLASS_DECLARATION
271  FRIEND_CLASS_DECLARATION();
272  #endif
275 
276  };
277 }
278 
280 
281 #if !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB
282 
283 namespace AdobeXMPCore {
284 
285 #if XMP_WinBuild
286  #pragma warning( push )
287  #pragma warning( disable : 4250 )
288 #endif
289 
290  class ICompositeNodeProxy
291  : public virtual ICompositeNode
292  , public virtual INodeProxy
293  {
294  private:
295  pICompositeNode mRawPtr;
296 
297  public:
298  ICompositeNodeProxy( pICompositeNode ptr );
299  ~ICompositeNodeProxy() __NOTHROW__ ;
300 
301  pICompositeNode APICALL GetActualICompositeNode() __NOTHROW__;
302  AdobeXMPCore_Int::pICompositeNode_I APICALL GetICompositeNode_I() __NOTHROW__;
303 
304  virtual eNodeType APICALL GetNodeTypeAtPath( const spcIPath & path ) const;
305  virtual spINode APICALL GetNodeAtPath( const spcIPath & path );
306  virtual void APICALL AppendNode( const spINode & node );
307  virtual void APICALL InsertNodeAtPath( const spINode & node, const spcIPath & path );
308  virtual spINode APICALL ReplaceNodeAtPath( const spINode & node, const spcIPath & path );
309  virtual spINode APICALL RemoveNodeAtPath( const spcIPath & path );
310  virtual spINodeIterator APICALL Iterator();
311  virtual sizet APICALL ChildCount() const __NOTHROW__;
312 
313  protected:
314  virtual uint32 APICALL getNodeTypeAtPath( pcIPath_base path, pcIError_base & error ) const __NOTHROW__;
315  virtual pINode_base APICALL getNodeAtPath( pcIPath_base path, pcIError_base & error ) __NOTHROW__;
316  virtual void APICALL appendNode( pINode_base node, pcIError_base & error ) __NOTHROW__;
317  virtual void APICALL insertNodeAtPath( pINode_base node, pcIPath_base path, pcIError_base & error ) __NOTHROW__;
318  virtual pINode_base APICALL replaceNodeAtPath( pINode_base node, pcIPath_base path, pcIError_base & error ) __NOTHROW__;
319  virtual pINode_base APICALL removeNodeAtPath( pcIPath_base path, pcIError_base & error ) __NOTHROW__;
320  virtual pINodeIterator_base APICALL iterator( pcIError_base & error ) __NOTHROW__;
321 
322  };
323 
324 #if XMP_WinBuild
325  #pragma warning( pop )
326 #endif
327 
328 }
329 
330 #endif // BUILDING_XMPCORE_LIB
331 
333 #endif // __ICompositeNode_h__
AdobeXMPCore::INode_v1::eNodeType
eNodeType
Indicates various types of node available in XMP Data Model like simple, array and structure.
Definition: INode.h:38
AdobeXMPCore::pICompositeNode
ICompositeNode * pICompositeNode
Definition: XMPCoreFwdDeclarations.h:89
AdobeXMPCore::ICompositeNode_v1::GetStructureNodeAtPath
XMP_PRIVATE spIStructureNode GetStructureNodeAtPath(const spcIPath &path)
Definition: ICompositeNode.h:170
AdobeXMPCore::spcICompositeNode
shared_ptr< const ICompositeNode > spcICompositeNode
Definition: XMPCoreFwdDeclarations.h:92
XMP_PRIVATE
#define XMP_PRIVATE
Definition: XMP_Environment.h:222
AdobeXMPCore::pINode_base
INode_v1 * pINode_base
Definition: XMPCoreFwdDeclarations.h:62
__NOTHROW__
#define __NOTHROW__
Definition: XMPCommonDefines.h:147
AdobeXMPCore::ICompositeNode_v1::GetStructureNodeAtPath
XMP_PRIVATE spcIStructureNode GetStructureNodeAtPath(const spcIPath &path) const
Get a structure node specified by the path relative to the node.
Definition: ICompositeNode.h:164
AdobeXMPCore::INode_v1
Version1 of the interface that serves as a base interface to all types of nodes in the XMP DOM.
Definition: INode.h:28
AdobeXMPCore::pcIPath_base
const typedef IPath_v1 * pcIPath_base
Definition: XMPCoreFwdDeclarations.h:51
AdobeXMPCore::spcINodeIterator
shared_ptr< const INodeIterator > spcINodeIterator
Definition: XMPCoreFwdDeclarations.h:128
AdobeXMPCore::spIStructureNode
shared_ptr< IStructureNode > spIStructureNode
Definition: XMPCoreFwdDeclarations.h:103
XMP_PUBLIC
#define XMP_PUBLIC
Definition: XMP_Environment.h:221
AdobeXMPCore::ICompositeNode_v1::GetArrayNodeAtPath
XMP_PRIVATE spIArrayNode GetArrayNodeAtPath(const spcIPath &path)
Definition: ICompositeNode.h:193
AdobeXMPCore::spISimpleNode
shared_ptr< ISimpleNode > spISimpleNode
Definition: XMPCoreFwdDeclarations.h:79
AdobeXMPCore::spINodeIterator
shared_ptr< INodeIterator > spINodeIterator
Definition: XMPCoreFwdDeclarations.h:127
INode.h
AdobeXMPCore
Definition: IArrayNode.h:18
AdobeXMPCore::ICompositeNode_v1::GetArrayNodeAtPath
XMP_PRIVATE spcIArrayNode GetArrayNodeAtPath(const spcIPath &path) const
Get an array node specified by the path relative to the node.
Definition: ICompositeNode.h:187
AdobeXMPCommon::uint32
XMP_Uns32 uint32
Definition: XMPCommonDefines.h:174
AdobeXMPCore::INodeIterator_v1
Interface that represents an iterator over the mutable children of a XMP DOM Node.
Definition: INodeIterator.h:28
AdobeXMPCommon::sizet
uint32 sizet
Definition: XMPCommonDefines.h:176
AdobeXMPCore::ICompositeNode_v1
Version1 of the interface that serves as a base interface to all composite types of nodes in the XMP ...
Definition: ICompositeNode.h:27
AdobeXMPCore::kICompositeNodeID
static const uint64 kICompositeNodeID(0x63436d704e6f6465)
AdobeXMPCore::spIArrayNode
shared_ptr< IArrayNode > spIArrayNode
Definition: XMPCoreFwdDeclarations.h:115
AdobeXMPCore::spcISimpleNode
shared_ptr< const ISimpleNode > spcISimpleNode
Definition: XMPCoreFwdDeclarations.h:80
REQ_FRIEND_CLASS_DECLARATION
#define REQ_FRIEND_CLASS_DECLARATION()
Definition: XMPCommonDefines.h:137
AdobeXMPCore::spINode
shared_ptr< INode > spINode
Definition: XMPCoreFwdDeclarations.h:67
AdobeXMPCore::ICompositeNode_v1::GetSimpleNodeAtPath
XMP_PRIVATE spISimpleNode GetSimpleNodeAtPath(const spcIPath &path)
Definition: ICompositeNode.h:147
AdobeXMPCore::spcIArrayNode
shared_ptr< const IArrayNode > spcIArrayNode
Definition: XMPCoreFwdDeclarations.h:116
IVersionable.h
AdobeXMPCore::ICompositeNode_v1::GetNodeAtPath
XMP_PRIVATE spcINode GetNodeAtPath(const spcIPath &path) const
Get the node specified by the path relative to the composite node.
Definition: ICompositeNode.h:49
AdobeXMPCore::pcICompositeNode_base
const typedef ICompositeNode_v1 * pcICompositeNode_base
Definition: XMPCoreFwdDeclarations.h:87
AdobeXMPCore::spcIStructureNode
shared_ptr< const IStructureNode > spcIStructureNode
Definition: XMPCoreFwdDeclarations.h:104
AdobeXMPCore_Int::pICompositeNode_I
ICompositeNode_I * pICompositeNode_I
Definition: XMPCoreFwdDeclarations.h:261
AdobeXMPCore::ICompositeNode_v1::Iterator
XMP_PRIVATE spcINodeIterator Iterator() const
Definition: ICompositeNode.h:118
AdobeXMPCore_Int
Definition: XMPCoreFwdDeclarations.h:233
AdobeXMPCore_Int::pcICompositeNode_I
const typedef ICompositeNode_I * pcICompositeNode_I
Definition: XMPCoreFwdDeclarations.h:263
AdobeXMPCore::spcIPath
shared_ptr< const IPath > spcIPath
Definition: XMPCoreFwdDeclarations.h:56
AdobeXMPCommon::pcIError_base
const typedef IError_v1 * pcIError_base
Definition: XMPCommonFwdDeclarations.h:64
AdobeXMPCore::ICompositeNode_v1::~ICompositeNode_v1
virtual ~ICompositeNode_v1() __NOTHROW__
Definition: ICompositeNode.h:259
AdobeXMPCore::pcICompositeNode
const typedef ICompositeNode * pcICompositeNode
Definition: XMPCoreFwdDeclarations.h:90
AdobeXMPCore::pICompositeNode_base
ICompositeNode_v1 * pICompositeNode_base
Definition: XMPCoreFwdDeclarations.h:86
AdobeXMPCore::spICompositeNode
shared_ptr< ICompositeNode > spICompositeNode
Definition: XMPCoreFwdDeclarations.h:91
AdobeXMPCommon::uint64
XMP_Uns64 uint64
Definition: XMPCommonDefines.h:172
AdobeXMPCore::pINodeIterator_base
INodeIterator_v1 * pINodeIterator_base
Definition: XMPCoreFwdDeclarations.h:122
AdobeXMPCore::spcINode
shared_ptr< const INode > spcINode
Definition: XMPCoreFwdDeclarations.h:68