XMP Toolkit SDK  6.0.0
IStructureNode.h
Go to the documentation of this file.
1 #ifndef IStructureNode_h__
2 #define IStructureNode_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 
16 
17 namespace AdobeXMPCore {
18 
26  : public virtual ICompositeNode_v1
27  {
28  public:
29 
39  virtual eNodeType APICALL GetChildNodeType( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) const = 0;
40 
41 
53  XMP_PRIVATE spcINode GetNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) const {
54  return const_cast< IStructureNode_v1 * >( this )->GetNode( nameSpace, nameSpaceLength, name, nameLength );
55  }
56  virtual spINode APICALL GetNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) = 0;
58 
72  XMP_PRIVATE spcISimpleNode GetSimpleNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) const {
73  auto node = GetNode( nameSpace, nameSpaceLength, name, nameLength );
74  if ( node ) return node->ConvertToSimpleNode();
75  return spcISimpleNode();
76  }
77 
78  XMP_PRIVATE spISimpleNode GetSimpleNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) {
79  auto node = GetNode( nameSpace, nameSpaceLength, name, nameLength );
80  if ( node ) return node->ConvertToSimpleNode();
81  return spISimpleNode();
82  }
84 
98  XMP_PRIVATE spcIStructureNode GetStructureNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) const {
99  auto node = GetNode( nameSpace, nameSpaceLength, name, nameLength );
100  if ( node ) return node->ConvertToStructureNode();
101  return spcIStructureNode();
102  }
103 
104  XMP_PRIVATE spIStructureNode GetStructureNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) {
105  auto node = GetNode( nameSpace, nameSpaceLength, name, nameLength );
106  if ( node ) return node->ConvertToStructureNode();
107  return spIStructureNode();
108  }
110 
124  XMP_PRIVATE spcIArrayNode GetArrayNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) const {
125  auto node = GetNode( nameSpace, nameSpaceLength, name, nameLength );
126  if ( node ) return node->ConvertToArrayNode();
127  return spcIArrayNode();
128  }
129 
130  XMP_PRIVATE spIArrayNode GetArrayNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) {
131  auto node = GetNode( nameSpace, nameSpaceLength, name, nameLength );
132  if ( node ) return node->ConvertToArrayNode();
133  return spIArrayNode();
134  }
136 
145  virtual void APICALL InsertNode( const spINode & node ) = 0;
146 
157  virtual spINode APICALL ReplaceNode( const spINode & node ) = 0;
158 
168  virtual spINode APICALL RemoveNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) = 0;
169 
172 
178  virtual pIStructureNode APICALL GetActualIStructureNode() __NOTHROW__ = 0;
179  XMP_PRIVATE pcIStructureNode GetActualIStructureNode() const __NOTHROW__ {
180  return const_cast< IStructureNode_v1 * >( this )->GetActualIStructureNode();
181  }
184 
190  virtual AdobeXMPCore_Int::pIStructureNode_I APICALL GetIStructureNode_I() __NOTHROW__ = 0;
191 
192  XMP_PRIVATE AdobeXMPCore_Int::pcIStructureNode_I GetIStructureNode_I() const __NOTHROW__ {
193  return const_cast< IStructureNode_v1 * >( this )->GetIStructureNode_I();
194  }
197 
204  XMP_PRIVATE static spIStructureNode MakeShared( pIStructureNode_base ptr );
205  XMP_PRIVATE static spcIStructureNode MakeShared( pcIStructureNode_base ptr ) {
206  return MakeShared( const_cast< pIStructureNode_base >( ptr ) );
207  }
210 
215  XMP_PRIVATE static uint64 GetInterfaceID() { return kIStructureNodeID; }
216 
221  XMP_PRIVATE static uint32 GetInterfaceVersion() { return 1; }
223 
224  // Factories to create the structure node
225 
237  XMP_PRIVATE static spIStructureNode CreateStructureNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength );
238 
239  protected:
244 
246  virtual uint32 APICALL getChildNodeType( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) const __NOTHROW__ = 0;
247  virtual pINode_base APICALL getNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__ = 0;
248  virtual void APICALL insertNode( pINode_base node, pcIError_base & error ) __NOTHROW__ = 0;
249  virtual pINode_base APICALL replaceNode( pINode_base node, pcIError_base & error ) __NOTHROW__ = 0;
250  virtual pINode_base APICALL removeNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__ = 0;
251 
252  #ifdef FRIEND_CLASS_DECLARATION
253  FRIEND_CLASS_DECLARATION();
254  #endif
257 
258  };
259 }
260 
262 #if !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB
263 
264 namespace AdobeXMPCore {
265 
266 #if XMP_WinBuild
267  #pragma warning( push )
268  #pragma warning( disable : 4250 )
269 #endif
270 
271  class IStructureNodeProxy
272  : public virtual IStructureNode
273  , public virtual ICompositeNodeProxy
274  {
275  private:
276  pIStructureNode mRawPtr;
277 
278  public:
279  IStructureNodeProxy( pIStructureNode ptr );
280  ~IStructureNodeProxy() __NOTHROW__ ;
281 
282  AdobeXMPCore_Int::pIStructureNode_I APICALL GetIStructureNode_I() __NOTHROW__;
283  virtual pIStructureNode APICALL GetActualIStructureNode() __NOTHROW__;
284 
285  virtual eNodeType APICALL GetChildNodeType( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) const;
286  virtual spINode APICALL GetNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength );
287  virtual void APICALL InsertNode( const spINode & node );
288  virtual spINode APICALL ReplaceNode( const spINode & node );
289  virtual spINode APICALL RemoveNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength );
290 
291  protected:
292  virtual uint32 APICALL getChildNodeType( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) const __NOTHROW__;
293  virtual pINode_base APICALL getNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__;
294  virtual void APICALL insertNode( pINode_base node, pcIError_base & error ) __NOTHROW__;
295  virtual pINode_base APICALL replaceNode( pINode_base node, pcIError_base & error ) __NOTHROW__;
296  virtual pINode_base APICALL removeNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__;
297  };
298 
299 #if XMP_WinBuild
300  #pragma warning( pop )
301 #endif
302 
303 }
304 
305 #endif // BUILDING_XMPCORE_LIB
306 
308 #endif // IStructureNode_h__
AdobeXMPCore::IStructureNode_v1::GetArrayNode
XMP_PRIVATE spIArrayNode GetArrayNode(const char *nameSpace, sizet nameSpaceLength, const char *name, sizet nameLength)
Definition: IStructureNode.h:130
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::pIStructureNode_base
IStructureNode_v1 * pIStructureNode_base
Definition: XMPCoreFwdDeclarations.h:98
AdobeXMPCore::IStructureNode_v1::GetStructureNode
XMP_PRIVATE spIStructureNode GetStructureNode(const char *nameSpace, sizet nameSpaceLength, const char *name, sizet nameLength)
Definition: IStructureNode.h:104
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::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::IStructureNode_v1::GetSimpleNode
XMP_PRIVATE spcISimpleNode GetSimpleNode(const char *nameSpace, sizet nameSpaceLength, const char *name, sizet nameLength) const
Gets the node's child having specified name space and name as simple node.
Definition: IStructureNode.h:72
AdobeXMPCore::spIStructureNode
shared_ptr< IStructureNode > spIStructureNode
Definition: XMPCoreFwdDeclarations.h:103
XMP_PUBLIC
#define XMP_PUBLIC
Definition: XMP_Environment.h:221
AdobeXMPCore::IStructureNode_v1::~IStructureNode_v1
virtual ~IStructureNode_v1() __NOTHROW__
Definition: IStructureNode.h:243
AdobeXMPCore::spISimpleNode
shared_ptr< ISimpleNode > spISimpleNode
Definition: XMPCoreFwdDeclarations.h:79
AdobeXMPCore_Int::pcIStructureNode_I
const typedef IStructureNode_I * pcIStructureNode_I
Definition: XMPCoreFwdDeclarations.h:268
AdobeXMPCore::IStructureNode_v1::GetSimpleNode
XMP_PRIVATE spISimpleNode GetSimpleNode(const char *nameSpace, sizet nameSpaceLength, const char *name, sizet nameLength)
Definition: IStructureNode.h:78
AdobeXMPCore::IStructureNode_v1
Version1 of the interface that represents a structure Node of XMP DOM.
Definition: IStructureNode.h:25
AdobeXMPCore::IStructureNode_v1::GetArrayNode
XMP_PRIVATE spcIArrayNode GetArrayNode(const char *nameSpace, sizet nameSpaceLength, const char *name, sizet nameLength) const
Gets the node's child having specified name space and name as an array node.
Definition: IStructureNode.h:124
AdobeXMPCore::IStructureNode_v1::GetNode
XMP_PRIVATE spcINode GetNode(const char *nameSpace, sizet nameSpaceLength, const char *name, sizet nameLength) const
Gets the child of the node having specified namespace and name.
Definition: IStructureNode.h:53
ICompositeNode.h
AdobeXMPCore
Definition: IArrayNode.h:18
AdobeXMPCommon::uint32
XMP_Uns32 uint32
Definition: XMPCommonDefines.h:174
AdobeXMPCore_Int::pIStructureNode_I
IStructureNode_I * pIStructureNode_I
Definition: XMPCoreFwdDeclarations.h:266
AdobeXMPCommon::sizet
uint32 sizet
Definition: XMPCommonDefines.h:176
AdobeXMPCore::pIStructureNode
IStructureNode * pIStructureNode
Definition: XMPCoreFwdDeclarations.h:101
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::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::kIStructureNodeID
static const uint64 kIStructureNodeID(0x635374724e6f6465)
AdobeXMPCore::spcIArrayNode
shared_ptr< const IArrayNode > spcIArrayNode
Definition: XMPCoreFwdDeclarations.h:116
AdobeXMPCore::pcIStructureNode
const typedef IStructureNode * pcIStructureNode
Definition: XMPCoreFwdDeclarations.h:102
AdobeXMPCore::spcIStructureNode
shared_ptr< const IStructureNode > spcIStructureNode
Definition: XMPCoreFwdDeclarations.h:104
AdobeXMPCore_Int
Definition: XMPCoreFwdDeclarations.h:233
AdobeXMPCore::IStructureNode_v1::GetStructureNode
XMP_PRIVATE spcIStructureNode GetStructureNode(const char *nameSpace, sizet nameSpaceLength, const char *name, sizet nameLength) const
Gets the node's child having specified name space and name as structure node.
Definition: IStructureNode.h:98
AdobeXMPCommon::pcIError_base
const typedef IError_v1 * pcIError_base
Definition: XMPCommonFwdDeclarations.h:64
AdobeXMPCore::pcIStructureNode_base
const typedef IStructureNode_v1 * pcIStructureNode_base
Definition: XMPCoreFwdDeclarations.h:99
AdobeXMPCommon::uint64
XMP_Uns64 uint64
Definition: XMPCommonDefines.h:172
AdobeXMPCore::spcINode
shared_ptr< const INode > spcINode
Definition: XMPCoreFwdDeclarations.h:68