diff options
Diffstat (limited to 'public/include/XMPCore')
38 files changed, 6540 insertions, 0 deletions
diff --git a/public/include/XMPCore/Interfaces/IArrayNode.h b/public/include/XMPCore/Interfaces/IArrayNode.h new file mode 100644 index 0000000..dd18976 --- /dev/null +++ b/public/include/XMPCore/Interfaces/IArrayNode.h @@ -0,0 +1,303 @@ +#ifndef __IArrayNode_h__ +#define __IArrayNode_h__ 1 + +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2014 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + + +#include "XMPCore/Interfaces/ICompositeNode.h" + +namespace AdobeXMPCore { + + //! + //! \brief Version1 of the interface that represents an Array Node of XMP DOM. + //! \details Provides all the functions to get and set various properties of the array node. + //! \attention Support multi threading through locks but can be enabled/disabled by the client. By default + //! every object created does not support multi-threading. + //! \note The index of the array is 1-based. + //! + class XMP_PUBLIC IArrayNode_v1 + : public virtual ICompositeNode_v1 + { + public: + + //! + //! @brief Indicates different kinds of array forms possible in XMP i.e, unordered, ordered and alternative. + //! + typedef enum { + //! unknown array form, should be used as invalid value. + kAFNone = 0, + + //! Array contains entries which are unordered. + kAFUnordered = 1 << 0, + + //! Array contains entries which are ordered. + kAFOrdered = 1 << 1, + + //! Array contains entries which are ordered plus default value should be the top one. + kAFAlternative = 1 << 2, + + //! Maximum value this enum can hold, should be treated as invalid value + kAFAll = kAllBits + } eArrayForm; + + //! + //! @brief Get the type of array. + //! \return a value of type #eArrayForm indicating the type of array. + //! + virtual eArrayForm APICALL GetArrayForm() const = 0; + + //! + //! @brief Get the type of child nodes. + //! \return a value of type #eNodeType indicating the type of child nodes array can hold. + //! \note An empty array will return \#INode_v1::kNTAll indicating that right now it can hold any type of node. + //! + virtual eNodeType APICALL GetChildNodeType() const = 0; + + //! + //! @{ + //! @brief Get the node at the specified index. + //! \param[in] index an object of type \#sizet indicating the index of the node client who is interested in. + //! \return A shared pointer to const or non const \#INode object containing node. + //! \note In case no node exists at the given index an invalid shared pointer is returned. + //! \note The index of an array is 1-based. + //! + virtual spINode APICALL GetNodeAtIndex( sizet index ) = 0; + XMP_PRIVATE spcINode GetNodeAtIndex( sizet index ) const { + return const_cast< IArrayNode_v1 * >( this )->GetNodeAtIndex( index ); + } + //! @} + + //! + //! @{ + //! @brief Get the node at the specified index as simple node, if possible. + //! \param[in] index An object of type \#sizet indicating the index of the node client is interested in. + //! \return A shared pointer to const or non const \#ISimpleNode object containing node. + //! \note In case no node exists at the given index an invalid shared pointer is returned. + //! \note The index of an array is 1-based. + //! \attention Error is thrown in case + //! - a child exists at the given index but is not a simple node. + //! + XMP_PRIVATE spcISimpleNode GetSimpleNodeAtIndex( sizet index ) const { + auto node = GetNodeAtIndex( index ); + if ( node ) return node->ConvertToSimpleNode(); + return spcISimpleNode(); + } + + XMP_PRIVATE spISimpleNode GetSimpleNodeAtIndex( sizet index ) { + auto node = GetNodeAtIndex( index ); + if ( node ) return node->ConvertToSimpleNode(); + return spISimpleNode(); + } + //! @} + + //! + //! @{ + //! @brief Get the node at the specified index as structure node, if possible. + //! \param[in] index An object of type \#sizet indicating the index of the node client is interested in. + //! \return A shared pointer to const or non const \#IStructureNode object containing node. + //! \note In case no node exists at the given index an invalid shared pointer is returned. + //! \note The index of an array is 1-based. + //! \attention Error is thrown in case + //! - a child exists at the given index but is not a structure node. + //! + XMP_PRIVATE spcIStructureNode GetStructureNodeAtIndex( sizet index ) const { + auto node = GetNodeAtIndex( index ); + if ( node ) return node->ConvertToStructureNode(); + return spcIStructureNode(); + } + + XMP_PRIVATE spIStructureNode GetStructureNodeAtIndex( sizet index ) { + auto node = GetNodeAtIndex( index ); + if ( node ) return node->ConvertToStructureNode(); + return spIStructureNode(); + } + //! @} + + //! + //! @{ + //! @brief Get the node at the specified index as an array node, if possible. + //! \param[in] index an object of type \#sizet indicating the index of the node client is interested in. + //! \return a shared pointer to const or non const \#IArrayNode object containing node. + //! \note In case no node exists at the given index an invalid shared pointer is returned. + //! \note The index of an array is 1-based. + //! \attention Error is thrown in case + //! - a child exists at the given index but is not an array node. + //! + XMP_PRIVATE spcIArrayNode GetArrayNodeAtIndex( sizet index ) const { + auto node = GetNodeAtIndex( index ); + if ( node ) return node->ConvertToArrayNode(); + return spcIArrayNode(); + } + + XMP_PRIVATE spIArrayNode GetArrayNodeAtIndex( sizet index ) { + auto node = GetNodeAtIndex( index ); + if ( node ) return node->ConvertToArrayNode(); + return spIArrayNode(); + } + //! @} + + //! + //! @brief Inserts a given node at the specified index. + //! \param[in] node Shared pointer to an object of \#INode containing the node to be inserted at the specified index. + //! \param[in] index An object of type sizet indicating the index where the node should + //! be inserted. + //! \note The index of an array is 1-based. + //! \attention Error is thrown in following cases: + //! -# given node is invalid. + //! -# type of given node is not same as other child items of the array node. + //! -# given node is already a child of some other node. + //! -# given index is less than 1 or greater than current child count + 1. + //! + virtual void APICALL InsertNodeAtIndex( const spINode & node, sizet index ) = 0; + + //! + //! @brief Replaces an existing node with the given node at the specified index. + //! \param[in] node Shared pointer to an object of \#INode containing the node to be inserted at the specified index. + //! \param[in] index An object of type \#sizet indicating the index from where the node should be replaced. + //! \return A shared pointer to the node replaced with the new node. + //! \note The index of an array is 1-based. + //! \attention Error is thrown in following cases: + //! -# Given node is invalid. + //! -# Type of given node is not same as other child items of the array node. + //! -# Given node is already a child of some other node. + //! -# Given index is less than 1 or greater than current child count. + //! -# No node exists at the requested index. + //! + virtual spINode APICALL ReplaceNodeAtIndex( const spINode & node, sizet index ) = 0; + + //! + //! @brief Remove the node at the specified index. + //! \param[in] index An object of type \#sizet indicating the index from where the node should be removed. + //! \note The index of an array is 1-based. + //! \return A shared pointer to \#INode object containing node which is removed from the tree. + //! \note In case no node exists at the given index an invalid shared pointer is returned. + //! + virtual spINode APICALL RemoveNodeAtIndex( sizet index ) = 0; + + //! + //! \cond XMP_INTERNAL_DOCUMENTATION + + //! + //! @{ + //! @brief Returns the actual raw pointer from the shared pointer, which can be a shared pointer of a proxy class. + //! \return Either a const or non const pointer to IArrayNode interface. + //! + virtual pIArrayNode APICALL GetActualIArrayNode() __NOTHROW__ = 0; + XMP_PRIVATE pcIArrayNode GetActualIArrayNode() const __NOTHROW__ { + return const_cast< IArrayNode_v1 * >( this )->GetActualIArrayNode(); + } + //! + //! @} + + //! + //! @{ + //! @brief Return the pointer to internal interfaces. + //! \return either a const or non const pointer to IArrayNode_I interface. + //! + virtual AdobeXMPCore_Int::pIArrayNode_I APICALL GetIArrayNode_I() __NOTHROW__ = 0; + + XMP_PRIVATE AdobeXMPCore_Int::pcIArrayNode_I GetIArrayNode_I() const __NOTHROW__ { + return const_cast< IArrayNode_v1 * >( this )->GetIArrayNode_I(); + } + //! + //! @} + + //! + //! @{ + //! @brief Converts raw pointer to shared pointer. + //! @details The raw pointer is of version 1 interface + //! where as the returned shared pointer depends on the version client is interested in. + //! \return Shared pointer to const or non constant interface. + //! + XMP_PRIVATE static spIArrayNode MakeShared( pIArrayNode_base ptr ); + XMP_PRIVATE static spcIArrayNode MakeShared( pcIArrayNode_base ptr ) { + return MakeShared( const_cast< pIArrayNode_base >( ptr ) ); + } + //! + //! @} + + //! + //! return The unique ID assigned to the interface. + //! \return 64 bit unsigned integer representing the unique ID assigned to the interface. + //! + XMP_PRIVATE static uint64 GetInterfaceID() { return kIArrayNodeID; } + + //! + //! @brief Returns the version of the interface. + //! \return 32 bit unsigned integer representing the version of the interface. + //! + XMP_PRIVATE static uint32 GetInterfaceVersion() { return 1; } + //! \endcond + + // Factories to create the array node + + //! + //! @brief Creates an unordered array node which is not part of any metadata document. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the array node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated, set it to \#AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the array node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \return A shared pointer to a \#IArrayNode object. + //! \attention Error is thrown in the following cases: + //! -# nameSpace is NULL or its contents are empty. + //! -# name is NULL or its contents are empty. + //! + XMP_PRIVATE static spIArrayNode CreateUnorderedArrayNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ); + + //! + //! @brief Creates an ordered array node which is not part of any metadata document. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the array node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the array node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \return A shared pointer to a \#IArrayNode object. + //! \attention Error is thrown in the following cases: + //! -# nameSpace is NULL or its contents are empty. + //! -# name is NULL or its contents are empty. + //! + XMP_PRIVATE static spIArrayNode CreateOrderedArrayNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ); + + //! + //! @brief Creates an alternative array node which is not part of any metadata document. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the array node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the array node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \return A shared pointer to a \#IArrayNode object. + //! \attention Error is thrown in the following cases: + //! -# nameSpace is NULL or its contents are empty. + //! -# name is NULL or its contents are empty. + //! + XMP_PRIVATE static spIArrayNode CreateAlternativeArrayNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ); + + protected: + //! + //! Destructor + //! + virtual ~IArrayNode_v1() __NOTHROW__ {} + + //! \cond XMP_INTERNAL_DOCUMENTATION + virtual uint32 APICALL getArrayForm( pcIError_base & error ) const __NOTHROW__ = 0; + virtual uint32 APICALL getChildNodeType( pcIError_base & error ) const __NOTHROW__ = 0; + virtual pINode_base APICALL getNodeAtIndex( sizet index, pcIError_base & error ) __NOTHROW__ = 0; + virtual void APICALL insertNodeAtIndex( pINode_base node, sizet index, pcIError_base & error ) __NOTHROW__ = 0; + virtual pINode_base APICALL replaceNodeAtIndex( pINode_base node, sizet index, pcIError_base & error ) __NOTHROW__ = 0; + virtual pINode_base APICALL removeNodeAtIndex( sizet index, pcIError_base & error ) __NOTHROW__ = 0; + + #ifdef FRIEND_CLASS_DECLARATION + FRIEND_CLASS_DECLARATION(); + #endif + REQ_FRIEND_CLASS_DECLARATION(); + //! \endcond + + }; +} + +#endif // __IArrayNode_h__ diff --git a/public/include/XMPCore/Interfaces/IClientDOMParser.h b/public/include/XMPCore/Interfaces/IClientDOMParser.h new file mode 100644 index 0000000..ff27e00 --- /dev/null +++ b/public/include/XMPCore/Interfaces/IClientDOMParser.h @@ -0,0 +1,88 @@ +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCore/XMPCoreFwdDeclarations.h" +#include "XMPCommon/Interfaces/IError.h" +#include "XMPCommon/Interfaces/BaseInterfaces/IConfigurable.h" +#include "XMPCore/XMPCoreErrorCodes.h" + +namespace AdobeXMPCore { + + //! + //! @brief Version 1 of the interface that supports parsing by the client supplied parser of the XMP Data Model. + //! @details Provides functions to parse the XMP Data Model. + //! Thread safety is controllable by the client. + //! + class XMP_PUBLIC IClientDOMParser_v1 + { + public: + + //! + //! @brief Parse the contents present in the buffer taking into account the configuration parameters. + //! \param[in] buffer Pointer to a constant char buffer containing serialized XMP Data Model. + //! \param[in] bufferLength Number of characters in buffer. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] configurationParameters An object of type \#AdobeXMPCommon::IConfigurable containing all the configuration parameters requested by client + //! to be taken care of while parsing. + //! \param[in] proc A function pointer to be used by the parse operation to report back any encountered errors/warnings. + //! \return A shared pointer to \#INode object containing all the parsed XMP Data Model. + //! + virtual spINode APICALL Parse( const char * buffer, sizet bufferLength, pcIConfigurable configurationParameters, ReportErrorAndContinueFunctor proc ) = 0; + + //! + //! @brief Indicates whether object supports case sensitive keys or not. + //! \return True in case object supports case sensitive keys, false otherwise. + //! \note Default implementation makes keys case insensitive. + //! + virtual bool APICALL AreKeysCaseSensitive() const { return false; } + + //! + //! @brief Initialize the default configuration parameters. + //! @details The object needs to fill the default configuration parameters supported by it. + //! \param[in] configurationParameters an empty object of type \#AdobeXMPCommon::IConfigurable. + //! \note default implementation does not fill anything in the configuration parameters. + //! + virtual void APICALL Initialize( pIConfigurable configurationParameters ) {}; + + //! + //! @brief Validate the data type and value for a parameter. + //! \param[in] key An unsigned 64 bit integer value indicating the key. + //! \param[in] dataType A value of type \#AdobeXMPCommon::IConfigurable::eDataType indicating the type of value the parameter holds. + //! \param[in] dataValue A value of \#AdobeXMPCommon::IConfigurable::CombinedDataValue indicating the value the parameter holds. + //! \return An error code in case there is something wrong with the combination, otherwise returns \ p0-\#AdobeXMPCommon::eCECNone. + //! \note Default implementation validates all the keys + dataTypes + dataValue combinations. + //! + virtual eConfigurableErrorCode APICALL Validate( const uint64 & key, IConfigurable::eDataType dataType, const IConfigurable::CombinedDataValue & dataValue ) { + return kCECNone; + } + + //! + //! @brief Called by the library when the object is no longer required by it and client can free up the resources or memory associated with the object. + //! + virtual void APICALL Release() const __NOTHROW__ = 0; + + protected: + //! + //! Destructor + //! + virtual ~IClientDOMParser_v1() {} + + //! \cond XMP_INTERNAL_DOCUMENTATION + virtual pINode_base APICALL parse( const char * buffer, sizet bufferLength, pcIConfigurable configurationParameters, ReportErrorAndContinueABISafeProc proc, pcIError_base & error, uint32 & unknownExceptionCaught ) __NOTHROW__; + virtual uint32 APICALL areKeysCaseSensitive( pcIError_base & error, uint32 & unknownExceptionCaught ) const __NOTHROW__; + virtual void APICALL initialize( pIConfigurable configurationParameters, pcIError_base & error, uint32 & unknownExceptionCaught ) __NOTHROW__; + virtual uint32 APICALL validate( const uint64 & key, uint32 dataType, const IConfigurable::CombinedDataValue & dataValue, pcIError_base & error, uint32 & unknownExceptionCaught ) __NOTHROW__; + + #ifdef FRIEND_CLASS_DECLARATION + FRIEND_CLASS_DECLARATION(); + #endif + REQ_FRIEND_CLASS_DECLARATION(); + //! \endcond + + }; +} diff --git a/public/include/XMPCore/Interfaces/IClientDOMSerializer.h b/public/include/XMPCore/Interfaces/IClientDOMSerializer.h new file mode 100644 index 0000000..06558cd --- /dev/null +++ b/public/include/XMPCore/Interfaces/IClientDOMSerializer.h @@ -0,0 +1,94 @@ +#ifndef IClientDOMSerializer_h__ +#define IClientDOMSerializer_h__ 1 + +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCore/XMPCoreFwdDeclarations.h" +#include "XMPCommon/Interfaces/IError.h" +#include "XMPCommon/Interfaces/BaseInterfaces/IConfigurable.h" +#include "XMPCommon/XMPCommonErrorCodes.h" + +namespace AdobeXMPCore { + + //! + //! @brief Version 1 of the interface that supports serializing by the client supplied serializer of the XMP Data Model. + //! @details Provides functions to serialize the XMP Data Model. + //! Thread safety is controllable by the client. + //! + class XMP_PUBLIC IClientDOMSerializer_v1 + { + public: + + //! + //! @brief Serialize the XMP Data Model taking into account the configuration parameters. + //! \param[in] node The node to be serialized. + //! \param[in] nameSpacePrefixMap An object of type \#INameSpacePrefixMap which contains preferred prefixes for namespaces. + //! \param[in] configurationParameters An object of type #AdobeXMPCommon::IConfigurable containing all the configuration parameters requested by client + //! to be taken care of while serializing. + //! \param[in] functor A function object to be used by the serializing operation to report back any encountered errors/warnings. + //! \param[out] string A shared pointer to an IUTF8String object which should be filled with the serialized form of XMP Data Model. + //! + virtual void APICALL Serialize( const spINode & node, const spcINameSpacePrefixMap & nameSpacePrefixMap, pcIConfigurable configurationParameters, + ReportErrorAndContinueFunctor functor, const spIUTF8String & string ) = 0; + + //! + //! @brief Indicates whether object supports case sensitive keys or not. + //! \return True in case object supports case sensitive keys, false otherwise. + //! \note Default implementation makes keys case insensitive. + //! + virtual bool APICALL AreKeysCaseSensitive() const { return false; } + + //! + //! @brief Initializes the default configuration parameters. + //! The object needs to fill the default configuration parameters supported by it. + //! \param[in] configurationParameters An empty object of type #AdobeXMPCommon::IConfigurable. + //! \note Default implementation does not fill anything in the configuration parameters. + //! + virtual void APICALL Initialize( pIConfigurable configurationParameters ) {}; + + //! + //! @brief Validate the data type and value for a parameter. + //! \param[in] key An unsigned 64 bit integer value indicating the key. + //! \param[in] dataType A value of type #AdobeXMPCommon::IConfigurable::eDataType indicating the type of value the parameter holds. + //! \param[in] dataValue A value of \#AdobeXMPCommon::IConfigurable::CombinedDataValue indicating the value the parameter holds. + //! \return An error code in case there is something wrong with the combination, otherwise returns \#AdobeXMPCommon::eCECNone. + //! \note Default implementation validates all the keys + dataTypes + dataValue combinations. + //! + virtual eConfigurableErrorCode APICALL Validate( const uint64 & key, IConfigurable::eDataType dataType, const IConfigurable::CombinedDataValue & dataValue ) { + return kCECNone; + } + + //! + //! @brief Called by the library when the object is no longer required by it and client can free up the resources or memory associated with the object. + //! + virtual void APICALL Release() const __NOTHROW__ = 0; + + protected: + //! + //! Destructor + //! + virtual ~IClientDOMSerializer_v1() {} + + //! \cond XMP_INTERNAL_DOCUMENTATION + virtual void APICALL serialize( pINode_base node, pcINameSpacePrefixMap_base nameSpacePrefixMap, pcIConfigurable configurationParameters, ReportErrorAndContinueABISafeProc proc, pIUTF8String_base string, pcIError_base & error, uint32 & unknownExceptionCaught ) __NOTHROW__; + virtual uint32 APICALL areKeysCaseSensitive( pcIError_base & error, uint32 & unknownExceptionCaught ) const __NOTHROW__; + virtual void APICALL initialize( pIConfigurable configurationParameters, pcIError_base & error, uint32 & unknownExceptionCaught ) __NOTHROW__; + virtual uint32 APICALL validate( const uint64 & key, uint32 dataType, const IConfigurable::CombinedDataValue & dataValue, pcIError_base & error, uint32 & unknownExceptionCaught ) __NOTHROW__; + + #ifdef FRIEND_CLASS_DECLARATION + FRIEND_CLASS_DECLARATION(); + #endif + REQ_FRIEND_CLASS_DECLARATION(); + //! \endcond + + }; +} + +#endif // IClientDOMSerializer_h__ diff --git a/public/include/XMPCore/Interfaces/ICompositeNode.h b/public/include/XMPCore/Interfaces/ICompositeNode.h new file mode 100644 index 0000000..4754ed5 --- /dev/null +++ b/public/include/XMPCore/Interfaces/ICompositeNode.h @@ -0,0 +1,331 @@ +#ifndef __ICompositeNode_h__ +#define __ICompositeNode_h__ 1 + +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2014 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCore/Interfaces/INode.h" +#include "XMPCommon/Interfaces/BaseInterfaces/IVersionable.h" + +namespace AdobeXMPCore { + + //! + //! \brief Version1 of the interface that serves as a base interface to all composite types of nodes + //! in the XMP DOM ( like Arrays and Structures ). + //! \details Provides all the functions to get various properties of the composite node. + //! \attention Support multi threading through locks but can be enabled/disabled by the client. By default + //! every object created does not support multi-threading. + //! + class XMP_PUBLIC ICompositeNode_v1 + : public virtual INode_v1 + { + public: + + //! + //! @brief Get the node type specified by the path relative to the composite node. + //! \param[in] path Shared pointer to a const \#AdobeXMPCore::IPath object containing the relative path + //! from the node to the node client is interested in. + //! \return The type of the node. + //! \note In case no node exists at the given path a value \#eNodeType::kNTNone is returned. + //! + virtual eNodeType APICALL GetNodeTypeAtPath( const spcIPath & path ) const = 0; + + //! + //! @{ + //! @brief Get the node specified by the path relative to the composite node. + //! \param[in] path Shared pointer to a const \#AdobeXMPCore::IPath object containing the relative path + //! from the node to the node client is interested in. + //! \return A shared pointer to either a const or non const \#AdobeXMPCore::INode object containing node. + //! \note In case no node exists at the given path an invalid shared pointer is returned. + //! + XMP_PRIVATE spcINode GetNodeAtPath( const spcIPath & path ) const { + return const_cast< ICompositeNode_v1 * >( this )->GetNodeAtPath( path ); + } + virtual spINode APICALL GetNodeAtPath( const spcIPath & path ) = 0; + //! @} + + //! + //! @brief Appends a given node as the child of the node. + //! @details In case of array node it is appended at the last + //! and in case of structure node qualified name of the node to be inserted determines its position. + //! \param[in] node Shared pointer to an object of \#AdobeXMPCore::INode containing the node to be + //! appended as the last child. + //! \note This operation is not currently implemented for the ICompositeNode interface. + //! \attention Error is thrown in following cases: + //! -# provided node is invalid. + //! -# type of given node is not same as other child items of the array node. + //! -# given node is already a child of some other node. + //! -# composite node already has a child node with the same qualified name in case of structure node. + //! + virtual void APICALL AppendNode( const spINode & node ) = 0; + + //! + //! @brief Inserts a given node at the path relative to the composite node. + //! \param[in] node Shared pointer to an object of \#AdobeXMPCore::INode containing the node to be + //! inserted at the specified relative path. + //! \param[in] path Shared pointer to a const \#AdobeXMPCore::IPath object containing the relative path. + //! \note All the hierarchy of nodes is created if not present. + //! \note This operation is not currently implemented for the ICompositeNode interface. + //! \attention Error is thrown in following cases: + //! -# given node is invalid. + //! -# type of given node is not same as other child items of the array node. + //! -# given node is already a child of some other node. + //! -# given path is invalid or logically incorrect. + //! -# type of given node is not suitable for the destination location. + //! -# a node already exists at the specified path. + //! + virtual void APICALL InsertNodeAtPath( const spINode & node, const spcIPath & path ) = 0; + + //! + //! @brief Replaces an existing node with the given node at the path relative to the composite node.. + //! \param[in] node Shared pointer to an object of \#AdobeXMPCore::INode. + //! \param[in] path Shared pointer to a const \#AdobeXMPCore::IPath object containing the relative path. + //! \return a Shared pointer to the node being replaced. + //! \note This operation is not currently implemented for the ICompositeNode interface. + //! \attention Error is thrown in following cases: + //! -# given node is invalid. + //! -# type of given node is not same as other child items of the array node. + //! -# given node is already a child of some other node. + //! -# given index is less than 1 or greater than current child count. + //! -# type of given node is not suitable for the destination location. + //! -# no node exists at the specified path. + //! + virtual spINode APICALL ReplaceNodeAtPath( const spINode & node, const spcIPath & path ) = 0; + + //! + //! @brief Removes the node specified by the path relative to the composite node. + //! \param[in] path Shared pointer to a const \#AdobeXMPCore::IPath object containing the relative path + //! from the node to the node client is interested in. + //! \return A shared pointer to \#AdobeXMPCore::INode object containing node which is removed from the tree. + //! \note In case no node exists at the given path an invalid shared pointer is returned. + //! + virtual spINode APICALL RemoveNodeAtPath( const spcIPath & path ) = 0; + + //! + //! @{ + //! @brief Get an iterator object to iterate over all the child nodes of the composite node. + //! \return a shared pointer to a const or non const \#INodeIterator object. + //! + virtual spINodeIterator APICALL Iterator() = 0; + XMP_PRIVATE spcINodeIterator Iterator() const { + return const_cast< ICompositeNode_v1 * >( this )->Iterator(); + } + // @} + + //! + //! @brief Get the count of child nodes of the composite node. + //! \return an object of type \#AdobeXMPCommon::sizet containing the count of children of the node. + //! + virtual sizet APICALL ChildCount() const __NOTHROW__ = 0; + + // Wrapper non virtual functions + + //! + //! @{ + //! @brief Get a simple node specified by the path relative to the node. + //! \param[in] path Shared pointer to a const \#AdobeXMPCore::IPath object containing the relative path + //! from the node to the node client is interested in. + //! \return A shared pointer to const or non const \#ISimpleNode object containing node. + //! \note In case no node exists at the given path an invalid shared pointer is returned. + //! \attention Error is thrown in case + //! - a node exists at the given path but is not a simple node. + //! + XMP_PRIVATE spcISimpleNode GetSimpleNodeAtPath( const spcIPath & path ) const { + auto node = GetNodeAtPath( path ); + if ( node ) return node->ConvertToSimpleNode(); + return spcISimpleNode(); + } + + XMP_PRIVATE spISimpleNode GetSimpleNodeAtPath( const spcIPath & path ) { + auto node = GetNodeAtPath( path ); + if ( node ) return node->ConvertToSimpleNode(); + return spISimpleNode(); + } + //! @} + + //! + //! @{ + //! @brief Get a structure node specified by the path relative to the node. + //! \param[in] path Shared pointer to a const \#AdobeXMPCore::IPath object containing the relative path + //! from the node to the node client is interested in. + //! \return A shared pointer to const or non const \#IStructureNode object containing node. + //! \note In case no node exists at the given path an invalid shared pointer is returned. + //! \attention Error is thrown in case + //! - a node exists at the given path but is not a structure node. + //! + XMP_PRIVATE spcIStructureNode GetStructureNodeAtPath( const spcIPath & path ) const { + auto node = GetNodeAtPath( path ); + if ( node ) return node->ConvertToStructureNode(); + return spcIStructureNode(); + } + + XMP_PRIVATE spIStructureNode GetStructureNodeAtPath( const spcIPath & path ) { + auto node = GetNodeAtPath( path ); + if ( node ) return node->ConvertToStructureNode(); + return spIStructureNode(); + } + // !@} + + //! + //! @{ + //! @brief Get an array node specified by the path relative to the node. + //! \param[in] path Shared pointer to a const \#AdobeXMPCore::IPath object containing the relative path + //! from the node to the node client is interested in. + //! \return A shared pointer to const or non const \#IArrayNode object containing node. + //! \note In case no node exists at the given path an invalid shared pointer is returned. + //! \attention Error is thrown in case + //! - a node exists at the given path but is not an array node. + //! + XMP_PRIVATE spcIArrayNode GetArrayNodeAtPath( const spcIPath & path ) const { + auto node = GetNodeAtPath( path ); + if ( node ) return node->ConvertToArrayNode(); + return spcIArrayNode(); + } + + XMP_PRIVATE spIArrayNode GetArrayNodeAtPath( const spcIPath & path ) { + auto node = GetNodeAtPath( path ); + if ( node ) return node->ConvertToArrayNode(); + return spIArrayNode(); + } + // !@} + + //! + //! \cond XMP_INTERNAL_DOCUMENTATION + + //! + //! @{ + //! @brief Returns the actual raw pointer from the shared pointer, which can be a shared pointer of a proxy class. + //! \return Either a const or non const pointer to ICompositeNode interface. + //! + virtual pICompositeNode APICALL GetActualICompositeNode() __NOTHROW__ = 0; + XMP_PRIVATE pcICompositeNode GetActualICompositeNode() const __NOTHROW__ { + return const_cast< ICompositeNode_v1 * >( this )->GetActualICompositeNode(); + } + //! + //! @} + + //! + //! @{ + //! @brief Returns the pointer to internal interfaces. + //! \return Either a const or non const pointer to ICompositeNode_I interface. + //! + virtual AdobeXMPCore_Int::pICompositeNode_I APICALL GetICompositeNode_I() __NOTHROW__ = 0; + + XMP_PRIVATE AdobeXMPCore_Int::pcICompositeNode_I GetICompositeNode_I() const __NOTHROW__ { + return const_cast< ICompositeNode_v1 * >( this )->GetICompositeNode_I(); + } + //! + //! @} + + //! + //! @{ + //! @brief Converts raw pointer to shared pointer. + //! @details The raw pointer is of version 1 interface + //! where as the returned shared pointer depends on the version client is interested in. + //! \return Shared pointer to const or non constant interface. + //! + XMP_PRIVATE static spICompositeNode MakeShared( pICompositeNode_base ptr ); + XMP_PRIVATE static spcICompositeNode MakeShared( pcICompositeNode_base ptr ) { + return const_cast< ICompositeNode_v1 * >( ptr )->MakeShared( ptr ); + } + //! + //! @} + + //! + //! @brief Returns the unique ID assigned to the interface. + //! \return 64 bit unsigned integer representing the unique ID assigned to the interface. + //! + XMP_PRIVATE static uint64 GetInterfaceID() { return kICompositeNodeID; } + + //! + //! @brief Returns the version of the interface. + //! \return 32 bit unsigned integer representing the version of the interface. + //! + XMP_PRIVATE static uint32 GetInterfaceVersion() { return 1; } + //! \endcond + + protected: + //! + //! Destructor + //! + virtual ~ICompositeNode_v1() __NOTHROW__ {} + + //! \cond XMP_INTERNAL_DOCUMENTATION + virtual uint32 APICALL getNodeTypeAtPath( pcIPath_base path, pcIError_base & error ) const __NOTHROW__ = 0; + virtual pINode_base APICALL getNodeAtPath( pcIPath_base path, pcIError_base & error ) __NOTHROW__ = 0; + virtual void APICALL appendNode( pINode_base node, pcIError_base & error ) __NOTHROW__ = 0; + virtual void APICALL insertNodeAtPath( pINode_base node, pcIPath_base path, pcIError_base & error ) __NOTHROW__ = 0; + virtual pINode_base APICALL replaceNodeAtPath( pINode_base node, pcIPath_base path, pcIError_base & error ) __NOTHROW__ = 0; + virtual pINode_base APICALL removeNodeAtPath( pcIPath_base path, pcIError_base & error ) __NOTHROW__ = 0; + virtual pINodeIterator_base APICALL iterator( pcIError_base & error ) __NOTHROW__ = 0; + + #ifdef FRIEND_CLASS_DECLARATION + FRIEND_CLASS_DECLARATION(); + #endif + REQ_FRIEND_CLASS_DECLARATION(); + //! \endcond + + }; +} + +//! \cond XMP_INTERNAL_DOCUMENTATION + +#if !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB + +namespace AdobeXMPCore { + +#if XMP_WinBuild + #pragma warning( push ) + #pragma warning( disable : 4250 ) +#endif + + class ICompositeNodeProxy + : public virtual ICompositeNode + , public virtual INodeProxy + { + private: + pICompositeNode mRawPtr; + + public: + ICompositeNodeProxy( pICompositeNode ptr ); + ~ICompositeNodeProxy() __NOTHROW__ ; + + pICompositeNode APICALL GetActualICompositeNode() __NOTHROW__; + AdobeXMPCore_Int::pICompositeNode_I APICALL GetICompositeNode_I() __NOTHROW__; + + virtual eNodeType APICALL GetNodeTypeAtPath( const spcIPath & path ) const; + virtual spINode APICALL GetNodeAtPath( const spcIPath & path ); + virtual void APICALL AppendNode( const spINode & node ); + virtual void APICALL InsertNodeAtPath( const spINode & node, const spcIPath & path ); + virtual spINode APICALL ReplaceNodeAtPath( const spINode & node, const spcIPath & path ); + virtual spINode APICALL RemoveNodeAtPath( const spcIPath & path ); + virtual spINodeIterator APICALL Iterator(); + virtual sizet APICALL ChildCount() const __NOTHROW__; + + protected: + virtual uint32 APICALL getNodeTypeAtPath( pcIPath_base path, pcIError_base & error ) const __NOTHROW__; + virtual pINode_base APICALL getNodeAtPath( pcIPath_base path, pcIError_base & error ) __NOTHROW__; + virtual void APICALL appendNode( pINode_base node, pcIError_base & error ) __NOTHROW__; + virtual void APICALL insertNodeAtPath( pINode_base node, pcIPath_base path, pcIError_base & error ) __NOTHROW__; + virtual pINode_base APICALL replaceNodeAtPath( pINode_base node, pcIPath_base path, pcIError_base & error ) __NOTHROW__; + virtual pINode_base APICALL removeNodeAtPath( pcIPath_base path, pcIError_base & error ) __NOTHROW__; + virtual pINodeIterator_base APICALL iterator( pcIError_base & error ) __NOTHROW__; + + }; + +#if XMP_WinBuild + #pragma warning( pop ) +#endif + +} + +#endif // BUILDING_XMPCORE_LIB +//! \endcond + +#endif // __ICompositeNode_h__ diff --git a/public/include/XMPCore/Interfaces/ICoreConfigurationManager.h b/public/include/XMPCore/Interfaces/ICoreConfigurationManager.h new file mode 100644 index 0000000..98b09a0 --- /dev/null +++ b/public/include/XMPCore/Interfaces/ICoreConfigurationManager.h @@ -0,0 +1,107 @@ +#ifndef ICoreConfigurationManager_h__ +#define ICoreConfigurationManager_h__ 1 + +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCore/XMPCoreFwdDeclarations.h" +#include "XMPCommon/Interfaces/IConfigurationManager.h" + +namespace AdobeXMPCore { + //! + //! @brief Version1 of the interface that represents configuration settings controllable by the client. + //! \details Provides functions through which client can plug in its own memory allocators, error notifiers. + //! \attention Not Thread Safe as this functionality is generally used at the initialization phase. + //! + class XMP_PUBLIC ICoreConfigurationManager_v1 + : public virtual IConfigurationManager_v1 + { + public: + + //! + //! \cond XMP_INTERNAL_DOCUMENTATION + + //! + //! @{ + //! @brief Returns the actual raw pointer from the shared pointer, which can be a shared pointer of a proxy class. + //! \return Either a const or non const pointer to ICoreConfigurationManager interface. + //! + virtual pICoreConfigurationManager APICALL GetActualICoreConfigurationManager() __NOTHROW__ = 0; + XMP_PRIVATE pcICoreConfigurationManager GetActualICoreConfigurationManager() const __NOTHROW__ { + return const_cast< ICoreConfigurationManager_v1 * >( this )->GetActualICoreConfigurationManager(); + } + //! + //! @} + + //! + //! @{ + //! @brief Returns the pointer to internal interfaces. + //! \return Either a const or non const pointer to ICoreConfigurationManager_I interface. + //! + virtual AdobeXMPCore_Int::pICoreConfigurationManager_I APICALL GetICoreConfigurationManager_I() __NOTHROW__ = 0; + + XMP_PRIVATE AdobeXMPCore_Int::pcICoreConfigurationManager_I GetICoreConfigurationManager_I() const __NOTHROW__ { + return const_cast< ICoreConfigurationManager_v1 * >( this )->GetICoreConfigurationManager_I(); + } + //! + //! @} + + //! + //! @{ + //! @brief Converts raw pointer to shared pointer. The raw pointer is of version 1 interface + //! where as the returned shared pointer depends on the version client is interested in. + //! \return Shared pointer to const or non constant interface. + //! + XMP_PRIVATE static spICoreConfigurationManager MakeShared( pICoreConfigurationManager_base ptr ); + XMP_PRIVATE static spcICoreConfigurationManager MakeShared( pcICoreConfigurationManager_base ptr ) { + return MakeShared( const_cast< pICoreConfigurationManager_base >( ptr ) ); + } + //! + //! @} + + //! + //! @brief Return the unique ID assigned to the interface. + //! \return 64 bit unsigned integer representing the unique ID assigned to the interface. + //! + XMP_PRIVATE static uint64 GetInterfaceID() { return kICoreConfigurationManagerID; } + + //! + //! @brief Returns the version of the interface. + //! \return 32 bit unsigned integer representing the version of the interface. + //! + XMP_PRIVATE static uint32 GetInterfaceVersion() { return 1; } + //! \endcond + + // static factory functions + + //! + //! @brief Get the configuration manager object associated with XMPCore library.. + //! \return A shared pointer to an object of \#ICoreConfigurationManager. + //! + XMP_PRIVATE static spICoreConfigurationManager GetCoreConfigurationManager(); + + + protected: + //! + //! Destructor + //! + virtual ~ICoreConfigurationManager_v1() __NOTHROW__ {} + + //! \cond XMP_INTERNAL_DOCUMENTATION + + #ifdef FRIEND_CLASS_DECLARATION + FRIEND_CLASS_DECLARATION(); + #endif + REQ_FRIEND_CLASS_DECLARATION(); + //! \endcond + + }; +} +#endif // ICoreConfigurationManager_h__ + diff --git a/public/include/XMPCore/Interfaces/ICoreObjectFactory.h b/public/include/XMPCore/Interfaces/ICoreObjectFactory.h new file mode 100644 index 0000000..234a685 --- /dev/null +++ b/public/include/XMPCore/Interfaces/ICoreObjectFactory.h @@ -0,0 +1,264 @@ +#ifndef ICoreObjectFactory_h__ +#define ICoreObjectFactory_h__ 1 + +// ================================================================================================= +// Copyright 2014 Adobe Systems Incorporated +// All Rights Reserved. +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCore/XMPCoreFwdDeclarations.h" +#include "XMPCommon/Interfaces/IObjectFactory.h" + +namespace AdobeXMPCore { + + //! + //! @brief Version1 of a interface that represents a factory to create various artifacts of XMP DOM like array, + //! structure, path etc. + //! + //! @details Provides all the functions to create instances of various artifacts of XMP DOM and return them as shared pointers + //! to the clients. This is the interface through which clients of the library actually get access to all other interfaces. + //! + + class XMP_PUBLIC ICoreObjectFactory_v1 + : public virtual IObjectFactory_v1 + { + public: + + //! + //! @brief Creates an empty name space prefix map. + //! \param[out] error A reference to a pointer to const IError object which will be filled with the error object in case of any error. + //! \return A pointer to an empty \#INameSpacePrefixMap_v1 object. + //! + virtual pINameSpacePrefixMap_base APICALL CreateNameSpacePrefixMap( pcIError_base & error ) __NOTHROW__ = 0; + + //! + //! @brief Provides the default mapping of prefix string and nameSpace strings used by XMPCore. + //! \param[out] error A reference to a pointer to const IError object which will be filled with the error object in case of any error. + //! \return A pointer to const \#INameSpacePrefixMap_v1 object containing all the mappings used as default by the XMPCore. + //! + virtual pcINameSpacePrefixMap_base APICALL GetDefaultNameSpacePrefixMap( pcIError_base & error ) __NOTHROW__ = 0; + + //! + //! @brief Creates a normal property path segment.These are essentially all properties (simple, struct and arrays). + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the property. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the property. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[out] error A reference to a pointer to const IError object which will be filled with the error object in case of any error. + //! \return A pointer to const \#IPathSegment_v1. + //! + virtual pcIPathSegment_base APICALL CreatePropertyPathSegment( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__ = 0; + + //! + //! @brief Creates an array index path segment that denotes a specific element of an array. + //! @details Such segments do not have an own name and inherits the namespace from the Array property itself. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the property. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] index An object of type \#AdobeXMP::sizet containting the index of the array element. + //! \param[out] error A reference to a pointer to const IError object which will be filled with the error object in case of any error. + //! \return A pointer to const \#IPathSegment_v1. + //! \attention Throws \#AdobeXMP::pcIError in case + //! - pointers to const char buffers are NULL, + //! - their content is empty. + //! + virtual pcIPathSegment_base APICALL CreateArrayIndexPathSegment( const char * nameSpace, sizet nameSpaceLength, sizet index, pcIError_base & error ) __NOTHROW__ = 0; + + //! + //! @brief Creates a Qualifier path segment, which behaves like a normal property + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the property. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the property. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[out] error A reference to a pointer to const IError object which will be filled with the error object in case of any error. + //! \return A pointer to const \#IPathSegment_v1. + //! + virtual pcIPathSegment_base APICALL CreateQualifierPathSegment( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__ = 0; + + //! + //! @brief Creates a path segment that selects a specific qualifier by its value. + //! For example a specific language in a alternative array of languages. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the property. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the property. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] value Pointer to a constant char buffer containing value of the language (xml:lang) + //! \param[in] valueLength Number of characters in value. In case value is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[out] error A reference to a pointer to const IError object which will be filled with the error object in case of any error. + //! \return A pointer to const \#IPathSegment_v1. + //! + virtual pcIPathSegment_base APICALL CreateQualifierSelectorPathSegment( const char * nameSpace, sizet nameSpaceLength, const char * name, + sizet nameLength, const char * value, sizet valueLength, pcIError_base & error ) __NOTHROW__ = 0; + + //! + //! @brief Creates an empty IPath object. + //! \param[out] error A reference to a pointer to const IError object which will be filled with the error object in case of any error. + //! \return A pointer to an empty \#IPath_v1 object + //! + virtual pIPath_base APICALL CreatePath( pcIError_base & error ) __NOTHROW__ = 0; + + //! + //! @brief Creates a path from a char buffer which contains the serialized path. + //! \param[in] path Pointer to a const char buffer containing serialized form of the path. + //! \param[in] pathLength Number of characters in the path. In case path in null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] map A pointer to a const \#IXMPNameSpacePrefixMap_v1 object which will contain the mapping for nameSpaces to prefixes. + //! \param[out] error A reference to a pointer to const IError object which will be filled with the error object in case of any error. + //! \return A pointer to a \#IPath_v1 object. + //! + virtual pIPath_base APICALL ParsePath( const char * path, sizet pathLength, pcINameSpacePrefixMap_base map, pcIError_base & error ) __NOTHROW__ = 0; + + //! + //! @brief Creates a simple property node which is not part of any metadata document. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the simple node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the simple node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] value Pointer to a constant char buffer containing value of the simple node. + //! \param[in] valueLength Number of characters in value. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[out] error A reference to a pointer to const IError object which will be filled with the error object in case of any error. + //! \return A pointer to a \#ISimpleNode_v1 object. + //! + virtual pISimpleNode_base APICALL CreateSimpleNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, + const char * value, sizet valueLength, pcIError_base & error ) __NOTHROW__ = 0; + + //! + //! @brief Creates an array node which is not part of any metadata document. + //! \param[in] arrayForm A value indicating the array type + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the array node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the array node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[out] error A reference to a pointer to const IError object which will be filled with the error object in case of any error. + //! \return A pointer to a \#IArrayNode_v1 object. + //! + virtual pIArrayNode_base APICALL CreateArrayNode( uint32 arrayForm, const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__ = 0; + + //! + //! @brief Creates a structure node which is not part of any metadata document. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the structure node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the structure node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[out] error A reference to a pointer to const IError object which will be filled with the error object in case of any error. + //! \return A pointer to a \#IStructureNode_v1 object. + virtual pIStructureNode_base APICALL CreateStructureNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__ = 0; + + //! + //! @brief Creates an empty IMetadata object. + //! \param[out] error A reference to a pointer to const IError object which will be filled with the error object in case of any error. + //! \return a pointer to an empty \#IMetadata_v1 object. + //! + virtual pIMetadata_base APICALL CreateMetadata( pcIError_base & error ) __NOTHROW__ = 0; + + //! + //! @brief Provides the reference to the database of Serializers and Parsers available with the library. + //! \param[out] error A reference to a pointer to const IError object which will be filled with the error object in case of any error. + //! \return a pointer to \#IDOMImplementationRegistry_base object containing all the entries for serailizers and parsers. + //! + virtual pIDOMImplementationRegistry_base APICALL GetDOMImplementationRegistry( pcIError_base & error ) __NOTHROW__ = 0; + + //! + //! @brief Provides access to the configuration manager of the library. + //! \param[out] error A reference to a pointer to const IError object which will be filled with the error object in case of any error. + //! \return A pointer to \#ICoreConfigurationManager_base object. + //! + virtual pICoreConfigurationManager_base APICALL GetCoreConfigurationManager( pcIError_base & error ) __NOTHROW__ = 0; + + //! + //! \cond XMP_INTERNAL_DOCUMENTATION + + //! + //! @{ + //! @brief Returns the actual raw pointer from the shared pointer, which can be a shared pointer of a proxy class. + //! \return Either a const or non const pointer to ICoreObjectFactory interface. + //! + virtual pICoreObjectFactory APICALL GetActualICoreObjectFactory() __NOTHROW__ = 0; + XMP_PRIVATE pcICoreObjectFactory GetActualICoreObjectFactory() const __NOTHROW__ { + return const_cast< ICoreObjectFactory_v1 * >( this )->GetActualICoreObjectFactory(); + } + //! + //! @} + + //! + //! @{ + //! @brief Returns the pointer to internal interfaces. + //! \return Either a const or non const pointer to ICoreObjectFactory_I interface. + //! + virtual AdobeXMPCore_Int::pICoreObjectFactory_I APICALL GetICoreObjectFactory_I() __NOTHROW__ = 0; + + XMP_PRIVATE AdobeXMPCore_Int::pcICoreObjectFactory_I GetICoreObjectFactory_I() const __NOTHROW__ { + return const_cast< ICoreObjectFactory_v1 * >( this )->GetICoreObjectFactory_I(); + } + //! + //! @} + + //! + //! @{ + //! @brief Converts raw pointer to base version to pointer to client interested version. + //! @details The raw pointer is of version 1 interface where as the returned pointer depends on the version client is interested in. + //! \return Pointer to const or non constant interface. + //! + XMP_PRIVATE static pICoreObjectFactory MakeCoreObjectFactory( pICoreObjectFactory_base ptr ); + XMP_PRIVATE static pcICoreObjectFactory MakeCoreObjectFactory( pcICoreObjectFactory_base ptr ) { + return MakeCoreObjectFactory( const_cast< pcICoreObjectFactory_base >( ptr ) ); + } + //! + //! @} + + //! + //! @brief Returns the unique ID assigned to the interface. + //! \return 64 bit unsigned integer representing the unique ID assigned to the interface. + //! + XMP_PRIVATE static uint64 GetInterfaceID() { return kICoreObjectFactoryID; } + + //! + //! @brief returns the version of the interface. + //! \return 32 bit unsigned integer representing the version of the interface. + //! + XMP_PRIVATE static uint32 GetInterfaceVersion() { return 1; } + //! \endcond + + //! + //! @brief Gets an object of ICoreObjectFactory. + //! \return A pointer to an ICoreObjectFactory object. + //! + XMP_PRIVATE static pICoreObjectFactory GetCoreObjectFactory(); + + //! + //! @{ + //! @brief Sets up the core object factory. + //! \param[in] coreObjectFactory A pointer to an \#ICoreObjectFactory_v1 object. + //! \note coreObjectFactory is an optional parameter and only required for clients who don't directly link with the library + //! but want to use its functionality. + //! + #if LINKING_XMPCORE_LIB + XMP_PRIVATE static void SetupCoreObjectFactory(); + #else + XMP_PRIVATE static void SetupCoreObjectFactory( pICoreObjectFactory_base coreObjectFactory ); + #endif + //! @} + + //! + //! @brief Destroy everything related to core object factory. + //! + XMP_PRIVATE static void DestroyCoreObjectFactory(); + + protected: + //! + //! Destructor + //! + virtual ~ICoreObjectFactory_v1() __NOTHROW__ {} + + //! \cond XMP_INTERNAL_DOCUMENTATION + + #ifdef FRIEND_CLASS_DECLARATION + FRIEND_CLASS_DECLARATION(); + #endif + REQ_FRIEND_CLASS_DECLARATION(); + //! \endcond + + }; +} +#endif // ICoreObjectFactory_h__ diff --git a/public/include/XMPCore/Interfaces/IDOMImplementationRegistry.h b/public/include/XMPCore/Interfaces/IDOMImplementationRegistry.h new file mode 100644 index 0000000..7a732bd --- /dev/null +++ b/public/include/XMPCore/Interfaces/IDOMImplementationRegistry.h @@ -0,0 +1,150 @@ +#ifndef IDOMImplementationRegistry_h__ +#define IDOMImplementationRegistry_h__ 1 + +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2014 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCore/XMPCoreFwdDeclarations.h" +#include "XMPCommon/Interfaces/BaseInterfaces/ISharedObject.h" +#include "XMPCommon/Interfaces/BaseInterfaces/IVersionable.h" + +namespace AdobeXMPCore { + + //! + //! \brief Version1 of the interface that serves as a database/registry of all the parsers and + //! serializers available with the XMPCore library. + //! \details Provides all the functions to + //! -# get registered serializers and parsers from the database. + //! -# add client defined serializers and parsers to the database. + //! \attention Support multi threading if library is configured to support multi-threading by default. + //! \note By default following keys are registered by default with the database by the library: + //! -# rdf + //! + class XMP_PUBLIC IDOMImplementationRegistry_v1 + : public virtual ISharedObject + , public virtual IVersionable + { + public: + + //! + //! @brief Gets a parser corresponding to the key and returns to the client for usage. + //! \param[in] key Pointer to a const NULL terminated char buffer containing key of the parser in the database. + //! \return A shared pointer to a \#IDOMParser object. + //! \note In case the key is not present in the database an invalid shared pointer will be returned. + //! \note key is case sensitive. + //! + virtual spIDOMParser APICALL GetParser( const char * key ) const = 0; + + //! + //! @brief Gets a serializer corresponding to the key and returns to the client for usage. + //! \param[in] key Pointer to a const NULL terminated char buffer containing key of the serializer in the database. + //! \return A shared pointer to a \#IDOMSerializer object. + //! \note In case the key is not present in the database an invalid shared pointer will be returned. + //! \note key is case sensitive. + //! + virtual spIDOMSerializer APICALL GetSerializer( const char * key ) const = 0; + + //! + //! @brief Registers a parser with the database along with the key. + //! \param[in] key Pointer to a const NULL terminated char buffer containing key of the parser to be used while registering. + //! \param[in] parser A pointer to \#IClientDOMParser object to be registered with the database + //! \return True in case parser is successfully registered, false otherwise like in case key is already registered. + //! + virtual bool APICALL RegisterParser( const char * key, pIClientDOMParser_base parser ) = 0; + + //! + //! @brief Registers a serializer with the database along with the key. + //! \param[in] key Pointer to a const NULL terminated char buffer containing key of the serializer to be used while registering. + //! \param[in] serializer A pointer to \#IClientDOMSerializer object to be registered with the database. + //! \return True in case serializer is successfully registered, false otherwise like in case key is already registered. + //! + virtual bool APICALL RegisterSerializer( const char * key, pIClientDOMSerializer_base serializer ) = 0; + + //! + //! @brief Provides the reference to the database of Serializers and Parsers available with the library. + //! \return A shared pointer to \#IDOMImplementationRegistry object containing all the entries for serailizers and parsers. + //! + XMP_PRIVATE static spIDOMImplementationRegistry GetDOMImplementationRegistry(); + + //! + //! \cond XMP_INTERNAL_DOCUMENTATION + + //! + //! @{ + //! @brief Returns the actual raw pointer from the shared pointer, which can be a shared pointer of a proxy class. + //! \return Either a const or non const pointer to IDOMImplementationRegistry interface. + //! + virtual pIDOMImplementationRegistry APICALL GetActualIDOMImplementationRegistry() __NOTHROW__ = 0; + XMP_PRIVATE pcIDOMImplementationRegistry GetActualIDOMImplementationRegistry() const __NOTHROW__ { + return const_cast< IDOMImplementationRegistry_v1 * >( this )->GetActualIDOMImplementationRegistry(); + } + //! + //! @} + + //! + //! @{ + //! @brief Returns the pointer to internal interfaces. + //! \return Either a const or non const pointer to IDOMImplementationRegistry_I interface. + //! + virtual AdobeXMPCore_Int::pIDOMImplementationRegistry_I APICALL GetIDOMImplementationRegistry_I() __NOTHROW__ = 0; + + XMP_PRIVATE AdobeXMPCore_Int::pcIDOMImplementationRegistry_I GetIDOMImplementationRegistry_I() const __NOTHROW__ { + return const_cast< IDOMImplementationRegistry_v1 * >( this )->GetIDOMImplementationRegistry_I(); + } + //! + //! @} + + //! + //! @{ + //! @brief Converts raw pointer to shared pointer. The raw pointer is of version 1 interface + //! where as the returned shared pointer depends on the version client is interested in. + //! \return Shared pointer to const or non constant interface. + //! + XMP_PRIVATE static spIDOMImplementationRegistry MakeShared( pIDOMImplementationRegistry_base ptr ); + XMP_PRIVATE static spcIDOMImplementationRegistry MakeShared( pcIDOMImplementationRegistry_base ptr ) { + return MakeShared( const_cast< pIDOMImplementationRegistry_base >( ptr ) ); + } + //! + //! @} + + //! + //! @brief Returns the unique ID assigned to the interface. + //! \return 64 bit unsigned integer representing the unique ID assigned to the interface. + //! + XMP_PRIVATE static uint64 GetInterfaceID() { return kIDOMImplementationRegistryID; } + + //! + //! @brief Returns the version of the interface. + //! \return 32 bit unsigned integer representing the version of the interface. + //! + XMP_PRIVATE static uint32 GetInterfaceVersion() { return 1; } + //! \endcond + + protected: + //! + //! Destructor + //! + virtual ~IDOMImplementationRegistry_v1() __NOTHROW__ {} + + //! \cond XMP_INTERNAL_DOCUMENTATION + virtual pIDOMParser_base APICALL getParser( const char * key, pcIError_base & error ) const __NOTHROW__ = 0; + virtual pIDOMSerializer_base APICALL getSerializer( const char * key, pcIError_base & error ) const __NOTHROW__ = 0; + virtual uint32 APICALL registerParser( const char * key, pIClientDOMParser_base parser, pcIError_base & error ) __NOTHROW__ = 0; + virtual uint32 APICALL registerSerializer( const char * key, pIClientDOMSerializer_base serializer, pcIError_base & error ) __NOTHROW__= 0; + + #ifdef FRIEND_CLASS_DECLARATION + FRIEND_CLASS_DECLARATION(); + #endif + REQ_FRIEND_CLASS_DECLARATION(); + //! \endcond + + }; +} + +#endif // IDOMImplementationRegistry_h__ diff --git a/public/include/XMPCore/Interfaces/IDOMParser.h b/public/include/XMPCore/Interfaces/IDOMParser.h new file mode 100644 index 0000000..b33ff17 --- /dev/null +++ b/public/include/XMPCore/Interfaces/IDOMParser.h @@ -0,0 +1,181 @@ +#ifndef IDOMParser_h__ +#define IDOMParser_h__ 1 + +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2014 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCore/XMPCoreFwdDeclarations.h" +#include "XMPCommon/Interfaces/BaseInterfaces/ISharedObject.h" +#include "XMPCommon/Interfaces/BaseInterfaces/IVersionable.h" +#include "XMPCommon/Interfaces/BaseInterfaces/IConfigurable.h" + +namespace AdobeXMPCore { + + //! + //! @brief Version 1 of the interface that supports parsing of the XMP Data Model. + //! @details Provides all functions to parse the buffer as well as to configure the parser. + //! + class XMP_PUBLIC IDOMParser_v1 + : public virtual IConfigurable + , public virtual ISharedObject + , public virtual IVersionable + { + public: + + //! + //! @brief Indicates various types of operations possible while parsing with some node as the context. + //! + typedef enum { + //! @brief Append all the nodes parsed from the buffer as the child of the context node. + //! \attention Error is thrown in case + //! - Context Node is invalid. + //! - Context Node is not array or structure node. + //! - Context Node is a structure node but a child node with the same qualified name is already present. + //! - Context Node is an array node but the type of any parsed node is not same as that of other existing nodes in the array. + //! + kATAppendAsChildren = 0, + + //! @brief Replaces the children of the context node with nodes parsed from the buffer. + //! \attention Error is thrown in case + //! - Context Node is invalid. + //! - Context Node is not array or structure node. + //! - Context Node is a structure node but a child node with the same qualified name is not already present. + //! - Context Node is an array node but the type of all parsed nodes are not same. + //! + kATReplaceChildren = 1, + + //! @brief Either append all the nodes parsed from the buffer as the child/children of the context node. + //! \attention Error is thrown in case + //! - Context Node is invalid. + //! - Context Node is not array or structure node. + //! - Context Node is an array node but the type of all parsed nodes are not same. + //! - If a structure node is the parsed node, it is appended if it already not present, otherwise it is replaced. + //! - If an array node is the parsed node, it is appended if it already not present, otherwise it is removed. + kATAppendOrReplaceChildren = 2, + + //! @brief Treats all the parsed nodes as the siblings of the context node and place them before the context node, if possible. + //! \attention Error is thrown in case + //! - Context Node is invalid. + //! - parent of the Context Node is not an array node. + //! - The type of any parsed nodes is not same as that of other existing nodes in the array. + kATInsertBefore = 3, + + //! @brief Treats all the parsed nodes as the siblings of the context node and place them after the context node, if possible. + //! \attention Error is thrown in case + //! - Context Node is invalid. + //! - parent of the Context Node is not an array node. + //! - The type of any parsed nodes is not same as that of other existing nodes in the array. + kATInsertAfter = 4, + + //! @brief Replaces the context node and insert the node parsed from the buffer in its place. + //! \attention Error is thrown in case + //! - type of node returned after parsing in not of type which is compatible with the Context Node. + kATReplace = 5, + } eActionType; + + //! + //! @brief Parses the buffer contents and creates an XMP DOM node. + //! \param[in] buffer Pointer to a constant char buffer containing serialized XMP Data Model. + //! \param[in] bufferLength Number of characters in buffer. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \return A shared pointer to an object of \#IMetadata containing all the information parsed from the buffer. + //! + virtual spIMetadata APICALL Parse( const char * buffer, sizet bufferLength ) = 0; + + //! + //! @brief Parse the buffer contents and populate the provided node . + //! \param[in] buffer Pointer to a constant char buffer containing serialized XMP Data Model. + //! \param[in] bufferLength Number of characters in buffer. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] actionType Value indicating how the parsed content and context node should be used. + //! \param[in,out] node The context node to be used base on the actionType. + //! + virtual void APICALL ParseWithSpecificAction( const char * buffer, sizet bufferLength, eActionType actionType, spINode & node ) = 0; + + //! + //! @brief Virtual copy constructor. + //! @details Creates an exact replica of the object. + //! \return A shared pointer to an object of \#IDOMParser which is the exact replica of the current serializer. + //! + virtual spIDOMParser APICALL Clone() const = 0; + + //! + //! \cond XMP_INTERNAL_DOCUMENTATION + + //! + //! @{ + //! @brief Returns the actual raw pointer from the shared pointer, which can be a shared pointer of a proxy class. + //! \return Either a const or non const pointer to IDOMParser interface. + //! + virtual pIDOMParser APICALL GetActualIDOMParser() __NOTHROW__ = 0; + XMP_PRIVATE pcIDOMParser GetActualIDOMParser() const __NOTHROW__ { + return const_cast< IDOMParser_v1 * >( this )->GetActualIDOMParser(); + } + //! + //! @} + + //! + //! @{ + //! @brief Returns the pointer to internal interfaces. + //! \return Either a const or non const pointer to IDOMParser_I interface. + //! + virtual AdobeXMPCore_Int::pIDOMParser_I APICALL GetIDOMParser_I() __NOTHROW__ = 0; + + XMP_PRIVATE AdobeXMPCore_Int::pcIDOMParser_I GetIDOMParser_I() const __NOTHROW__ { + return const_cast< IDOMParser_v1 * >( this )->GetIDOMParser_I(); + } + //! + //! @} + + //! + //! @{ + //! @brief Converts raw pointer to shared pointer. + //! @details The raw pointer is of version 1 interface where as the returned shared pointer depends on the version client is interested in. + //! + //! \return Shared pointer to const or non constant interface. + //! + XMP_PRIVATE static spIDOMParser MakeShared( pIDOMParser_base ptr ); + XMP_PRIVATE static spcIDOMParser MakeShared( pcIDOMParser_base ptr ) { + return MakeShared( const_cast< pIDOMParser_base >( ptr ) ); + } + //! + //! @} + + //! + //! return The unique ID assigned to the interface. + //! \return 64 bit unsigned integer representing the unique ID assigned to the interface. + //! + XMP_PRIVATE static uint64 GetInterfaceID() { return kIDOMParserID; } + + //! + //! return The version of the interface. + //! \return 32 bit unsigned integer representing the version of the interface. + //! + XMP_PRIVATE static uint32 GetInterfaceVersion() { return 1; } + //! \endcond + + protected: + //! + //! Destructor + //! + virtual ~IDOMParser_v1() __NOTHROW__ {} + + //! \cond XMP_INTERNAL_DOCUMENTATION + virtual pIMetadata_base APICALL parse( const char * buffer, sizet bufferLength, pcIError_base & error ) __NOTHROW__ = 0; + virtual void APICALL parseWithSpecificAction( const char * buffer, sizet bufferLength, uint32 actionType, pINode_base node, pcIError_base & error ) __NOTHROW__ = 0; + virtual pIDOMParser_base APICALL clone( pcIError_base & error ) const __NOTHROW__ = 0; + + #ifdef FRIEND_CLASS_DECLARATION + FRIEND_CLASS_DECLARATION(); + #endif + REQ_FRIEND_CLASS_DECLARATION(); + //! \endcond + + }; +} + +#endif // IDOMParser_h__ diff --git a/public/include/XMPCore/Interfaces/IDOMSerializer.h b/public/include/XMPCore/Interfaces/IDOMSerializer.h new file mode 100644 index 0000000..fe4d9fc --- /dev/null +++ b/public/include/XMPCore/Interfaces/IDOMSerializer.h @@ -0,0 +1,120 @@ +#ifndef IDOMSerializer_h__ +#define IDOMSerializer_h__ 1 + +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2014 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCore/XMPCoreFwdDeclarations.h" +#include "XMPCommon/Interfaces/BaseInterfaces/ISharedObject.h" +#include "XMPCommon/Interfaces/BaseInterfaces/IVersionable.h" +#include "XMPCommon/Interfaces/BaseInterfaces/IConfigurable.h" + +namespace AdobeXMPCore { + //! + //! @brief Version1 of the interface that represents an object that can serialize an XMP Data Model to a buffer. + //! Provides the functions to serialize the XMP Data Model. + //! + class XMP_PUBLIC IDOMSerializer_v1 + : public virtual IConfigurable + , public virtual ISharedObject + , public virtual IVersionable + { + public: + + //! + //! @brief Serializes the given XMP Node into an IUTF8String object. + //! \param[in] node An object of type \#INode which needs to be serialized. + //! \param[in] nameSpacePrefixMap An object of type \#INameSpacePrefixMap which contains preferred prefixes for namespaces. + //! \return An object of \#AdobeXMPCommon::IUTF8String type containing the serialized form of the node. + //! + virtual spIUTF8String APICALL Serialize( const spINode & node, const spcINameSpacePrefixMap & nameSpacePrefixMap = spcINameSpacePrefixMap() ) = 0; + + //! + //! @brief Virtual copy constructor. + //! Creates an exact replica of the object. + //! \return A shared pointer to an object of \#IDOMSerializer which is the exact replica of the current serializer. + //! + virtual spIDOMSerializer APICALL Clone() const = 0; + + //! + //! \cond XMP_INTERNAL_DOCUMENTATION + + //! + //! @{ + //! @brief Returns the actual raw pointer from the shared pointer, which can be a shared pointer of a proxy class. + //! \return Either a const or non const pointer to IDOMSerializer interface. + //! + virtual pIDOMSerializer APICALL GetActualIDOMSerializer() __NOTHROW__ = 0; + XMP_PRIVATE pcIDOMSerializer GetActualIDOMSerializer() const __NOTHROW__ { + return const_cast< IDOMSerializer_v1 * >( this )->GetActualIDOMSerializer(); + } + //! + //! @} + + //! + //! @{ + //! @brief Returns the pointer to internal interfaces. + //! \return Either a const or non const pointer to IDOMSerializer_I interface. + //! + virtual AdobeXMPCore_Int::pIDOMSerializer_I APICALL GetIDOMSerializer_I() __NOTHROW__ = 0; + + XMP_PRIVATE AdobeXMPCore_Int::pcIDOMSerializer_I GetIDOMSerializer_I() const __NOTHROW__ { + return const_cast< IDOMSerializer_v1 * >( this )->GetIDOMSerializer_I(); + } + //! + //! @} + + //! + //! @{ + //! @brief Converts raw pointer to shared pointer. The raw pointer is of version 1 interface + //! where as the returned shared pointer depends on the version client is interested in. + //! \return Shared pointer to const or non constant interface. + //! + XMP_PRIVATE static spIDOMSerializer MakeShared( pIDOMSerializer_base ptr ); + XMP_PRIVATE static spcIDOMSerializer MakeShared( pcIDOMSerializer_base ptr ) { + return MakeShared( const_cast< pIDOMSerializer_base >( ptr ) ); + } + + //! + //! @} + + //! + //! @brief Returns the unique ID assigned to the interface. + //! \return 64 bit unsigned integer representing the unique ID assigned to the interface. + //! + XMP_PRIVATE static uint64 GetInterfaceID() { return kIDOMSerializerID; } + + //! + //! @brief Returns the version of the interface. + //! \return 32 bit unsigned integer representing the version of the interface. + //! + XMP_PRIVATE static uint32 GetInterfaceVersion() { return 1; } + //! \endcond + + protected: + //! + //! Destructor + //! + virtual ~IDOMSerializer_v1() __NOTHROW__ {} + + //! \cond XMP_INTERNAL_DOCUMENTATION + virtual pIUTF8String_base APICALL serialize( pINode_base node, pcINameSpacePrefixMap_base map, pcIError_base & error ) __NOTHROW__ = 0; + virtual pIDOMSerializer_base APICALL clone( pcIError_base & error ) const __NOTHROW__ = 0; + + #ifdef FRIEND_CLASS_DECLARATION + FRIEND_CLASS_DECLARATION(); + #endif + REQ_FRIEND_CLASS_DECLARATION(); + //! \endcond + + }; +} + +#endif // IDOMSerializer_h__ + diff --git a/public/include/XMPCore/Interfaces/IMetadata.h b/public/include/XMPCore/Interfaces/IMetadata.h new file mode 100644 index 0000000..74015a6 --- /dev/null +++ b/public/include/XMPCore/Interfaces/IMetadata.h @@ -0,0 +1,145 @@ +#ifndef __IMetadata_h__ +#define __IMetadata_h__ 1 + +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2014 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCore/Interfaces/IStructureNode.h" + +namespace AdobeXMPCore { + + //! + //! \brief Version1 of the interface that represents the whole xmp metadata for an asset. + //! @details Provides all the functions to add or remove nodes to and from metadata. + //! \attention Support multi threading through locks but can be enabled/disabled by the client. By default + //! every object created does not support multi-threading. + //! + + class XMP_PUBLIC IMetadata_v1 + : public virtual IStructureNode_v1 + { + public: + //! + + //! @brief Gets the about URI string for the XMP metadata. + //! \return A shared pointer to const \#AdobeXMPCommon::IUTF8String object containing URI string. + //! \note By default this is an empty string. + //! + virtual spcIUTF8String APICALL GetAboutURI() const = 0; + + //! + //! @brief Sets the about URI string for the XMP metadata. + //! \param[in] uri Pointer to a constant char buffer containing uri string. + //! \param[in] uriLength Number of characters in uri. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! + virtual void APICALL SetAboutURI( const char * uri, sizet uriLength ) __NOTHROW__ = 0; + + //! + //! @brief Enables support for a particular feature. + //! \param[in] key A const char buffer containing key for the feature. + //! \param[in] keyLength Number of characters in key. + //! \note Following keys are supported: + //! - alias Enable support for aliases on the metadata object. + //! + virtual void APICALL EnableFeature( const char * key, sizet keyLength ) const __NOTHROW__ = 0; + + //! + //! @brief Disables support for a particular feature. + //! \param[in] key A const char buffer containing key for the feature. + //! \param[in] keyLength Number of characters in key. + //! + virtual void APICALL DisableFeature( const char * key, sizet keyLength ) const __NOTHROW__ = 0; + + //! \cond XMP_INTERNAL_DOCUMENTATION + + //! + //! @{ + //! @brief Returns the actual raw pointer from the shared pointer, which can be a shared pointer of a proxy class. + //! \return Either a const or non const pointer to IMetadata interface. + //! + virtual pIMetadata APICALL GetActualIMetadata() __NOTHROW__ = 0; + XMP_PRIVATE pcIMetadata GetActualIMetadata() const __NOTHROW__ { + return const_cast< IMetadata_v1 * >( this )->GetActualIMetadata(); + } + //! + //! @} + + //! + //! @{ + //! @brief Returns the pointer to internal interfaces. + //! \return Either a const or non const pointer to IMetadata_I interface. + //! + virtual AdobeXMPCore_Int::pIMetadata_I APICALL GetIMetadata_I() __NOTHROW__ = 0; + + XMP_PRIVATE AdobeXMPCore_Int::pcIMetadata_I GetIMetadata_I() const __NOTHROW__ { + return const_cast< IMetadata_v1 * >( this )->GetIMetadata_I(); + } + //! + //! @} + + //! + //! @{ + //! @brief Converts raw pointer to shared pointer. The raw pointer is of version 1 interface + //! where as the returned shared pointer depends on the version client is interested in. + //! \return Shared pointer to const or non constant interface. + //! + XMP_PRIVATE static spIMetadata MakeShared( pIMetadata_base ptr ); + XMP_PRIVATE static spcIMetadata MakeShared( pcIMetadata_base ptr ) { + return MakeShared( const_cast< pIMetadata_base >( ptr ) ); + } + //! + //! @} + + //! + //! @brief Returns the unique ID assigned to the interface. + //! \return 64 bit unsigned integer representing the unique ID assigned to the interface. + //! + XMP_PRIVATE static uint64 GetInterfaceID() { return kIMetadataID; } + + //! + //! @brief Returns the version of the interface. + //! \return 32 bit unsigned integer representing the version of the interface. + //! + XMP_PRIVATE static uint32 GetInterfaceVersion() { return 1; } + //! \endcond + + // static factory functions + + //! + //! @brief Creates an empty IMetadata object. + //! \return A shared pointer to an empty \#IMetadata object. + //! + XMP_PRIVATE static spIMetadata CreateMetadata(); + + protected: + //! + //! Destructor + //! + virtual ~IMetadata_v1() __NOTHROW__ {} + + //! Hiding some functions from derived classes + using INode_v1::GetParent; + using INode_v1::GetNameSpace; + using INode_v1::SetNameSpace; + using INode_v1::GetName; + using INode_v1::SetName; + + //! \cond XMP_INTERNAL_DOCUMENTATION + virtual pcIUTF8String_base APICALL getAboutURI( pcIError_base & error ) const __NOTHROW__ = 0; + + #ifdef FRIEND_CLASS_DECLARATION + FRIEND_CLASS_DECLARATION(); + #endif + REQ_FRIEND_CLASS_DECLARATION(); + //! \endcond + + }; +} + +#endif // __IMetadata_h__ diff --git a/public/include/XMPCore/Interfaces/INameSpacePrefixMap.h b/public/include/XMPCore/Interfaces/INameSpacePrefixMap.h new file mode 100644 index 0000000..9aa606a --- /dev/null +++ b/public/include/XMPCore/Interfaces/INameSpacePrefixMap.h @@ -0,0 +1,236 @@ +#ifndef INameSpacePrefixMap_h__ +#define INameSpacePrefixMap_h__ 1 + +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2014 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCore/XMPCoreFwdDeclarations.h" +#include "XMPCommon/Interfaces/BaseInterfaces/ISharedObject.h" +#include "XMPCommon/Interfaces/BaseInterfaces/IVersionable.h" +#include "XMPCommon/Interfaces/BaseInterfaces/IThreadSafe.h" + +namespace AdobeXMPCore { + + //! + //! \brief Version1 of the interface that represents map where each entry consists of prefix string + //! as the key and corresponding nameSpace string as its value. + //! \details Provides all the functions to get/set the entries inside the map. + //! \attention Supports Multi-threading at object level through locks. + //! + class XMP_PUBLIC INameSpacePrefixMap_v1 + : public virtual ISharedObject + , public virtual IVersionable + , public virtual IThreadSafe + { + public: + + //! + //! @brief Adds a new pair of prefix string and its corresponding nameSpace string or replace an existing entry. + //! \param[in] prefix Pointer to a constant char buffer containing prefix string. + //! \param[in] prefixLength Number of characters in prefix. In case prefix is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] nameSpace Pointer to a constant char buffer containing nameSpace string. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \return A bool type object containing true in case operation was successful, false otherwise. + //! \note Raises warning in case of + //! - prefix or nameSpace are null pointers + //! - prefixLength or nameSpaceLength is 0. + //! + virtual bool APICALL Insert( const char * prefix, sizet prefixLength, const char * nameSpace, sizet nameSpaceLength ) = 0; + + //! + //! @brief Finds the prefix string in the map and removes an entry corresponding to it in the map. + //! \param[in] prefix Pointer to a const char buffer containing prefix string. + //! \param[in] prefixLength Number of characters in prefix. In case prefix is null terminated set it to \#AdobeXMPCommon::npos. + //! \return A bool type object containing true in case entry was found and then deleted from the map, false otherwise. + //! \note Raises warning in case of + //! - prefix is null pointer, or + //! - prefixLength is 0. + //! \attention Throws AdobeXMPCommon::pcIError in case of failure in removing or searching process. + //! + virtual bool APICALL RemovePrefix( const char * prefix, sizet prefixLength ) = 0; + + //! + //! @brief Finds the nameSpace string in the map and removes an entry corresponding to it in the map. + //! \param[in] nameSpace Pointer to a constant char buffer containing nameSpace string. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \return A bool type object containing true in case entry was found and then deleted from the map, false otherwise. + //! \note Raises warning in case of + //! - nameSpace is null pointer, or + //! - nameSpaceLength is 0. + //! \attention Throws AdobeXMPCommon::pcIError in case of failure in removing or searching process. + //! + virtual bool APICALL RemoveNameSpace( const char * nameSpace, sizet nameSpaceLength ) = 0; + + //! + //! @brief Checks for the existence of a particular prefix in the map. + //! \param[in] prefix Pointer to a const char buffer containing prefix string. + //! \param[in] prefixLength Number of characters in prefix. In case prefix is null terminated set it to \#AdobeXMPCommon::npos. + //! \return A bool type object containing true in case there is an entry present corresponding to the prefix string, otherwise false. + //! \note Raises warning in case of + //! - prefix is null pointer, or + //! - prefixLength is 0. + //! + virtual bool APICALL IsPrefixPresent( const char * prefix, sizet prefixLength ) const = 0; + + //! + //! @brief Checks for the existence of a particular nameSpace in the map. + //! \param[in] nameSpace Pointer to a constant char buffer containing nameSpace string. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \return A bool type object containing true in case there is an entry present corresponding to the nameSpace string, otherwise false. + //! \note Raises warning in case of + //! - nameSpace is null pointer, or + //! - nameSpaceLength is 0. + //! + virtual bool APICALL IsNameSpacePresent( const char * nameSpace, sizet nameSpaceLength ) const = 0; + + //! + //! @brief Gets the nameSpace string corresponding to the prefix string. + //! \param[in] prefix Pointer to a const char buffer containing prefix string. + //! \param[in] prefixLength Number of characters in prefix. In case prefix is null terminated set it to \#AdobeXMPCommon::npos. + //! \return A shared pointer to const \#AdobeXMPCommon::IUTF8String object containing nameSpace string corresponding to + //! prefix string if a mapping exists, otherwise invalid shared pointer is returned. + //! \note Raises warning in case of + //! - prefix is null pointer, or + //! - prefixLength is 0. + //! + virtual spcIUTF8String APICALL GetNameSpace( const char * prefix, sizet prefixLength ) const = 0; + + //! + //! @brief Get the prefix string corresponding to the nameSpace string. + //! \param[in] nameSpace Pointer to a constant char buffer containing nameSpace string. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \return A shared pointer to const \#AdobeXMPCommon::IUTF8String object containing prefix string corresponding to + //! nameSpace string if a mapping exists, otherwise invalid shared pointer is returned. + //! \note Raises warning in case of + //! - nameSpace is null pointer, or + //! - nameSpaceLength is 0. + //! + virtual spcIUTF8String APICALL GetPrefix( const char * nameSpace, sizet nameSpaceLength ) const = 0; + + //! + //! @brief To get the total number of entries in the map. + //! \return An object of type \#AdobeXMPCommon::sizet containing the count of entries in the map. + //! + virtual sizet APICALL Size() const __NOTHROW__ = 0; + + //! + //! @brief To check whether the map is empty or not. + //! \return True in case map is empty; false otherwise. + //! + bool IsEmpty() const __NOTHROW__; + + //! + //! @brief Clear all the entries in the map. + //! + virtual void APICALL Clear() __NOTHROW__ = 0; + + //! + //! \brief Virtual Copy Constructor. + //! \details Makes an another object which is exact replica of the existing object. + // \return A shared pointer to INameSpacePrefixMap which is exact replica of the current object. + //! + virtual spINameSpacePrefixMap APICALL Clone() const = 0; + + //! + //! \cond XMP_INTERNAL_DOCUMENTATION + + //! + //! @{ + //! @brief Returns the actual raw pointer from the shared pointer, which can be a shared pointer of a proxy class. + //! \return Either a const or non const pointer to INameSpacePrefixMap interface. + //! + virtual pINameSpacePrefixMap APICALL GetActualINameSpacePrefixMap() __NOTHROW__ = 0; + XMP_PRIVATE pcINameSpacePrefixMap GetActualINameSpacePrefixMap() const __NOTHROW__ { + return const_cast< INameSpacePrefixMap_v1 * >( this )->GetActualINameSpacePrefixMap(); + } + //! + //! @} + + //! + //! @{ + //! @brief Returns the pointer to internal interfaces. + //! \return Either a const or non const pointer to INameSpacePrefixMap_I interface. + //! + virtual AdobeXMPCore_Int::pINameSpacePrefixMap_I APICALL GetINameSpacePrefixMap_I() __NOTHROW__ = 0; + + XMP_PRIVATE AdobeXMPCore_Int::pcINameSpacePrefixMap_I GetINameSpacePrefixMap_I() const __NOTHROW__ { + return const_cast< INameSpacePrefixMap_v1 * >( this )->GetINameSpacePrefixMap_I(); + } + //! + //! @} + + //! + //! @{ + //! @brief Converts raw pointer to shared pointer. The raw pointer is of version 1 interface + //! where as the returned shared pointer depends on the version client is interested in. + //! \return shared pointer to const or non constant interface. + //! + XMP_PRIVATE static spINameSpacePrefixMap MakeShared( pINameSpacePrefixMap_base ptr ); + XMP_PRIVATE static spcINameSpacePrefixMap MakeShared( pcINameSpacePrefixMap_base ptr ) { + return MakeShared( const_cast< pINameSpacePrefixMap_base >( ptr ) ); + } + //! + //! @} + + //! + //! @brief Returns the unique ID assigned to the interface. + //! \return 64 bit unsigned integer representing the unique ID assigned to the interface. + //! + XMP_PRIVATE static uint64 GetInterfaceID() { return kINameSpacePrefixMapID; } + + //! + //! @brief returns the version of the interface. + //! \return 32 bit unsigned integer representing the version of the interface. + //! + XMP_PRIVATE static uint32 GetInterfaceVersion() { return 1; } + + //! \endcond + + + // static factory functions + + //! + //! @brief Provides the default mapping of prefix string and nameSpace strings used by XMPCore. + //! \return A shared pointer to const INameSpacePrefixMap object containing all the mappings used + //! as default by the XMPCore. + //! + XMP_PRIVATE static spcINameSpacePrefixMap GetDefaultNameSpacePrefixMap(); + + //! + //! @brief Creates an empty namespace - prefix map and returns it to the client as a shared pointer. + //! \return A shared pointer to an empty INameSpacePrefixMap object. + //! + XMP_PRIVATE static spINameSpacePrefixMap CreateNameSpacePrefixMap(); + + protected: + //! + //! Destructor + //! + virtual ~INameSpacePrefixMap_v1() __NOTHROW__ {} + + //! \cond XMP_INTERNAL_DOCUMENTATION + const uint32 kPrefixIsParameter = 0; + const uint32 kNameSpaceIsParameter = 1; + + virtual uint32 APICALL insert( const char * prefix, sizet prefixLength, const char * nameSpace, sizet nameSpaceLength, pcIError_base & error ) __NOTHROW__ = 0; + virtual uint32 APICALL remove( uint32 keyType, const char * key, sizet keyLength, pcIError_base & error ) __NOTHROW__ = 0; + virtual uint32 APICALL isPresent( uint32 keyType, const char * key, sizet keyLength, pcIError_base & error ) const __NOTHROW__ = 0; + virtual pcIUTF8String_base APICALL get( uint32 keyType, const char * key, sizet keyLength, pcIError_base & error ) const __NOTHROW__ = 0; + virtual pINameSpacePrefixMap_base APICALL clone( pcIError_base & error ) const __NOTHROW__ = 0; + + #ifdef FRIEND_CLASS_DECLARATION + FRIEND_CLASS_DECLARATION(); + #endif + REQ_FRIEND_CLASS_DECLARATION(); + //! \endcond + + }; +} + +#endif // INameSpacePrefixMap_h__ diff --git a/public/include/XMPCore/Interfaces/INode.h b/public/include/XMPCore/Interfaces/INode.h new file mode 100644 index 0000000..59b64bb --- /dev/null +++ b/public/include/XMPCore/Interfaces/INode.h @@ -0,0 +1,582 @@ +#ifndef __INode_h__ +#define __INode_h__ 1 + +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2014 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCore/XMPCoreFwdDeclarations.h" +#include "XMPCommon/Interfaces/BaseInterfaces/ISharedObject.h" +#include "XMPCommon/Interfaces/BaseInterfaces/IVersionable.h" +#include "XMPCommon/Interfaces/BaseInterfaces/IThreadSafe.h" + +namespace AdobeXMPCore { + + //! + //! \brief Version1 of the interface that serves as a base interface to all types of nodes in the XMP DOM. + //! \details Provides all the functions to get various properties of the node. + //! \attention Support multi threading through locks but can be enabled/disabled by the client. By default + //! every object created does not support multi-threading. + //! + class XMP_PUBLIC INode_v1 + : public virtual ISharedObject + , public virtual IVersionable + , public virtual IThreadSafe + { + public: + + //! + //! @brief Indicates various types of node available in XMP Data Model like simple, array and structure. + //! + typedef enum { + //! Indicates none, to be used as invalid type. + kNTNone = 0, + + //! XMP Node is of Simple Node type (key value pair). + kNTSimple = 1, + + //! XMP Node is of Array type. Indexing start from 1. + kNTArray = 1 << 1, + + //! XMP Node is of structure type. + kNTStructure = 1 << 2, + + //! XMP Node of any type + kNTAll = kAllBits + } eNodeType; + + //! + //! @brief Gets the node type of the node. + //! \return An object of type \#eNodeType indicating the type of the node. + //! + virtual eNodeType APICALL GetNodeType() const = 0; + + //! + //! @brief Gets the node type of the node's parent. + //! \return An object of type \#eNodeType indicating the type of the node. + //! \note \#eNodeType::kNTNone is returned in case node has no parent. + //! + virtual eNodeType APICALL GetParentNodeType() const = 0; + + //! + //! @{ + //! @brief Gets the parent node of the node. + //! \return Either a const or non const pointer to INode interface. + //! \return A shared pointer to either a const or non const \#AdobeXMPCore::INode representing the parent of the node. + //! \note Returns an invalid shared pointer in case the node is a root node or it is not part of tree. + //! + XMP_PRIVATE spcINode GetParent() const { + return const_cast< INode_v1 * >( this )->GetParent(); + } + virtual spINode APICALL GetParent() = 0; + //! + //! @} + + //! + //! @brief Changes the local name of the node. + //! \param[in] name Pointer to a constant char buffer containing local name of the node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \attention Error can be thrown in case + //! - name is NULL pointer or its contents are empty + //! - name is not valid XML property name. + //! - Sibling with the same combination of name and nameSpace is present. + //! + virtual void APICALL SetName( const char * name, sizet nameLength ) = 0; + + //! + //! @brief Gets the local name of the node. + //! \return a shared pointer to const \#AdobeXMPCommon::IUTF8String representing the name of the node. + //! + virtual spcIUTF8String APICALL GetName() const = 0; + + //! + //! @brief Changes the name space of the node. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \attention Error can be thrown in case + //! - nameSpace is NULL pointer or its contents are empty + //! - Sibling with the same combination of name and nameSpace is present. + //! + virtual void APICALL SetNameSpace( const char * nameSpace, sizet nameSpaceLength ) = 0; + + //! + //! @brief Gets the name space of the node. + //! \return A shared pointer to const \#AdobeXMPCommon::IUTF8String representing the name space of the node. + //! + virtual spcIUTF8String APICALL GetNameSpace() const = 0; + + //! + //! @brief Gets the path of the node from the root of the metadata. + //! \return A shared pointer to \#AdobeXMPCore::IPath representing the path of the node. + //! + virtual spIPath APICALL GetPath() const = 0; + + //! + //! @brief Gets the count of the qualifiers attached with the node + //! \return An object of type \#AdobeXMPCommon::sizet containing the count of qualifiers attached with the node. + //! + virtual sizet APICALL QualifiersCount() const __NOTHROW__ = 0; + + //! + //! @{ + //! Get an iterator object to iterate over all the qualifier nodes attached to the composite node. + //! \return A shared pointer to a const or non const \#INodeIterator object. + //! + XMP_PRIVATE spcINodeIterator QualifiersIterator() const { + return const_cast< INode_v1 * >( this )->QualifiersIterator(); + } + virtual spINodeIterator APICALL QualifiersIterator() = 0; + //! @} + + //! + //! @brief Gets the type of the node's qualifier having specified namespace and name. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the qualifier node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the qualifier node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \return An object of type \#eNodeType indicating the type of the node's qualifier. + //! \note In case no qualifier exists with the specified nameSpace and name combination then an \#eNodeType::kNTNode is returned. + //! + virtual eNodeType APICALL GetQualifierNodeType( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) const = 0; + + //! + //! @{ + //! @brief Gets the qualifier of the node having specified namespace and name. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the qualifier node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the qualifier node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \return A shared pointer to either a const or const qualifier node. + //! \note In case no qualifier exists with the specified nameSpace and name combination then an invalid shared pointer + //! is returned. + //! + XMP_PRIVATE spcINode GetQualifier( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) const { + return const_cast< INode_v1 * >( this )->GetQualifier( nameSpace, nameSpaceLength, name, nameLength ); + } + virtual spINode APICALL GetQualifier( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) = 0; + //! @} + + //! + //! @{ + //! @brief Get the node's qualifier having specified name space and name as simple node. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the qualifier node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the qualifier node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \return A shared pointer to const or non const \#ISimpleNode object containing qualifier. + //! \note In case no qualifier exists with the specified nameSpace and name combination then an invalid shared pointer + //! is returned. + //! \attention Error is thrown in case + //! - a qualifier exists with the specified nameSpace and name combination but is not a simple node. + //! + XMP_PRIVATE spcISimpleNode GetSimpleQualifier( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) const { + auto node = GetQualifier( nameSpace, nameSpaceLength, name, nameLength ); + if ( node ) return node->ConvertToSimpleNode(); + return spcISimpleNode(); + } + + XMP_PRIVATE spISimpleNode GetSimpleQualifier( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) { + auto node = GetQualifier( nameSpace, nameSpaceLength, name, nameLength ); + if ( node ) return node->ConvertToSimpleNode(); + return spISimpleNode(); + } + //! @} + + //! + //! @{ + //! @brief Get the node's qualifier having specified name space and name as structure node. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the qualifier node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the qualifier node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \return A shared pointer to const or non const \#IStructureNode object containing qualifier. + //! \note In case no qualifier exists with the specified nameSpace and name combination then an invalid shared pointer + //! is returned. + //! \attention Error is thrown in case + //! - a qualifier exists with the specified nameSpace and name combination but is not a structure node. + //! + XMP_PRIVATE spcIStructureNode GetStructureQualifier( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) const { + auto node = GetQualifier( nameSpace, nameSpaceLength, name, nameLength ); + if ( node ) return node->ConvertToStructureNode(); + return spcIStructureNode(); + } + + XMP_PRIVATE spIStructureNode GetStructureQualifier( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) { + auto node = GetQualifier( nameSpace, nameSpaceLength, name, nameLength ); + if ( node ) return node->ConvertToStructureNode(); + return spIStructureNode(); + } + //! @} + + //! + //! @{ + //! @brief Get the node's qualifier having specified name space and name as an array node. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the qualifier node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the qualifier node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \return A shared pointer to const or non const \#ISimpleNode object containing qualifier. + //! \note In case no qualifier exists with the specified nameSpace and name combination then an invalid shared pointer + //! is returned. + //! \attention Error is thrown in case + //! - a qualifier exists with the specified nameSpace and name combination but is not an array node. + //! + XMP_PRIVATE spcIArrayNode GetArrayQualifier( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) const { + auto node = GetQualifier( nameSpace, nameSpaceLength, name, nameLength ); + if ( node ) return node->ConvertToArrayNode(); + return spcIArrayNode(); + } + + XMP_PRIVATE spIArrayNode GetArrayQualifier( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) { + auto node = GetQualifier( nameSpace, nameSpaceLength, name, nameLength ); + if ( node ) return node->ConvertToArrayNode(); + return spIArrayNode(); + } + //! @} + + //! + //! @brief Inserts a given qualifier node. + //! \param[in] node Shared pointer to an object of \#AdobeXMPCore::INode representing the qualifier node to be inserted. + //! \attention Error is thrown in following cases: + //! - given qualifier node is invalid. + //! - given qualifier node is already a child of some other node. + //! - there exists a qualifier node with the same nameSpace and name combination. + //! - parent or any ancestor node is a qualifier node. + //! + virtual void APICALL InsertQualifier( const spINode & node ) = 0; + + //! + //! @brief Replaces a given qualifier node. + //! \param[in] node Shared pointer to an object of \#AdobeXMPCore::INode representing the qualifier node to be inserted. + //! \return A shared pointer to a qualifier node which is being replaced. + //! \attention Error is thrown in following cases: + //! -# given qualifier node is invalid. + //! -# given qualifier node is already a child of some other node. + //! -# there exists no qualifier node with the same nameSpace and name combination. + //! \note Warning is raised in case the type of the old existing node is not same as that of new node. + //! + virtual spINode APICALL ReplaceQualifier( const spINode & node ) = 0; + + //! + //! @brief Removes the qualifier node with the specified nameSpace and name. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the qualifier node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the qualifier node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \return A shared pointer to \#AdobeXMPCore::INode object representing qualifier node which is removed from the node. + //! \note In case no qualifier node exists at the given index an invalid shared pointer is returned. + //! + virtual spINode APICALL RemoveQualifier( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) = 0; + + //! + //! @brief Indicates whether the node is a direct child of an array node. + //! \return A bool value; true in case the node is a direct child of an array node, false otherwise. + //! + virtual bool APICALL IsArrayItem() const = 0; + + //! + //! @brief Indicates whether the node is a qualifier node. + //! \return A bool value; true in case the node is a qualifier node, false otherwise. + //! + virtual bool APICALL IsQualifierNode() const = 0; + + //! + //! @brief Returns the index of the node in case it is an array item. + //! \return The index of the node, in case it is an array item, otherwise returns 0. + //! + virtual sizet APICALL GetIndex() const = 0; + + //! + //! @brief Indicates whether the node has any qualifiers associated with it. + //! \return A bool value; true in case the node has any qualifier associated with it, false otherwise. + //! + virtual bool APICALL HasQualifiers() const = 0; + + //! + //! @brief Returns whether the node has any content or not. + //! return A bool value indicating the presence of contents in the node apart from qualifiers. + //! + virtual bool APICALL HasContent() const = 0; + + //! + //! @brief Returns whether the node is empty. + //! return A bool value indicating whether the contents and qualifiers of a node are empty. + //! + virtual bool APICALL IsEmpty() const = 0; + + //! + //! @brief Returns the status about any change done to the node or its children or qualifiers. + //! returns a bool value indicating whether some changes have been performed on the node or its children or qualifiers. + //! for a simple node, true will be returned in scenarios like when the node's value or qualifiers are modified. + //! for an array node or a structure node, true will be returned in scenarios like when the node's children or the node's qualifiers are modified. + //! + virtual bool APICALL HasChanged() const = 0; + + //! + //! @brief Acknowledges that changes for the node and its children and qualifiers have been taken care of. + //! for a simple node, changes that will be acknowledged in scenarios like when the node's value or node's qualifiers were modified. + //! for an array node or a structure node, changes will be acknowledged in scenarios like when the node's children were or the node's qualifiers were modified. + //! + virtual void APICALL AcknowledgeChanges() const __NOTHROW__ = 0; + + //! + //! @brief Clear the contents of the node. + //! \param[in] contents A bool value controlling whether contents of the node should be cleared or not. + //! \param[in] qualifiers A bool value controlling whether qualifiers of the node should be cleared or not. + //! + virtual void APICALL Clear( bool contents = true, bool qualifiers = true ) = 0; + + //! + //! @{ + //! @brief Converts Node to a simple node, if possible. + //! \return Shared pointer to const or non const ISimpleNode object. An empty simple node is thrown in case actual node is not a simple node. + //! + XMP_PRIVATE spcISimpleNode ConvertToSimpleNode() const { + return const_cast< INode_v1 * >( this )->ConvertToSimpleNode(); + } + virtual spISimpleNode APICALL ConvertToSimpleNode() = 0; + //! @} + + //! + //! @{ + //! @brief Converts Node to a structure node type, if possible. + //! \return Shared pointer to const or non const IStructureNode object. An empty structure node is thrown in case actual node is not a structure node. + //! + XMP_PRIVATE spcIStructureNode ConvertToStructureNode() const { + return const_cast< INode_v1 * >( this )->ConvertToStructureNode(); + } + virtual spIStructureNode APICALL ConvertToStructureNode() = 0; + //! @} + + //! + //! @{ + //! @brief Converts Node to an array node type, if possible. + //! \return Shared pointer to const or non const IArrayNode object. An empty array node is thrown in case actual node is not an array node. + //! + XMP_PRIVATE spcIArrayNode ConvertToArrayNode() const { + return const_cast< INode_v1 * >( this )->ConvertToArrayNode(); + } + virtual spIArrayNode APICALL ConvertToArrayNode() = 0; + //! @} + + //! + //! @{ + //! @brief Converts Node to a metadata node type, if possible. + //! \return Shared pointer to const or non const IMetadata object. An empty metadata node is thrown in case actual node is not a metadata node. + //! + XMP_PRIVATE spcIMetadata ConvertToMetadata() const { + return const_cast< INode_v1 * >( this )->ConvertToMetadata(); + } + virtual spIMetadata APICALL ConvertToMetadata() = 0; + //! @} + + //! + //! @brief Virtual copy constructor + //! @details Clones the node creating an exact replica of the node which is not part of any metadata tree. + //! \param[in] ignoreEmptyNodes A bool value controlling whether to clone empty nodes or not. + //! \param[in] ignoreNodesWithOnlyQualifiers A bool value controlling whether presence of only qualifiers should mark + //! node as non empty. + //! \return A shared pointer to newly created replica of the node. + //! + virtual spINode APICALL Clone( bool ignoreEmptyNodes = false, bool ignoreNodesWithOnlyQualifiers = false ) const = 0; + + //! + //! \cond XMP_INTERNAL_DOCUMENTATION + + //! + //! @{ + //! @brief Returns the actual raw pointer from the shared pointer, which can be a shared pointer of a proxy class. + //! \return Either a const or non const pointer to INode interface. + //! + virtual pINode APICALL GetActualINode() __NOTHROW__ = 0; + + XMP_PRIVATE pcINode GetActualINode() const __NOTHROW__ { + return const_cast< INode_v1 * >( this )->GetActualINode(); + } + //! + //! @} + + //! + //! @{ + //! @brief Returns the pointer to internal interfaces. + //! \return Either a const or non const pointer to INode_I interface. + //! + virtual AdobeXMPCore_Int::pINode_I APICALL GetINode_I() __NOTHROW__ = 0; + + XMP_PRIVATE AdobeXMPCore_Int::pcINode_I GetINode_I() const __NOTHROW__ { + return const_cast< INode_v1 * >( this )->GetINode_I(); + } + //! + //! @} + + //! + //! @{ + //! @brief Converts raw pointer to shared pointer. The raw pointer is of version 1 interface + //! where as the returned shared pointer depends on the version client is interested in. + //! \return Shared pointer to const or non constant interface. + //! + XMP_PRIVATE static spINode MakeShared( pINode_base ptr ); + XMP_PRIVATE static spcINode MakeShared( pcINode_base ptr ) { + return MakeShared( const_cast< pINode_base >( ptr ) ); + } + //! + //! @} + + //! + //! @brief Returns the unique ID assigned to the interface. + //! \return 64 bit unsigned integer representing the unique ID assigned to the interface. + //! + XMP_PRIVATE static uint64 GetInterfaceID() { return kINodeID; } + + //! + //! @brief Returns the version of the interface. + //! \return 32 bit unsigned integer representing the version of the interface. + //! + XMP_PRIVATE static uint32 GetInterfaceVersion() { return 1; } + //! \endcond + + protected: + //! + //! Destructor + //! + virtual ~INode_v1() __NOTHROW__ {} + + //! \cond XMP_INTERNAL_DOCUMENTATION + virtual uint32 APICALL getParentNodeType( pcIError_base & error ) const __NOTHROW__ = 0; + virtual pINode_base APICALL getParent( pcIError_base & error ) __NOTHROW__ = 0; + virtual void APICALL setName( const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__ = 0; + virtual pcIUTF8String_base APICALL getName( pcIError_base & error ) const __NOTHROW__ = 0; + virtual void APICALL setNameSpace( const char * nameSpace, sizet nameSpaceLength, pcIError_base & error ) __NOTHROW__ = 0; + virtual pcIUTF8String_base APICALL getNameSpace( pcIError_base & error ) const __NOTHROW__ = 0; + virtual pIPath_base APICALL getPath( pcIError_base & error ) const __NOTHROW__ = 0; + virtual pINodeIterator_base APICALL qualifiersIterator( pcIError_base & error ) __NOTHROW__ = 0; + virtual uint32 APICALL getQualifierNodeType( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) const __NOTHROW__ = 0; + virtual pINode_base APICALL getQualifier( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__ = 0; + virtual void APICALL insertQualifier( pINode_base base, pcIError_base & error ) __NOTHROW__ = 0; + virtual pINode_base APICALL replaceQualifier( pINode_base node, pcIError_base & error ) __NOTHROW__ = 0; + virtual pINode_base APICALL removeQualifier( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__ = 0; + virtual uint32 APICALL getNodeType( pcIError_base & error ) const __NOTHROW__ = 0; + virtual uint32 APICALL isArrayItem( pcIError_base & error ) const __NOTHROW__ = 0; + virtual uint32 APICALL isQualifierNode( pcIError_base & error ) const __NOTHROW__ = 0; + virtual sizet APICALL getIndex( pcIError_base & error ) const __NOTHROW__ = 0; + virtual uint32 APICALL hasQualifiers( pcIError_base & error ) const __NOTHROW__ = 0; + virtual uint32 APICALL hasContent( pcIError_base & error ) const __NOTHROW__ = 0; + virtual uint32 APICALL isEmpty( pcIError_base & error ) const __NOTHROW__ = 0; + virtual uint32 APICALL hasChanged( pcIError_base & error ) const __NOTHROW__ = 0; + virtual void APICALL clear( uint32 contents, uint32 qualifiers, pcIError_base & error ) __NOTHROW__ = 0; + virtual pINode_base APICALL clone( uint32 igoreEmptyNodes, uint32 ignoreNodesWithOnlyQualifiers, pcIError_base & error ) const __NOTHROW__ = 0; + virtual pISimpleNode_base APICALL convertToSimpleNode( pcIError_base & error ) __NOTHROW__ = 0; + virtual pIStructureNode_base APICALL convertToStructureNode( pcIError_base & error ) __NOTHROW__ = 0; + virtual pIArrayNode_base APICALL convertToArrayNode( pcIError_base & error ) __NOTHROW__ = 0; + virtual pIMetadata_base APICALL convertToMetadata( pcIError_base & error ) __NOTHROW__ = 0; + + //! @} + + #ifdef FRIEND_CLASS_DECLARATION + FRIEND_CLASS_DECLARATION(); + #endif + REQ_FRIEND_CLASS_DECLARATION(); + //! \endcond + + }; +} + +//! \cond XMP_INTERNAL_DOCUMENTATION +#if !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB + namespace AdobeXMPCore { + + class INodeProxy + : public virtual INode + { + private: + pINode mRawPtr; + + public: + INodeProxy( pINode ptr ); + ~INodeProxy() __NOTHROW__ ; + + pINode APICALL GetActualINode() __NOTHROW__; + void APICALL Acquire() const __NOTHROW__; + void APICALL Release() const __NOTHROW__; + + AdobeXMPCommon_Int::pISharedObject_I APICALL GetISharedObject_I() __NOTHROW__; + AdobeXMPCore_Int::pINode_I APICALL GetINode_I() __NOTHROW__; + + pvoid APICALL GetInterfacePointer( uint64 interfaceID, uint32 interfaceVersion ); + + virtual eNodeType APICALL GetParentNodeType() const; + virtual spINode APICALL GetParent(); + virtual void APICALL SetName( const char * name, sizet nameLength ); + virtual spcIUTF8String APICALL GetName() const; + virtual void APICALL SetNameSpace( const char * nameSpace, sizet nameSpaceLength ); + virtual spcIUTF8String APICALL GetNameSpace() const; + virtual spIPath APICALL GetPath() const; + virtual sizet APICALL QualifiersCount() const __NOTHROW__; + virtual spINodeIterator APICALL QualifiersIterator(); + virtual eNodeType APICALL GetQualifierNodeType( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) const; + virtual spINode APICALL GetQualifier( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ); + virtual void APICALL InsertQualifier( const spINode & node ); + virtual spINode APICALL ReplaceQualifier( const spINode & node ); + virtual spINode APICALL RemoveQualifier( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ); + virtual eNodeType APICALL GetNodeType() const; + virtual bool APICALL IsArrayItem() const; + virtual bool APICALL IsQualifierNode() const; + virtual sizet APICALL GetIndex() const; + virtual bool APICALL HasQualifiers() const; + virtual bool APICALL HasContent() const; + virtual bool APICALL IsEmpty() const; + virtual bool APICALL HasChanged() const; + virtual void APICALL AcknowledgeChanges() const __NOTHROW__; + virtual void APICALL Clear( bool contents, bool qualifiers ); + virtual spINode APICALL Clone( bool ignoreEmptyNodes, bool ignoreNodesWithOnlyQualifiers ) const; + virtual void APICALL EnableThreadSafety() const __NOTHROW__; + virtual void APICALL DisableThreadSafety() const __NOTHROW__; + virtual bool APICALL IsThreadSafe() const; + virtual AdobeXMPCommon_Int::pIThreadSafe_I APICALL GetIThreadSafe_I() __NOTHROW__; + virtual spISimpleNode APICALL ConvertToSimpleNode(); + virtual spIStructureNode APICALL ConvertToStructureNode(); + virtual spIArrayNode APICALL ConvertToArrayNode(); + virtual spIMetadata APICALL ConvertToMetadata(); + + protected: + virtual pINode_base APICALL getParent( pcIError_base & error ) __NOTHROW__; + virtual void APICALL setName( const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__; + virtual pcIUTF8String_base APICALL getName( pcIError_base & error ) const __NOTHROW__; + virtual void APICALL setNameSpace( const char * nameSpace, sizet nameSpaceLength, pcIError_base & error ) __NOTHROW__; + virtual pcIUTF8String_base APICALL getNameSpace( pcIError_base & error ) const __NOTHROW__; + virtual pIPath_base APICALL getPath( pcIError_base & error ) const __NOTHROW__; + virtual pINodeIterator_base APICALL qualifiersIterator( pcIError_base & error ) __NOTHROW__; + virtual pINode_base APICALL getQualifier( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__; + virtual void APICALL insertQualifier( pINode_base base, pcIError_base & error ) __NOTHROW__; + virtual pINode_base APICALL replaceQualifier( pINode_base node, pcIError_base & error ) __NOTHROW__; + virtual pINode_base APICALL removeQualifier( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__; + virtual uint32 APICALL getNodeType( pcIError_base & error ) const __NOTHROW__; + virtual uint32 APICALL isArrayItem( pcIError_base & error ) const __NOTHROW__; + virtual uint32 APICALL isQualifierNode( pcIError_base & error ) const __NOTHROW__; + virtual sizet APICALL getIndex( pcIError_base & error ) const __NOTHROW__; + virtual uint32 APICALL hasQualifiers( pcIError_base & error ) const __NOTHROW__; + virtual uint32 APICALL hasContent( pcIError_base & error ) const __NOTHROW__; + virtual uint32 APICALL isEmpty( pcIError_base & error ) const __NOTHROW__; + virtual uint32 APICALL hasChanged( pcIError_base & error ) const __NOTHROW__; + virtual void APICALL clear( uint32 contents, uint32 qualifiers, pcIError_base & error ) __NOTHROW__; + virtual pINode_base APICALL clone( uint32 igoreEmptyNodes, uint32 ignoreNodesWithOnlyQualifiers, pcIError_base & error ) const __NOTHROW__; + virtual uint32 APICALL isThreadSafe() const __NOTHROW__; + virtual pISimpleNode_base APICALL convertToSimpleNode( pcIError_base & error ) __NOTHROW__; + virtual pIStructureNode_base APICALL convertToStructureNode( pcIError_base & error ) __NOTHROW__; + virtual pIArrayNode_base APICALL convertToArrayNode( pcIError_base & error ) __NOTHROW__; + virtual pIMetadata_base APICALL convertToMetadata( pcIError_base & error ) __NOTHROW__; + virtual uint32 APICALL getParentNodeType( pcIError_base & error ) const __NOTHROW__; + virtual uint32 APICALL getQualifierNodeType( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) const __NOTHROW__; + pvoid APICALL getInterfacePointer( uint64 interfaceID, uint32 interfaceVersion, pcIError_base & error ) __NOTHROW__; + }; + +} +#endif // !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB +//! \endcond + +#endif // __INode_h__ diff --git a/public/include/XMPCore/Interfaces/INodeIterator.h b/public/include/XMPCore/Interfaces/INodeIterator.h new file mode 100644 index 0000000..93bb194 --- /dev/null +++ b/public/include/XMPCore/Interfaces/INodeIterator.h @@ -0,0 +1,193 @@ +#ifndef __INodeIterator_h__ +#define __INodeIterator_h__ 1 + + +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2014 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCore/XMPCoreFwdDeclarations.h" +#include "XMPCommon/Interfaces/BaseInterfaces/ISharedObject.h" +#include "XMPCore/Interfaces/INode.h" +#include "XMPCommon/Interfaces/BaseInterfaces/IVersionable.h" + +namespace AdobeXMPCore { + + //! + //! @brief Interface that represents an iterator over the mutable children of a XMP DOM Node. + //! \note Iterators are valid as long as their are no changes performed on the node. In case there are some + //! changes performed on the node then the behavior is undefined. + //! + class XMP_PUBLIC INodeIterator_v1 + : public virtual ISharedObject + , public virtual IVersionable + { + public: + + //! + //! @brief Gets the type of the node currently pointed by the iterator. + //! \return A value of type \#INode_v1::eNodeType indicating the type of the node currently pointed by the iterator. + //! + virtual INode_v1::eNodeType APICALL GetNodeType() const = 0; + + //! + //! @{ + //! @brief Gets the node currently pointed by the iterator. + //! \return A shared pointer to a const or non const object of type \#INode. + //! \note In case iterator has gone beyond its limit, an invalid shared pointer is returned + //! + virtual spINode APICALL GetNode() = 0; + XMP_PRIVATE spcINode APICALL GetNode() const { + return const_cast< INodeIterator * >( this )->GetNode(); + }; + //! @} + + //! + //! @{ + //! @brief Gets the iterator's currently pointed node as simple node, if possible. + //! \return A shared pointer to a const or non const object of type \#ISimpleNode. + //! \attention Error is thrown in case + //! - iterator's currently pointed node is valid but is not a simple node. + //! \note In case iterator has gone beyond its limit, an invalid shared pointer is returned. + //! + XMP_PRIVATE spISimpleNode GetSimpleNode() { + auto node = GetNode(); + if ( node ) return node->ConvertToSimpleNode(); + return spISimpleNode(); + } + + XMP_PRIVATE spcISimpleNode GetSimpleNode() const { + return const_cast< INodeIterator * >( this )->GetSimpleNode(); + } + //! @} + + //! + //! @brief Gets the iterator's currently pointed node as structure node, if possible. + //! \return A shared pointer to a const or non const object of type \#IStructureNode. + //! \attention Error is thrown in case + //! - iterator's currently pointed node is valid but is not a structure node. + //! \note In case iterator has gone beyond its limit, an invalid shared pointer is returned. + //! + XMP_PRIVATE spIStructureNode GetStructureNode() { + auto node = GetNode(); + if ( node ) return node->ConvertToStructureNode(); + return spIStructureNode(); + } + + XMP_PRIVATE spcIStructureNode GetStructureNode() const { + return const_cast< INodeIterator * >( this )->GetStructureNode(); + } + //! @} + + //! + //! @brief Gets the iterator's currently pointed node as an array node, if possible. + //! \return A shared pointer to a const or non const object of type \#IArrayNode. + //! \attention Error is thrown in case + //! - iterator's currently pointed node is valid but is not an array node. + //! \note In case iterator has gone beyond its limit, an invalid shared pointer is returned. + //! + XMP_PRIVATE spIArrayNode GetArrayNode() { + auto node = GetNode(); + if ( node ) return node->ConvertToArrayNode(); + return spIArrayNode(); + } + + XMP_PRIVATE spcIArrayNode GetArrayNode() const { + return const_cast< INodeIterator * >( this )->GetArrayNode(); + } + //! @} + + //! + //! @{ + //! @brief Advances iterator by one position. + //! \return A shared pointer to a const or non object of type \#INodeIterator. + //! \note Returned shared pointer is invalid in case the current node is the last one. + //! + virtual spINodeIterator APICALL Next() = 0; + XMP_PRIVATE spcINodeIterator APICALL Next() const { + return const_cast< INodeIterator * >( this )->Next(); + } + //! @} + + + //! + //! \cond XMP_INTERNAL_DOCUMENTATION + + //! + //! @{ + //! @brief Returns the actual raw pointer from the shared pointer, which can be a shared pointer of a proxy class. + //! \return Either a const or non const pointer to INodeIterator interface. + //! + virtual pINodeIterator APICALL GetActualINodeIterator() __NOTHROW__ = 0; + XMP_PRIVATE pcINodeIterator GetActualINodeIterator() const __NOTHROW__ { + return const_cast< INodeIterator * >( this )->GetActualINodeIterator(); + } + //! + //! @} + + //! + //! @{ + //! @brief Returns the pointer to internal interfaces. + //! \return Either a const or non const pointer to INodeIterator_I interface. + //! + virtual AdobeXMPCore_Int::pINodeIterator_I APICALL GetINodeIterator_I() __NOTHROW__ = 0; + XMP_PRIVATE AdobeXMPCore_Int::pcINodeIterator_I GetINodeIterator_I() const __NOTHROW__ { + return const_cast< INodeIterator * >( this )->GetINodeIterator_I(); + } + //! + //! @} + + //! + //! @{ + //! @brief Converts raw pointer to shared pointer. + //! \return Shared pointer to const or non constant interface. + //! + XMP_PRIVATE static spINodeIterator MakeShared( pINodeIterator ptr ); + XMP_PRIVATE static spcINodeIterator MakeShared( pcINodeIterator ptr ) { + return MakeShared( const_cast< pINodeIterator >( ptr ) ); + } + //! + //! @} + + //! + //! @} + + //! + //! return the unique ID assigned to the interface. + //! \return 64 bit unsigned integer representing the unique ID assigned to the interface. + //! + XMP_PRIVATE static uint64 GetInterfaceID() { return kINodeIteratorID; } + + //! + //! return the version of the interface. + //! \return 32 bit unsigned integer representing the version of the interface. + //! + XMP_PRIVATE static uint32 GetInterfaceVersion() { return 1; } + //! \endcond + + protected: + //! + //! Destructor + //! + virtual ~INodeIterator_v1() __NOTHROW__ {} + + //! \cond XMP_INTERNAL_DOCUMENTATION + virtual uint32 APICALL getNodeType( pcIError_base & error ) const __NOTHROW__ = 0; + virtual pINode_base APICALL getNode( pcIError_base & error ) __NOTHROW__ = 0; + virtual pINodeIterator_base APICALL next( pcIError_base & error ) __NOTHROW__ = 0; + + #ifdef FRIEND_CLASS_DECLARATION + FRIEND_CLASS_DECLARATION(); + #endif + REQ_FRIEND_CLASS_DECLARATION(); + //! \endcond + + }; +} + +#endif // __INodeIterator_h__ diff --git a/public/include/XMPCore/Interfaces/IPath.h b/public/include/XMPCore/Interfaces/IPath.h new file mode 100644 index 0000000..7f55853 --- /dev/null +++ b/public/include/XMPCore/Interfaces/IPath.h @@ -0,0 +1,212 @@ +#ifndef __IPath_h__ +#define __IPath_h__ 1 + +// ================================================================================================= +// Copyright 2014 Adobe Systems Incorporated +// All Rights Reserved. +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCore/XMPCoreFwdDeclarations.h" +#include "XMPCommon/Interfaces/BaseInterfaces/ISharedObject.h" +#include "XMPCommon/Interfaces/BaseInterfaces/IVersionable.h" + +namespace AdobeXMPCore { + + //! + //! @brief Version1 of the interface that provides an easy iterative description of a specific path into the XMP tree. + //! @details Path consists of multiple path segments in an order and each \#IPathSegment represents one segment + //! of the path into the XMP tree. + //! Provides all the functions to create path and get the various properties of a path. + //! \attention Do not support multi-threading. + //! \note Index in the path are 1-based. + //! + class XMP_PUBLIC IPath_v1 + : public virtual ISharedObject + , public virtual IVersionable + { + public: + + //! + //! @brief Registers a map of namespace and prefix with the object. + //! This map will be used during serialization and parsing. + //! \param[in] map A shared pointer of an object \#AdobeXMPCore::INameSpacePrefixMap. + //! \return A shared pointer to the const map registered previously with the object. + //! + virtual spcINameSpacePrefixMap APICALL RegisterNameSpacePrefixMap( const spcINameSpacePrefixMap & map ) = 0; + + //! + //! @brief Serializes the IPath object to a utf8 string representation. This will produce either a long form of the path using + //! the full namespace strings or short form of the path using the prefix for the namespace. + //! \param[in] map A shared pointer to a const \#AdobeXMPCore::INameSpacePrefixMap object which can contain the + //! mapping for nameSpaces to prefixes. They will take precedence over the map registered with the object. + //! \return A shard pointer to \#AdobeXMPCommon::IUTF8String object containing serialized form of path. + //! \note In case map is not a valid shared pointer all the mappings will be picked from the map registered with the object. + //! If neither a map is registered nor it is provided in the arguments then it will serialize to long form of the path. + //! \attention Error will be thrown in case + //! - no prefix exists for a namespace used in the path. + //! + virtual spIUTF8String APICALL Serialize( const spcINameSpacePrefixMap & map = spcINameSpacePrefixMap() ) const = 0; + + //! + //! @brief Appends a path segment to the path. + //! \param[in] segment A shared pointer to a const \#AdobeXMPCore::IPathSegment object. + //! \attention Error is thrown in case + //! - segment is not a valid shared pointer. + //! + virtual void APICALL AppendPathSegment( const spcIPathSegment & segment ) = 0; + + //! + //! @brief Removes a path segment from the path. + //! \param[in] index Indicates the index of the path segment to be removed. + //! \returns A shared pointer to the const path segment removed. + //! \attention Error is thrown in case + //! - index is out of bounds. + //! + virtual spcIPathSegment APICALL RemovePathSegment( sizet index ) = 0; + + //! + //! @brief Gets the path segment at a particular index in the path + //! \param[in] index Indicates the index for the path segment in the path. + //! \return A shared pointer to a const path segment. + //! \attention Error is thrown in case + //! -index is out of bounds. + //! + virtual spcIPathSegment APICALL GetPathSegment( sizet index ) const = 0; + + //! + //! @brief Gets the number of the path segments in the path. + //! \return The count of the path segments in the path. + //! + virtual sizet APICALL Size() const __NOTHROW__ = 0; + + //! + //! @brief To check whether path is empty or not. + //! \returns A bool object indicating true in case the path is empty (no path segment) + //! + XMP_PRIVATE bool IsEmpty() const { + return Size() == 0; + } + + //! + //! @brief Clears the path by removing all the path segments from it + //! + virtual void APICALL Clear() __NOTHROW__ = 0; + + //! + //! @brief Gets a new path having a selected range of path segments + //! \param[in] startingIndex Indicates the starting index of the path segment to be part of the returned path object. Default value is 1. + //! \param[in] countOfSegments Indicates the count of the path segments to be part of the returned path object starting from startingIndex. + //! Default value is \#AdobeXMPCommon::kMaxSize. + //! \note In case countOfSegments is more than the number of segments available in the path object starting from the starting index + //! then internally it is truncated to the number of path segments available. + //! \attention Error is thrown in case + //! - startingIndex is more than the count of segments in the object. + //! + virtual spIPath APICALL Clone( sizet startingIndex = 1, sizet countOfSegments = kMaxSize ) const = 0; + + //! + //! \cond XMP_INTERNAL_DOCUMENTATION + + //! + //! @{ + //! @brief Returns the actual raw pointer from the shared pointer, which can be a shared pointer of a proxy class. + //! \return Either a const or non const pointer to IPath interface. + //! + virtual pIPath APICALL GetActualIPath() __NOTHROW__ = 0; + XMP_PRIVATE pcIPath GetActualIPath() const __NOTHROW__ { + return const_cast< IPath_v1 * >( this )->GetActualIPath(); + } + //! + //! @} + + //! + //! @{ + //! @brief Returns the pointer to internal interfaces. + //! \return Either a const or non const pointer to IPath_I interface. + //! + virtual AdobeXMPCore_Int::pIPath_I APICALL GetIPath_I() __NOTHROW__ = 0; + + XMP_PRIVATE AdobeXMPCore_Int::pcIPath_I GetIPath_I() const __NOTHROW__ { + return const_cast< IPath_v1 * >( this )->GetIPath_I(); + } + //! + //! @} + + //! + //! @{ + //! @brief Converts raw pointer to shared pointer. The raw pointer is of version 1 interface + //! where as the returned shared pointer depends on the version client is interested in. + //! \return Shared pointer to const or non constant interface. + //! + XMP_PRIVATE static spIPath MakeShared( pIPath_base ptr ); + XMP_PRIVATE static spcIPath MakeShared( pcIPath_base ptr ) { + return MakeShared( const_cast< pIPath_base >( ptr ) ); + } + //! + //! @} + + //! + //! @brief Returns the unique ID assigned to the interface. + //! \return 64 bit unsigned integer representing the unique ID assigned to the interface. + //! + XMP_PRIVATE static uint64 GetInterfaceID() { return kIPathID; } + + //! + //! @brief Returns the version of the interface. + //! \return 32 bit unsigned integer representing the version of the interface. + //! + XMP_PRIVATE static uint32 GetInterfaceVersion() { return 1; } + //! \endcond + + // static factory functions + + //! + //! @brief Creates an empty IPath object. + //! \return a shared pointer to an empty IPath object + //! + XMP_PRIVATE static spIPath CreatePath(); + + //! + //! @brief Creates a path from a char buffer which contains the serialized path. + //! \param[in] path Pointer to a const char buffer containing serialized form of the path. + //! \param[in] pathLength Number of characters in the path. In case path in null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] map A shared pointer to a const \#AdobeXMPCore::IXMPNameSpacePrefixMap object which will contain the + //! mapping from nameSpaces to prefixes. + //! \return A shared pointer to a \#AdobeXMPCore::IPath object. + //! \note In case the serializedPath is NULL or the contents are empty then it will result in an empty path. + //! \note This operation is currently not implemented for the IPath interface. + //! \attention Error is thrown in case + //! - no mapping exists for a prefix to name space. + //! - path contains invalid data. + //! + XMP_PRIVATE static spIPath ParsePath( const char * path, sizet pathLength, const spcINameSpacePrefixMap & map ); + + + protected: + //! + //! Destructor + //! + virtual ~IPath_v1() __NOTHROW__ {} + + //! \cond XMP_INTERNAL_DOCUMENTATION + virtual pcINameSpacePrefixMap_base APICALL registerNameSpacePrefixMap( pcINameSpacePrefixMap_base map, pcIError_base & error ) __NOTHROW__ = 0; + virtual pIUTF8String_base APICALL serialize( pcINameSpacePrefixMap_base map, pcIError_base & error ) const __NOTHROW__ = 0; + virtual void APICALL appendPathSegment( pcIPathSegment_base segment, pcIError_base & error ) __NOTHROW__ = 0; + virtual pcIPathSegment_base APICALL removePathSegment( sizet index, pcIError_base & error ) __NOTHROW__ = 0; + virtual pcIPathSegment_base APICALL getPathSegment( sizet index, pcIError_base & error ) const __NOTHROW__ = 0; + virtual pIPath_base APICALL clone( sizet startingIndex, sizet countOfSegemetns, pcIError_base & error ) const __NOTHROW__ = 0; + + + #ifdef FRIEND_CLASS_DECLARATION + FRIEND_CLASS_DECLARATION(); + #endif + REQ_FRIEND_CLASS_DECLARATION(); + //! \endcond + + }; +} + +#endif // __IPath_h__ diff --git a/public/include/XMPCore/Interfaces/IPathSegment.h b/public/include/XMPCore/Interfaces/IPathSegment.h new file mode 100644 index 0000000..9dd9ac9 --- /dev/null +++ b/public/include/XMPCore/Interfaces/IPathSegment.h @@ -0,0 +1,225 @@ +#ifndef __IPathSegment_h__ +#define __IPathSegment_h__ 1 + +// ================================================================================================= +// Copyright 2014 Adobe Systems Incorporated +// All Rights Reserved. +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCore/XMPCoreFwdDeclarations.h" +#include "XMPCommon/Interfaces/BaseInterfaces/ISharedObject.h" +#include "XMPCommon/Interfaces/BaseInterfaces/IVersionable.h" + +namespace AdobeXMPCore { + + //! + //! @brief Version1 of the interface that represents one segment in a path to a node into the XMP tree. + //! @details Provides all the functions to access properties of the path segment and factory functions + //! to create various kinds of path segments. + //! \attention Not thread safe and not required as only read only access is provided to client. + //! + class XMP_PUBLIC IPathSegment_v1 + : public virtual ISharedObject + , public virtual IVersionable + { + public: + + //! + //! @brief This enumeration represents the types of a path segment. + //! + typedef enum { + //! None type + kPSTNone = 0, + + //! Any property that consists of namespace and a localName + kPSTProperty = 1, + + //! An array index which does not have a namespace or localName itself + kPSTArrayIndex = 1 << 1, + + //! A qualifier of a property, also consists of namespace and localName + kPSTQualifier = 1 << 2, + + //! Selects a specific qualifier by its value (e.g. specific language) + kPSTQualifierSelector = 1 << 3, + + //! Represents all property types + kPSTAll = kAllBits + } ePathSegmentType; + + //! + //! @brief Gets the name space of the path segment. + //! \return A shared pointer to const \#AdobeXMPCommon::IUTF8String object representing namespace of the path segment. + //! + virtual spcIUTF8String APICALL GetNameSpace() const = 0; + + //! + //! @brief Gets the name of the path segment. + //! \return A shared pointer to const \#AdobeXMPCommon::IUTF8String object containing name of the path segment. In case + //! path segment has no name space, an invalid shared pointer is returned. + //! + virtual spcIUTF8String APICALL GetName() const = 0; + + //! + //! @brief Gets the type of the path segment. + //! \return An object of type \#ePathSegmentType representing type of the path segment. + //! + virtual ePathSegmentType APICALL GetType() const = 0; + + //! + //! @brief Gets the index of the array type path segment. + //! \return An objet of type \#AdobeXMPCommon::sizet object representing index of the array type path segment. In case + //! path segment is not of type kPSTArrayIndex, it returns \#AdobeXMPCommon::kMaxSize. + //! + virtual sizet APICALL GetIndex() const __NOTHROW__ = 0; + + //! + //! @brief Gets the value of the qualifier type path segment. + //! \return A shared pointer to const \#AdobeXMP::IUTF8String object representing value of the qualifier type path segment. + //! In case path segment is not of type kPSTQualifier an invalid shared pointer is returned. + //! + virtual spcIUTF8String APICALL GetValue() const = 0; + + //! + //! \cond XMP_INTERNAL_DOCUMENTATION + + //! + //! @{ + //! @brief Returns the actual raw pointer from the shared pointer, which can be a shared pointer of a proxy class. + //! \return Either a const or non const pointer to IPathSegment interface. + //! + virtual pIPathSegment APICALL GetActualIPathSegment() __NOTHROW__ = 0; + XMP_PRIVATE pcIPathSegment GetActualIPathSegment() const __NOTHROW__ { + return const_cast< IPathSegment_v1 * >( this )->GetActualIPathSegment(); + } + //! + //! @} + + //! + //! @{ + //! @brief Returns the pointer to internal interfaces. + //! \return Either a const or non const pointer to IPathSegment_I interface. + //! + virtual AdobeXMPCore_Int::pIPathSegment_I APICALL GetIPathSegment_I() __NOTHROW__ = 0; + + XMP_PRIVATE AdobeXMPCore_Int::pcIPathSegment_I GetIPathSegment_I() const __NOTHROW__ { + return const_cast< IPathSegment_v1 * >( this )->GetIPathSegment_I(); + } + //! + //! @} + + //! + //! @{ + //! @brief Converts raw pointer to shared pointer. + //! @details The raw pointer is of version 1 interface + //! where as the returned shared pointer depends on the version client is interested in. + //! \return Shared pointer to const or non constant interface. + //! + XMP_PRIVATE static spIPathSegment MakeShared( pIPathSegment_base ptr ); + XMP_PRIVATE static spcIPathSegment MakeShared( pcIPathSegment_base ptr ) { + return MakeShared( const_cast< pIPathSegment_base >( ptr ) ); + } + //! + //! @} + + //! + //! @brief Returns the unique ID assigned to the interface. + //! \return 64 bit unsigned integer representing the unique ID assigned to the interface. + //! + XMP_PRIVATE static uint64 GetInterfaceID() { return kIPathSegmentID; } + + //! + //! @brief Returns the version of the interface. + //! \return 32 bit unsigned integer representing the version of the interface. + //! + XMP_PRIVATE static uint32 GetInterfaceVersion() { return 1; } + //! \endcond + + // static factory functions + + // Factories to create the specific segments + + //! + //! @brief Creates a normal property path segment.These are essentially all properties (simple, struct and arrays). + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the property. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the property. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \return A shared pointer to const \#IPathSegment. + //! \attention Throws \#AdobeXMPCommon::pcIError in case + //! - pointers to const char buffers are NULL, + //! - their content is empty. + //! + XMP_PRIVATE static spcIPathSegment CreatePropertyPathSegment( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ); + + //! + //! @brief Creates an array index path segment that denotes a specific element of an array. + //! @details Such segments do not have an own name and inherits the namespace from the Array property itself. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the property. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] index An object of type \#AdobeXMP::sizet containting the index of the array element. + //! \return A shared pointer to const \#IPathSegment. + //! \attention Throws \#AdobeXMP::pcIError in case + //! - pointers to const char buffers are NULL, + //! - their content is empty. + //! + //! + XMP_PRIVATE static spcIPathSegment CreateArrayIndexPathSegment( const char * nameSpace, sizet nameSpaceLength, sizet index ); + + //! + //! @brief Creates a Qualifier path segment, which behaves like a normal property + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the property. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the property. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \return A shared pointer to const \#IPathSegment. + //! \attention Throws \#AdobeXMPCommon::pcIError in case + //! - pointers to const char buffers are NULL, + //! - their content is empty. + //! + XMP_PRIVATE static spcIPathSegment CreateQualifierPathSegment( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ); + + //! + //! @brief Creates a path segment that selects a specific qualifier by its value. + //! For example a specific language in a alternative array of languages. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the property. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the property. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to \#AdobeXMPCommon::npos. + //! \param[in] value Pointer to a constant char buffer containing value of the language (xml:lang) + //! \param[in] valueLength Number of characters in value. In case value is null terminated set it to \#AdobeXMPCommon::npos. + //! \return A shared pointer to const \#IPathSegment. + //! \attention Throws #AdobeXMPCommon::pcIError in case + //! - pointers to const char buffers are NULL, + //! - their content is empty. + //! + XMP_PRIVATE static spcIPathSegment CreateQualifierSelectorPathSegment( const char * nameSpace, sizet nameSpaceLength, const char * name, + sizet nameLength, const char * value, sizet valueLength ); + + + + protected: + //! + //! Destructor + //! + virtual ~IPathSegment_v1() __NOTHROW__ {} + + //! \cond XMP_INTERNAL_DOCUMENTATION + virtual pcIUTF8String_base APICALL getNameSpace( pcIError_base & error ) const __NOTHROW__ = 0; + virtual pcIUTF8String_base APICALL getName( pcIError_base & error ) const __NOTHROW__ = 0; + virtual uint32 APICALL getType( pcIError_base & error ) const __NOTHROW__ = 0; + virtual pcIUTF8String_base APICALL getValue( pcIError_base & error ) const __NOTHROW__ = 0; + + #ifdef FRIEND_CLASS_DECLARATION + FRIEND_CLASS_DECLARATION(); + #endif + REQ_FRIEND_CLASS_DECLARATION(); + //! \endcond + + }; +} + +#endif // __IPathSegment_h__ diff --git a/public/include/XMPCore/Interfaces/ISimpleNode.h b/public/include/XMPCore/Interfaces/ISimpleNode.h new file mode 100644 index 0000000..8d154d3 --- /dev/null +++ b/public/include/XMPCore/Interfaces/ISimpleNode.h @@ -0,0 +1,150 @@ +#ifndef __ISimpleNode_h__ +#define __ISimpleNode_h__ 1 + +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2014 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCore/Interfaces/INode.h" + +namespace AdobeXMPCore { + + //! + //! \brief Version1 of the interface that represents a Simple Property Node of XMP DOM. + //! \details Provides all the functions to get and set various properties of the simple node. + //! \attention Support multi threading through locks but can be enabled/disabled by the client. By default + //! every object created does not support multi-threading. + //! + class XMP_PUBLIC ISimpleNode_v1 + : public virtual INode_v1 + { + public: + + //! + //! @brief Gets the value of the simple property node. + //! \return A shared pointer to const AdobeXMPCommon::IUTF8String object containing value string + //! of the simple property node. + //! + virtual spcIUTF8String APICALL GetValue() const = 0; + + //! + //! @brief Changes the value string of the simple property node. + //! \param[in] value Pointer to a constant char buffer containing value of the simple node. + //! \param[in] valueLength Number of characters in value. In case name is null terminated set it to AdobeXMPCommon::npos. + //! \note In case the value is null pointer or its contents are empty than the value is set to empty string. + //! + virtual void APICALL SetValue( const char * value, sizet valueLength ) = 0; + + //! + //! @brief Indicates whether the simple property node is of URI type. + //! \return A bool value; true in case the simple node is of URI type, false otherwise. + //! + virtual bool APICALL IsURIType() const = 0; + + //! + //! @brief Controls whether the type of simple property node should be of IsURI type or not. + //! \param[in] isURI A bool value controlling the IsURI type of the simple property node + //! + virtual void APICALL SetURIType( bool isURI ) = 0; + + // Factories to create the simple node + + //! + //! @brief Creates a simple property node which is not part of any metadata document. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the simple node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the simple node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to AdobeXMPCommon::npos. + //! \param[in] value Pointer to a constant char buffer containing value of the simple node. + //! \param[in] valueLength Number of characters in value. In case name is null terminated set it to AdobeXMPCommon::npos. + //! \return A shared pointer to a AdobeXMPCore::ISimpleNode object. + //! \attention Error is thrown in case + //! - nameSpace or name are NULL pointers, or + //! - their contents are empty. + //! \note In case the value is a null pointer or its contents are empty than the value is set to empty string. + //! + XMP_PRIVATE static spISimpleNode CreateSimpleNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, + const char * value = NULL, sizet valueLength = AdobeXMPCommon::npos ); + + + //! + //! \cond XMP_INTERNAL_DOCUMENTATION + + //! + //! @{ + //! @brief Returns the actual raw pointer from the shared pointer, which can be a shared pointer of a proxy class. + //! \return Either a const or non const pointer to ISimpleNode interface. + //! + virtual pISimpleNode APICALL GetActualISimpleNode() __NOTHROW__ = 0; + XMP_PRIVATE pcISimpleNode GetActualISimpleNode() const __NOTHROW__ { + return const_cast< ISimpleNode_v1 * >( this )->GetActualISimpleNode(); + } + //! + //! @} + + //! + //! @{ + //! @brief Returns the pointer to internal interfaces. + //! \return Either a const or non const pointer to ISimpleNode_I interface. + //! + virtual AdobeXMPCore_Int::pISimpleNode_I APICALL GetISimpleNode_I() __NOTHROW__ = 0; + + XMP_PRIVATE AdobeXMPCore_Int::pcISimpleNode_I GetISimpleNode_I() const __NOTHROW__ { + return const_cast< ISimpleNode_v1 * >( this )->GetISimpleNode_I(); + } + //! + //! @} + + //! + //! @{ + //! @brief Converts raw pointer to shared pointer. The raw pointer is of version 1 interface + //! where as the returned shared pointer depends on the version client is interested in. + //! \return Shared pointer to const or non constant interface. + //! + XMP_PRIVATE static spISimpleNode MakeShared( pISimpleNode_base ptr ); + XMP_PRIVATE static spcISimpleNode MakeShared( pcISimpleNode_base ptr ) { + return MakeShared( const_cast< pISimpleNode_base >( ptr ) ); + } + //! + //! @} + + //! + //! @brief Returns the unique ID assigned to the interface. + //! \return 64 bit unsigned integer representing the unique ID assigned to the interface. + //! + XMP_PRIVATE static uint64 GetInterfaceID() { return kISimpleNodeID; } + + //! + //! @brief Returns the version of the interface. + //! \return 32 bit unsigned integer representing the version of the interface. + //! + XMP_PRIVATE static uint32 GetInterfaceVersion() { return 1; } + //! \endcond + + protected: + //! + //! Destructor + //! + virtual ~ISimpleNode_v1() __NOTHROW__ {} + + //! \cond XMP_INTERNAL_DOCUMENTATION + virtual pcIUTF8String_base APICALL getValue( pcIError_base & error ) const __NOTHROW__ = 0; + virtual void APICALL setValue( const char * value, sizet valueLength, pcIError_base & error ) __NOTHROW__ = 0; + virtual uint32 APICALL isURIType( pcIError_base & error ) const __NOTHROW__ = 0; + virtual void APICALL setURIType( uint32 isURI, pcIError_base & error ) __NOTHROW__ = 0; + + #ifdef FRIEND_CLASS_DECLARATION + FRIEND_CLASS_DECLARATION(); + #endif + REQ_FRIEND_CLASS_DECLARATION(); + //! \endcond + + }; +} + +#endif // __ISimpleNode_h__ diff --git a/public/include/XMPCore/Interfaces/IStructureNode.h b/public/include/XMPCore/Interfaces/IStructureNode.h new file mode 100644 index 0000000..5df1f08 --- /dev/null +++ b/public/include/XMPCore/Interfaces/IStructureNode.h @@ -0,0 +1,306 @@ +#ifndef IStructureNode_h__ +#define IStructureNode_h__ 1 + +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2014 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCore/Interfaces/ICompositeNode.h" + +namespace AdobeXMPCore { + + //! + //! @brief Version1 of the interface that represents a structure Node of XMP DOM. + //! \details Provides all the functions to get and set various properties of the structure node. + //! \attention Support multi threading through locks but can be enabled/disabled by the client. By default + //! every object created does not support multi-threading. + //! + class XMP_PUBLIC IStructureNode_v1 + : public virtual ICompositeNode_v1 + { + public: + + //! + //! @brief Gets the type of the node's child having specified namespace and name. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the child node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the child node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to AdobeXMPCommon::npos. + //! \return An object of type #eNodeType indicating the type of the node's child. + //! \note In case no child exists with the specified nameSpace and name combination then an eNodeType::kNTNone is returned. + //! + virtual eNodeType APICALL GetChildNodeType( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) const = 0; + + + //! + //! @{ + //! @brief Gets the child of the node having specified namespace and name. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the child node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the child node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to AdobeXMPCommon::npos. + //! \return A shared pointer to either a const or const child node. + //! \note In case no child exists with the specified nameSpace and name combination then an invalid shared pointer + //! is returned. + //! + XMP_PRIVATE spcINode GetNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) const { + return const_cast< IStructureNode_v1 * >( this )->GetNode( nameSpace, nameSpaceLength, name, nameLength ); + } + virtual spINode APICALL GetNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) = 0; + //! @} + + //! + //! @{ + //! @brief Gets the node's child having specified name space and name as simple node. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the child node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the child node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to AdobeXMPCommon::npos. + //! \return A shared pointer to const or non const ISimpleNode object containing child. + //! \note In case no child exists with the specified nameSpace and name combination then an invalid shared pointer + //! is returned. + //! \attention Error is thrown in case + //! - a child exists with the specified nameSpace and name combination but is not a simple node. + //! + XMP_PRIVATE spcISimpleNode GetSimpleNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) const { + auto node = GetNode( nameSpace, nameSpaceLength, name, nameLength ); + if ( node ) return node->ConvertToSimpleNode(); + return spcISimpleNode(); + } + + XMP_PRIVATE spISimpleNode GetSimpleNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) { + auto node = GetNode( nameSpace, nameSpaceLength, name, nameLength ); + if ( node ) return node->ConvertToSimpleNode(); + return spISimpleNode(); + } + //! @} + + //! + //! @{ + //! @brief Gets the node's child having specified name space and name as structure node. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the child node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the child node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to AdobeXMPCommon::npos. + //! \return A shared pointer to const or non const IStructureNode object containing child. + //! \note In case no child exists with the specified nameSpace and name combination then an invalid shared pointer + //! is returned. + //! \attention Error is thrown in case + //! - a child exists with the specified nameSpace and name combination but is not a structure node. + //! + XMP_PRIVATE spcIStructureNode GetStructureNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) const { + auto node = GetNode( nameSpace, nameSpaceLength, name, nameLength ); + if ( node ) return node->ConvertToStructureNode(); + return spcIStructureNode(); + } + + XMP_PRIVATE spIStructureNode GetStructureNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) { + auto node = GetNode( nameSpace, nameSpaceLength, name, nameLength ); + if ( node ) return node->ConvertToStructureNode(); + return spIStructureNode(); + } + //! @} + + //! + //! @{ + //! @brief Gets the node's child having specified name space and name as an array node. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the child node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the child node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to AdobeXMPCommon::npos. + //! \return A shared pointer to const or non const ISimpleNode object containing child. + //! \note In case no child exists with the specified nameSpace and name combination then an invalid shared pointer + //! is returned. + //! \attention Error is thrown in case + //! - a child exists with the specified nameSpace and name combination but is not an array node. + //! + XMP_PRIVATE spcIArrayNode GetArrayNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) const { + auto node = GetNode( nameSpace, nameSpaceLength, name, nameLength ); + if ( node ) return node->ConvertToArrayNode(); + return spcIArrayNode(); + } + + XMP_PRIVATE spIArrayNode GetArrayNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) { + auto node = GetNode( nameSpace, nameSpaceLength, name, nameLength ); + if ( node ) return node->ConvertToArrayNode(); + return spIArrayNode(); + } + //! @} + + //! + //! @brief Inserts a given node. + //! \param[in] node Shared pointer to an object of AdobeXMPCore::INode containing the node to be inserted. + //! \attention Error is thrown in following cases: + //! -# given node is invalid. + //! -# given node is already a child of some other node. + //! -# there exists a node with the same nameSpace and name combination. + //! + virtual void APICALL InsertNode( const spINode & node ) = 0; + + //! + //! @brief Replaces a given node. + //! \param[in] node Shared pointer to an object of AdobeXMPCore::INode. + //! \return A shared pointer to the node being replaced. + //! \attention Error is thrown in following cases: + //! -# given node is invalid. + //! -# given node is already a child of some other node. + //! -# there exists no node with the same nameSpace and name combination. + //! \note Type of the old existing node may/may not be same as that of new node. + //! + virtual spINode APICALL ReplaceNode( const spINode & node ) = 0; + + //! + //! @brief Removes the node with the specified nameSpace and name. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the child node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the child node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to AdobeXMPCommon::npos. + //! \return A shared pointer to AdobeXMPCore::INode object containing node which is removed from the tree. + //! \note In case no node exists with the given nameSpace and name combination an invalid shared pointer is returned. + //! + virtual spINode APICALL RemoveNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) = 0; + + //! + //! \cond XMP_INTERNAL_DOCUMENTATION + + //! + //! @{ + //! @brief Returns the actual raw pointer from the shared pointer, which can be a shared pointer of a proxy class. + //! \return Either a const or non const pointer to IStructureNode interface. + //! + virtual pIStructureNode APICALL GetActualIStructureNode() __NOTHROW__ = 0; + XMP_PRIVATE pcIStructureNode GetActualIStructureNode() const __NOTHROW__ { + return const_cast< IStructureNode_v1 * >( this )->GetActualIStructureNode(); + } + //! + //! @} + + //! + //! @{ + //! @brief Returns the pointer to internal interfaces. + //! \return Either a const or non const pointer to IStructureNode_I interface. + //! + virtual AdobeXMPCore_Int::pIStructureNode_I APICALL GetIStructureNode_I() __NOTHROW__ = 0; + + XMP_PRIVATE AdobeXMPCore_Int::pcIStructureNode_I GetIStructureNode_I() const __NOTHROW__ { + return const_cast< IStructureNode_v1 * >( this )->GetIStructureNode_I(); + } + //! + //! @} + + //! + //! @{ + //! @brief Converts raw pointer to shared pointer. The raw pointer is of version 1 interface + //! where as the returned shared pointer depends on the version client is interested in. + //! \return Shared pointer to const or non constant interface. + //! + XMP_PRIVATE static spIStructureNode MakeShared( pIStructureNode_base ptr ); + XMP_PRIVATE static spcIStructureNode MakeShared( pcIStructureNode_base ptr ) { + return MakeShared( const_cast< pIStructureNode_base >( ptr ) ); + } + //! + //! @} + + //! + //! @brief Returns the unique ID assigned to the interface. + //! \return 64 bit unsigned integer representing the unique ID assigned to the interface. + //! + XMP_PRIVATE static uint64 GetInterfaceID() { return kIStructureNodeID; } + + //! + //! @brief Returns the version of the interface. + //! \return 32 bit unsigned integer representing the version of the interface. + //! + XMP_PRIVATE static uint32 GetInterfaceVersion() { return 1; } + //! \endcond + + // Factories to create the structure node + + //! + //! @brief Creates a structure node which is not part of any metadata document. + //! \param[in] nameSpace Pointer to a constant char buffer containing name space URI of the structure node. + //! \param[in] nameSpaceLength Number of characters in nameSpace. In case nameSpace is null terminated set it to AdobeXMPCommon::npos. + //! \param[in] name Pointer to a constant char buffer containing local name of the structure node. + //! \param[in] nameLength Number of characters in name. In case name is null terminated set it to AdobeXMPCommon::npos. + //! \return A shared pointer to a AdobeXMPCore::IStructureNode object. + //! \attention Error is thrown in the following cases: + //! -# nameSpace is NULL or its contents are empty. + //! -# name is NULL or its contents are empty. + //! + XMP_PRIVATE static spIStructureNode CreateStructureNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ); + + protected: + //! + //! Destructor + //! + virtual ~IStructureNode_v1() __NOTHROW__ {} + + //! \cond XMP_INTERNAL_DOCUMENTATION + virtual uint32 APICALL getChildNodeType( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) const __NOTHROW__ = 0; + virtual pINode_base APICALL getNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__ = 0; + virtual void APICALL insertNode( pINode_base node, pcIError_base & error ) __NOTHROW__ = 0; + virtual pINode_base APICALL replaceNode( pINode_base node, pcIError_base & error ) __NOTHROW__ = 0; + virtual pINode_base APICALL removeNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__ = 0; + + #ifdef FRIEND_CLASS_DECLARATION + FRIEND_CLASS_DECLARATION(); + #endif + REQ_FRIEND_CLASS_DECLARATION(); + //! \endcond + + }; +} + +//! \cond XMP_INTERNAL_DOCUMENTATION +#if !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB + +namespace AdobeXMPCore { + +#if XMP_WinBuild + #pragma warning( push ) + #pragma warning( disable : 4250 ) +#endif + + class IStructureNodeProxy + : public virtual IStructureNode + , public virtual ICompositeNodeProxy + { + private: + pIStructureNode mRawPtr; + + public: + IStructureNodeProxy( pIStructureNode ptr ); + ~IStructureNodeProxy() __NOTHROW__ ; + + AdobeXMPCore_Int::pIStructureNode_I APICALL GetIStructureNode_I() __NOTHROW__; + virtual pIStructureNode APICALL GetActualIStructureNode() __NOTHROW__; + + virtual eNodeType APICALL GetChildNodeType( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) const; + virtual spINode APICALL GetNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ); + virtual void APICALL InsertNode( const spINode & node ); + virtual spINode APICALL ReplaceNode( const spINode & node ); + virtual spINode APICALL RemoveNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ); + + protected: + virtual uint32 APICALL getChildNodeType( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) const __NOTHROW__; + virtual pINode_base APICALL getNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__; + virtual void APICALL insertNode( pINode_base node, pcIError_base & error ) __NOTHROW__; + virtual pINode_base APICALL replaceNode( pINode_base node, pcIError_base & error ) __NOTHROW__; + virtual pINode_base APICALL removeNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__; + }; + +#if XMP_WinBuild + #pragma warning( pop ) +#endif + +} + +#endif // BUILDING_XMPCORE_LIB +//! \endcond + +#endif // IStructureNode_h__ diff --git a/public/include/XMPCore/XMPCoreDefines.h b/public/include/XMPCore/XMPCoreDefines.h new file mode 100644 index 0000000..fbe9af4 --- /dev/null +++ b/public/include/XMPCore/XMPCoreDefines.h @@ -0,0 +1,86 @@ +#ifndef XMPCoreDefines_h__ +#define XMPCoreDefines_h__ 1 + +// ================================================================================================= +// Copyright 2014 Adobe Systems Incorporated +// All Rights Reserved. +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +// ================================================================================================= +// XMPCoreDefines.h - Common Defines for XMP Core component +// ================================================================ +// +// This header defines common definitions to be used in XMP Core component. +// +// ================================================================================================= + +// ================================================================================================= +// All Platform Settings +// =========================== +#include "XMPCommon/XMPCommonDefines.h" + +#ifndef ENABLE_CPP_DOM_MODEL +// ================================================================================================= +// Macintosh Specific Settings +// =========================== +#if XMP_MacBuild + #define ENABLE_CPP_DOM_MODEL 0 +#endif + +// ================================================================================================= +// IOS Specific Settings +// =========================== +#if XMP_iOSBuild + #define ENABLE_CPP_DOM_MODEL 0 +#endif + +// ================================================================================================= +// Windows Specific Settings +// ========================= +#if XMP_WinBuild + #define ENABLE_CPP_DOM_MODEL 0 +#endif + +// ================================================================================================= +// UNIX Specific Settings +// ====================== +#if XMP_UNIXBuild +#define ENABLE_CPP_DOM_MODEL 0 +#endif +#endif // ENABLE_CPP_DOM_MODEL + +#ifndef ENABLE_CPP_DOM_MODEL + #define ENABLE_CPP_DOM_MODEL 0 +#endif + +#if ENABLE_CPP_DOM_MODEL + + #if SOURCE_COMPILING_XMP_ALL + #define SOURCE_COMPILING_XMPCORE_LIB 1 + #endif + + #ifndef SOURCE_COMPILING_XMPCORE_LIB + #define SOURCE_COMPILING_XMPCORE_LIB 0 + #endif + + #ifndef BUILDING_XMPCORE_LIB + #define BUILDING_XMPCORE_LIB 0 + #endif + + #if BUILDING_XMPCORE_LIB + #if !BUILDING_XMPCORE_AS_STATIC && !BUILDING_XMPCORE_AS_DYNAMIC + #error "Define either BUILDING_XMPCORE_AS_STATIC as 1 or BUILDING_XMPCORE_AS_DYNAMIC as 1" + #endif + #endif + + #ifndef LINKING_XMPCORE_LIB + #define LINKING_XMPCORE_LIB 1 + #endif + + namespace AdobeXMPCore {}; +#endif // ENABLE_CPP_DOM_MODEL + +#endif // XMPCoreDefines_h__ diff --git a/public/include/XMPCore/XMPCoreErrorCodes.h b/public/include/XMPCore/XMPCoreErrorCodes.h new file mode 100644 index 0000000..63c2f55 --- /dev/null +++ b/public/include/XMPCore/XMPCoreErrorCodes.h @@ -0,0 +1,116 @@ +#ifndef XMPCoreErrorCodes_h__ +#define XMPCoreErrorCodes_h__ 1 + +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCore/XMPCoreDefines.h" +#include "XMPCommon/XMPCommonErrorCodes.h" + +namespace AdobeXMPCore { + + typedef enum { + //! Indicates no error. + kDMECNone = 0, + + //! Indicates that IXMPNameSpacePrefixMap has an entry missing. + kDMECNameSpacePrefixMapEntryMissing = 1, + + //! Indicates that a different type of node is present than one user is expecting + kDMECDifferentNodeTypePresent = 2, + + //! Indicates that node is already a child of another parent. + kDMECNodeAlreadyAChild = 3, + + //! Indicates a node with the same qualified name or index already exists. + kDMECNodeAlreadyExists = 4, + + //! Indicates no such node exists. + kDMECNoSuchNodeExists = 5, + + //! Indicates current array element type is not same as that of other child items + kDMECArrayItemTypeDifferent = 6, + + //! Indicates invalid path segment inside a path. + kDMECInvalidPathSegment = 7, + + //! Indicates Bad schema parameter + kDMECBadSchema = 101, + + //! Indicates Bad XPath parameter + kDMECBadXPath = 102, + + //! Indicates Bad options parameter + kDMECBadOptions = 103, + + //! Indicates Bad iteration position + kDMECBadIterPosition = 104, + + //! Indicates Unicode error + kDMECBadUnicode = 105, + + //! Indicates XMP format error + kDMECValidationError = 106, + + //! Indicates Empty iterator + kDMECEmptyIterator = 107, + + //! Maximum value this enum can hold, should be treated as invalid value. + kDMECMaxValue = kMaxEnumValue + } eDataModelErrorCode; + + //! + //! @brief Indicates various errors encountered during parsing. + //! + typedef enum { + //! Indicates no error. + kPECNone = 0, + + //! Indicates XML parsing error. + kPECBadXML = 1, + + //! RDF format error + kPECBadRDF = 2, + + //! XMP format error + kPECBadXMP = 3, + + //! Context Node is invalid + kPECInvalidContextNode = 4, + + //! Context Node is not a composite node + kPECContextNodeIsNonComposite = 5, + + //! Parent of Context Node is not an array node + kPECContextNodeParentIsNonArray = 6, + + //! Maximum value this enum can hold, should be treated as invalid value. + kPECMaxValue = kMaxEnumValue + } eParserErrorCode; + + //! + //! @brief Indicates various errors encountered during serialization. + //! + typedef enum { + //! Indicates no error. + kSECNone = 0, + + //! Indicates serialization failed to achieve size requirement. + kSECSizeExceed = 1, + + //! Indicates un registered namespace encountered during serialization. + kSECUnRegisteredNameSpace = 2, + + //! Maximum value this enum can hold, should be treated as invalid value. + kSECMaxValue = kMaxEnumValue + + } eSerializerErrorCode; +} + +#endif // XMPCoreErrorCodes_h__ diff --git a/public/include/XMPCore/XMPCoreFwdDeclarations.h b/public/include/XMPCore/XMPCoreFwdDeclarations.h new file mode 100644 index 0000000..65a38cc --- /dev/null +++ b/public/include/XMPCore/XMPCoreFwdDeclarations.h @@ -0,0 +1,308 @@ +#ifndef XMPCoreFwdDeclarations_h__ +#define XMPCoreFwdDeclarations_h__ 1 + +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2014 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + + +#include "XMPCore/XMPCoreDefines.h" +#include "XMPCommon/XMPCommonFwdDeclarations.h" +#include "XMPCore/XMPCoreLatestInterfaceVersions.h" + +namespace AdobeXMPCore { + using namespace AdobeXMPCommon; + + // INameSpacePrefixMap + class INameSpacePrefixMap_v1; + typedef INameSpacePrefixMap_v1 INameSpacePrefixMap_base; + typedef INameSpacePrefixMap_v1 * pINameSpacePrefixMap_base; + typedef const INameSpacePrefixMap_v1 * pcINameSpacePrefixMap_base; + typedef BASE_CLASS( INameSpacePrefixMap, INAMESPACEPREFIXMAP_VERSION ) INameSpacePrefixMap; + typedef INameSpacePrefixMap * pINameSpacePrefixMap; + typedef const INameSpacePrefixMap * pcINameSpacePrefixMap; + typedef shared_ptr< INameSpacePrefixMap > spINameSpacePrefixMap; + typedef shared_ptr< const INameSpacePrefixMap > spcINameSpacePrefixMap; + static const uint64 kINameSpacePrefixMapID ( 0x634e5350724d6170 /* cNSPrMap */ ); + + // IPathSegment + class IPathSegment_v1; + typedef IPathSegment_v1 IPathSegment_base; + typedef IPathSegment_v1 * pIPathSegment_base; + typedef const IPathSegment_v1 * pcIPathSegment_base; + typedef BASE_CLASS( IPathSegment, IPATHSEGMENT_VERSION ) IPathSegment; + typedef IPathSegment * pIPathSegment; + typedef const IPathSegment * pcIPathSegment; + typedef shared_ptr< IPathSegment > spIPathSegment; + typedef shared_ptr< const IPathSegment > spcIPathSegment; + static const uint64 kIPathSegmentID ( 0x6350617468536567 /* cPathSeg */ ); + + // IPath + class IPath_v1; + typedef IPath_v1 IPath_base; + typedef IPath_v1 * pIPath_base; + typedef const IPath_v1 * pcIPath_base; + typedef BASE_CLASS( IPath, IPATH_VERSION ) IPath; + typedef IPath * pIPath; + typedef const IPath * pcIPath; + typedef shared_ptr< IPath > spIPath; + typedef shared_ptr< const IPath > spcIPath; + static const uint64 kIPathID ( 0x6350617468202020 /* cPath */ ); + + // INode + class INode_v1; + typedef INode_v1 INode_base; + typedef INode_v1 * pINode_base; + typedef const INode_v1 * pcINode_base; + typedef BASE_CLASS( INode, INODE_VERSION ) INode; + typedef INode * pINode; + typedef const INode * pcINode; + typedef shared_ptr< INode > spINode; + typedef shared_ptr< const INode > spcINode; + static const uint64 kINodeID ( 0x634e6f6465202020 /* cNode */ ); + + // ISimpleNode + class ISimpleNode_v1; + typedef ISimpleNode_v1 ISimpleNode_base; + typedef ISimpleNode_v1 * pISimpleNode_base; + typedef const ISimpleNode_v1 * pcISimpleNode_base; + typedef BASE_CLASS( ISimpleNode, ISIMPLENODE_VERSION ) ISimpleNode; + typedef ISimpleNode * pISimpleNode; + typedef const ISimpleNode * pcISimpleNode; + typedef shared_ptr< ISimpleNode > spISimpleNode; + typedef shared_ptr< const ISimpleNode > spcISimpleNode; + static const uint64 kISimpleNodeID ( 0x63536d6c4e6f6465 /* cSmlNode */ ); + + // ICompositeNode + class ICompositeNode_v1; + typedef ICompositeNode_v1 ICompositeNode_base; + typedef ICompositeNode_v1 * pICompositeNode_base; + typedef const ICompositeNode_v1 * pcICompositeNode_base; + typedef BASE_CLASS( ICompositeNode, ICOMPOSITENODE_VERSION ) ICompositeNode; + typedef ICompositeNode * pICompositeNode; + typedef const ICompositeNode * pcICompositeNode; + typedef shared_ptr< ICompositeNode > spICompositeNode; + typedef shared_ptr< const ICompositeNode > spcICompositeNode; + static const uint64 kICompositeNodeID ( 0x63436d704e6f6465 /* cCmpNode */ ); + + // IStructureNode + class IStructureNode_v1; + typedef IStructureNode_v1 IStructureNode_base; + typedef IStructureNode_v1 * pIStructureNode_base; + typedef const IStructureNode_v1 * pcIStructureNode_base; + typedef BASE_CLASS( IStructureNode, ISTRUCTURENODE_VERSION ) IStructureNode; + typedef IStructureNode * pIStructureNode; + typedef const IStructureNode * pcIStructureNode; + typedef shared_ptr< IStructureNode > spIStructureNode; + typedef shared_ptr< const IStructureNode > spcIStructureNode; + static const uint64 kIStructureNodeID ( 0x635374724e6f6465 /* cStrNode */ ); + + // IArrayNode + class IArrayNode_v1; + typedef IArrayNode_v1 IArrayNode_base; + typedef IArrayNode_v1 * pIArrayNode_base; + typedef const IArrayNode_v1 * pcIArrayNode_base; + typedef BASE_CLASS( IArrayNode, IARRAYNODE_VERSION ) IArrayNode; + typedef IArrayNode * pIArrayNode; + typedef const IArrayNode * pcIArrayNode; + typedef shared_ptr< IArrayNode > spIArrayNode; + typedef shared_ptr< const IArrayNode > spcIArrayNode; + static const uint64 kIArrayNodeID ( 0x634172724e6f6465 /* cArrNode */ ); + + // INodeIterator + class INodeIterator_v1; + typedef INodeIterator_v1 INodeIterator_base; + typedef INodeIterator_v1 * pINodeIterator_base; + typedef const INodeIterator_v1 * pcINodeIterator_base; + typedef BASE_CLASS(INodeIterator, INODEITERATOR_VERSION) INodeIterator; + typedef INodeIterator * pINodeIterator; + typedef const INodeIterator * pcINodeIterator; + typedef shared_ptr< INodeIterator > spINodeIterator; + typedef shared_ptr< const INodeIterator > spcINodeIterator; + static const uint64 kINodeIteratorID (0x634e6f6465497420 /* cNodeIt */); + + // IMetadata + class IMetadata_v1; + typedef IMetadata_v1 IMetadata_base; + typedef IMetadata_v1 * pIMetadata_base; + typedef const IMetadata_v1 * pcIMetadata_base; + typedef BASE_CLASS( IMetadata, IMETADATA_VERSION ) IMetadata; + typedef IMetadata * pIMetadata; + typedef const IMetadata * pcIMetadata; + typedef shared_ptr< IMetadata > spIMetadata; + typedef shared_ptr< const IMetadata > spcIMetadata; + static const uint64 kIMetadataID ( 0x634d657461646174 /* cMetadat */ ); + + // IClientDOMParser + class IClientDOMParser_v1; + typedef IClientDOMParser_v1 IClientDOMParser_base; + typedef IClientDOMParser_v1 * pIClientDOMParser_base; + typedef const IClientDOMParser_v1 * pcIClientDOMParser_base; + typedef BASE_CLASS( IClientDOMParser, ICLIENTDOMPARSER_VERSION ) IClientDOMParser; + typedef IClientDOMParser * pIClientDOMParser; + typedef const IClientDOMParser * pcIClientDOMParser; + + // IClientDOMSerializer + class IClientDOMSerializer_v1; + typedef IClientDOMSerializer_v1 IClientDOMSerializer_base; + typedef IClientDOMSerializer_v1 * pIClientDOMSerializer_base; + typedef const IClientDOMSerializer_v1 * pcIClientDOMSerializer_base; + typedef BASE_CLASS( IClientDOMSerializer, ICLIENTDOMSERIALIZER_VERSION ) IClientDOMSerializer; + typedef IClientDOMSerializer * pIClientDOMSerializer; + typedef const IClientDOMSerializer * pcIClientDOMSerializer; + + // IDOMParser + class IDOMParser_v1; + typedef IDOMParser_v1 IDOMParser_base; + typedef IDOMParser_v1 * pIDOMParser_base; + typedef const IDOMParser_v1 * pcIDOMParser_base; + typedef BASE_CLASS( IDOMParser, IDOMPARSER_VERSION ) IDOMParser; + typedef IDOMParser * pIDOMParser; + typedef const IDOMParser * pcIDOMParser; + typedef shared_ptr< IDOMParser > spIDOMParser; + typedef shared_ptr< const IDOMParser > spcIDOMParser; + static const uint64 kIDOMParserID ( 0x63444f4d50727372 /* cDOMPrsr */ ); + + // IDOMSerializer + class IDOMSerializer_v1; + typedef IDOMSerializer_v1 IDOMSerializer_base; + typedef IDOMSerializer_v1 * pIDOMSerializer_base; + typedef const IDOMSerializer_v1 * pcIDOMSerializer_base; + typedef BASE_CLASS( IDOMSerializer, IDOMSERIALIZER_VERSION ) IDOMSerializer; + typedef IDOMSerializer * pIDOMSerializer; + typedef const IDOMSerializer * pcIDOMSerializer; + typedef shared_ptr< IDOMSerializer > spIDOMSerializer; + typedef shared_ptr< const IDOMSerializer > spcIDOMSerializer; + static const uint64 kIDOMSerializerID ( 0x63444f4d53726c7a /* cDOMSrlz */ ); + + // IDOMImplementationRegistry + class IDOMImplementationRegistry_v1; + typedef IDOMImplementationRegistry_v1 IDOMImplementationRegistry_base; + typedef IDOMImplementationRegistry_v1 * pIDOMImplementationRegistry_base; + typedef const IDOMImplementationRegistry_v1 * pcIDOMImplementationRegistry_base; + typedef BASE_CLASS( IDOMImplementationRegistry, IDOMIMPLEMENTATIONREGISTRY_VERSION) IDOMImplementationRegistry; + typedef IDOMImplementationRegistry * pIDOMImplementationRegistry; + typedef const IDOMImplementationRegistry * pcIDOMImplementationRegistry; + typedef shared_ptr< IDOMImplementationRegistry > spIDOMImplementationRegistry; + typedef shared_ptr< const IDOMImplementationRegistry > spcIDOMImplementationRegistry; + static const uint64 kIDOMImplementationRegistryID ( 0x63444f4d52677374 /* cDOMRgst */ ); + + // ICoreObjectFactory + class ICoreObjectFactory_v1; + typedef ICoreObjectFactory_v1 ICoreObjectFactory_base; + typedef ICoreObjectFactory_v1 * pICoreObjectFactory_base; + typedef const ICoreObjectFactory_v1 * pcICoreObjectFactory_base; + typedef BASE_CLASS( ICoreObjectFactory, ICOREOBJECTFACTORY_VERSION ) ICoreObjectFactory; + typedef ICoreObjectFactory * pICoreObjectFactory; + typedef const ICoreObjectFactory * pcICoreObjectFactory; + static const uint64 kICoreObjectFactoryID ( 0x634f626a46616374 /* cObjFact */ ); + + // ICoreConfigurationManager + class ICoreConfigurationManager_v1; + typedef ICoreConfigurationManager_v1 ICoreConfigurationManager_base; + typedef ICoreConfigurationManager_v1 * pICoreConfigurationManager_base; + typedef const ICoreConfigurationManager_v1 * pcICoreConfigurationManager_base; + typedef BASE_CLASS( ICoreConfigurationManager, ICORECONFIGURATIONMANAGER_VERSION ) ICoreConfigurationManager; + typedef ICoreConfigurationManager * pICoreConfigurationManager; + typedef const ICoreConfigurationManager * pcICoreConfigurationManager; + typedef shared_ptr< ICoreConfigurationManager > spICoreConfigurationManager; + typedef shared_ptr< const ICoreConfigurationManager > spcICoreConfigurationManager; + static const uint64 kICoreConfigurationManagerID ( 0x63436f6e664d6772 /* cConfMgr */ ); + +} + +namespace AdobeXMPCore_Int { + + // INameSpacePrefixMap_I + class INameSpacePrefixMap_I; + typedef INameSpacePrefixMap_I * pINameSpacePrefixMap_I; + typedef const INameSpacePrefixMap_I * pcINameSpacePrefixMap_I; + + // IPathSegment_I + class IPathSegment_I; + typedef IPathSegment_I * pIPathSegment_I; + typedef const IPathSegment_I * pcIPathSegment_I; + + // IPath_I + class IPath_I; + typedef IPath_I * pIPath_I; + typedef const IPath_I * pcIPath_I; + + // INode_I + class INode_I; + typedef INode_I * pINode_I; + typedef const INode_I * pcINode_I; + + // ISimpleNode_I + class ISimpleNode_I; + typedef ISimpleNode_I * pISimpleNode_I; + typedef const ISimpleNode_I * pcISimpleNode_I; + + // ICompositeNode_I + class ICompositeNode_I; + typedef ICompositeNode_I * pICompositeNode_I; + typedef const ICompositeNode_I * pcICompositeNode_I; + + // IStructureNode_I + class IStructureNode_I; + typedef IStructureNode_I * pIStructureNode_I; + typedef const IStructureNode_I * pcIStructureNode_I; + + // IArrayNode_I + class IArrayNode_I; + typedef IArrayNode_I * pIArrayNode_I; + typedef const IArrayNode_I * pcIArrayNode_I; + + // INodeIterator_I + class INodeIterator_I; + typedef INodeIterator_I * pINodeIterator_I; + typedef const INodeIterator_I * pcINodeIterator_I; + + // IMetadata_I + class IMetadata_I; + typedef IMetadata_I * pIMetadata_I; + typedef const IMetadata_I * pcIMetadata_I; + + // IClientDOMParser_I + class IClientDOMParser_I; + typedef IClientDOMParser_I * pIClientDOMParser_I; + typedef const IClientDOMParser_I * pcIClientDOMParser_I; + + // IClientDOMSerializer_I + class IClientDOMSerializer_I; + typedef IClientDOMSerializer_I * pIClientDOMSerializer_I; + typedef const IClientDOMSerializer_I * pcIClientDOMSerializer_I; + + // IDOMParser_I + class IDOMParser_I; + typedef IDOMParser_I * pIDOMParser_I; + typedef const IDOMParser_I * pcIDOMParser_I; + + // IDOMSerializer_I + class IDOMSerializer_I; + typedef IDOMSerializer_I * pIDOMSerializer_I; + typedef const IDOMSerializer_I * pcIDOMSerializer_I; + + // IDOMImplementationRegistry_I + class IDOMImplementationRegistry_I; + typedef IDOMImplementationRegistry_I * pIDOMImplementationRegistry_I; + typedef const IDOMImplementationRegistry_I * pcIDOMImplementationRegistry_I; + + // ICoreObjectFactory_I + class ICoreObjectFactory_I; + typedef ICoreObjectFactory_I * pICoreObjectFactory_I; + typedef const ICoreObjectFactory_I * pcICoreObjectFactory_I; + + // ICoreConfigurationManager_I + class ICoreConfigurationManager_I; + typedef ICoreConfigurationManager_I * pICoreConfigurationManager_I; + typedef const ICoreConfigurationManager_I * pcICoreConfigurationManager_I; +} + +#endif // XMPCoreFwdDeclarations_h__ + diff --git a/public/include/XMPCore/XMPCoreLatestInterfaceVersions.h b/public/include/XMPCore/XMPCoreLatestInterfaceVersions.h new file mode 100644 index 0000000..b5b54bf --- /dev/null +++ b/public/include/XMPCore/XMPCoreLatestInterfaceVersions.h @@ -0,0 +1,92 @@ +#ifndef XMPCoreLatestInterfaceVersions_h__ +#define XMPCoreLatestInterfaceVersions_h__ 1 + +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +//! +//! @brief Macro to include a client file through with client can control the interface versions he wants to stick with +//! if not the latest ones. +//! +#if !SOURCE_COMPILING_XMPCORE_LIB + #ifdef XMPCORE_CLIENT_VERSION_NUMBER_FILE + #include QUOTEME(XMPCORE_CLIENT_VERSION_NUMBER_FILE) + #endif +#endif + +#ifndef INAMESPACEPREFIXMAP_VERSION + #define INAMESPACEPREFIXMAP_VERSION 1 +#endif + +#ifndef IPATHSEGMENT_VERSION + #define IPATHSEGMENT_VERSION 1 +#endif + +#ifndef IPATH_VERSION + #define IPATH_VERSION 1 +#endif + +#ifndef INODE_VERSION + #define INODE_VERSION 1 +#endif + +#ifndef INODEITERATOR_VERSION + #define INODEITERATOR_VERSION 1 +#endif + +#ifndef ISIMPLENODE_VERSION + #define ISIMPLENODE_VERSION 1 +#endif + +#ifndef ICOMPOSITENODE_VERSION + #define ICOMPOSITENODE_VERSION 1 +#endif + +#ifndef ISTRUCTURENODE_VERSION + #define ISTRUCTURENODE_VERSION 1 +#endif + +#ifndef IARRAYNODE_VERSION + #define IARRAYNODE_VERSION 1 +#endif + +#ifndef IMETADATA_VERSION + #define IMETADATA_VERSION 1 +#endif + +#ifndef ICLIENTDOMPARSER_VERSION + #define ICLIENTDOMPARSER_VERSION 1 +#endif + +#ifndef ICLIENTDOMSERIALIZER_VERSION + #define ICLIENTDOMSERIALIZER_VERSION 1 +#endif + +#ifndef IDOMPARSER_VERSION + #define IDOMPARSER_VERSION 1 +#endif + +#ifndef IDOMSERIALIZER_VERSION + #define IDOMSERIALIZER_VERSION 1 +#endif + +#ifndef IDOMIMPLEMENTATIONREGISTRY_VERSION + #define IDOMIMPLEMENTATIONREGISTRY_VERSION 1 +#endif + +#ifndef ICOREOBJECTFACTORY_VERSION + #define ICOREOBJECTFACTORY_VERSION 1 +#endif + +#ifndef ICORECONFIGURATIONMANAGER_VERSION + #define ICORECONFIGURATIONMANAGER_VERSION 1 +#endif + +#endif // XMPCoreLatestInterfaceVersions_h__ + diff --git a/public/include/XMPCore/source/IArrayNode.cpp b/public/include/XMPCore/source/IArrayNode.cpp new file mode 100644 index 0000000..12fd0da --- /dev/null +++ b/public/include/XMPCore/source/IArrayNode.cpp @@ -0,0 +1,163 @@ +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +namespace AdobeXMPCore { + class IArrayNodeProxy; +} + +#define FRIEND_CLASS_DECLARATION() friend class AdobeXMPCore::IArrayNodeProxy; + +#include "XMPCore/Interfaces/IArrayNode.h" + +#if !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB + +#include "XMPCommon/Utilities/TWrapperFunctions.h" +#include "XMPCore/Interfaces/ICoreObjectFactory.h" + +#include <assert.h> + +namespace AdobeXMPCore { + +#if XMP_WinBuild + #pragma warning( push ) + #pragma warning( disable : 4250 ) +#endif + + class IArrayNodeProxy + : public virtual IArrayNode + , public virtual ICompositeNodeProxy + { + private: + pIArrayNode mRawPtr; + + public: + IArrayNodeProxy( pIArrayNode ptr ) + : mRawPtr( ptr ) + , ICompositeNodeProxy( ptr ) + , INodeProxy( ptr ) {} + + ~IArrayNodeProxy() __NOTHROW__ {} + + pIArrayNode APICALL GetActualIArrayNode() __NOTHROW__ { return mRawPtr; } + + void APICALL Acquire() const __NOTHROW__ { assert( false ); } + + void APICALL Release() const __NOTHROW__ { assert( false ); } + + AdobeXMPCommon_Int::pISharedObject_I APICALL GetISharedObject_I() __NOTHROW__ { + return mRawPtr->GetISharedObject_I(); + } + + AdobeXMPCore_Int::pIArrayNode_I APICALL GetIArrayNode_I() __NOTHROW__ { + return mRawPtr->GetIArrayNode_I(); + } + + pvoid APICALL GetInterfacePointer( uint64 interfaceID, uint32 interfaceVersion ) { + return CallSafeFunction< IVersionable, pvoid, pvoid, uint64, uint32 >( + mRawPtr, &IVersionable::getInterfacePointer, interfaceID, interfaceVersion ); + } + + pvoid APICALL getInterfacePointer( uint64 interfaceID, uint32 interfaceVersion, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->getInterfacePointer( interfaceID, interfaceVersion, error ); + } + + virtual eArrayForm APICALL GetArrayForm() const { + return CallConstSafeFunction< IArrayNode_v1, eArrayForm, uint32 >( + mRawPtr, &IArrayNode_v1::getArrayForm ); + } + + virtual eNodeType APICALL GetChildNodeType() const { + return CallConstSafeFunction< IArrayNode_v1, eNodeType, uint32 >( + mRawPtr, &IArrayNode_v1::getChildNodeType ); + } + + virtual spINode APICALL GetNodeAtIndex( sizet index ) { + return CallSafeFunctionReturningPointer< IArrayNode_v1, pINode_base, INode, sizet >( + mRawPtr, &IArrayNode_v1::getNodeAtIndex, index ); + } + + virtual void APICALL InsertNodeAtIndex( const spINode & node, sizet index ) { + return CallSafeFunctionReturningVoid< IArrayNode_v1, pINode_base, sizet >( + mRawPtr, &IArrayNode_v1::insertNodeAtIndex, node ? node->GetActualINode() : NULL, index ); + } + + virtual spINode APICALL RemoveNodeAtIndex( sizet index ) { + return CallSafeFunctionReturningPointer< IArrayNode_v1, pINode_base, INode, sizet >( + mRawPtr, &IArrayNode_v1::removeNodeAtIndex, index ); + } + + virtual spINode APICALL ReplaceNodeAtIndex( const spINode & node, sizet index ) { + return CallSafeFunctionReturningPointer< IArrayNode_v1, pINode_base, INode, pINode_base, sizet >( + mRawPtr, &IArrayNode_v1::replaceNodeAtIndex, node ? node->GetActualINode() :NULL, index ); + } + + virtual uint32 APICALL getArrayForm( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getArrayForm( error ); + } + + virtual pINode_base APICALL getNodeAtIndex( sizet index, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->getNodeAtIndex( index, error ); + } + + virtual void APICALL insertNodeAtIndex( pINode_base node, sizet index, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->insertNodeAtIndex( node, index, error ); + } + + virtual pINode_base APICALL removeNodeAtIndex( sizet index, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->removeNodeAtIndex( index, error ); + } + + virtual pINode_base APICALL replaceNodeAtIndex( pINode_base node, sizet index, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->replaceNodeAtIndex( node, index, error ); + } + + virtual uint32 APICALL getChildNodeType( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getChildNodeType( error ); + } + + }; + +#if XMP_WinBuild + #pragma warning( pop ) +#endif + + spIArrayNode IArrayNode_v1::MakeShared( pIArrayNode_base ptr ) { + if ( !ptr ) return spIArrayNode(); + pIArrayNode p = IArrayNode::GetInterfaceVersion() > 1 ? ptr->GetInterfacePointer< IArrayNode >() : ptr; + return shared_ptr< IArrayNode >( new IArrayNodeProxy( p ) ); + } + + spIArrayNode IArrayNode_v1::CreateUnorderedArrayNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) { + return CallSafeFunctionReturningPointer< ICoreObjectFactory, pIArrayNode_base, IArrayNode, uint32, const char *, sizet, const char *, sizet >( + ICoreObjectFactory::GetCoreObjectFactory(), &ICoreObjectFactory::CreateArrayNode, static_cast< uint32 >( IArrayNode::kAFUnordered ), + nameSpace, nameSpaceLength, name, nameLength ); + } + + spIArrayNode IArrayNode_v1::CreateOrderedArrayNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) { + return CallSafeFunctionReturningPointer< ICoreObjectFactory, pIArrayNode_base, IArrayNode, uint32, const char *, sizet, const char *, sizet >( + ICoreObjectFactory::GetCoreObjectFactory(), &ICoreObjectFactory::CreateArrayNode, static_cast< uint32 >( IArrayNode::kAFOrdered ), + nameSpace, nameSpaceLength, name, nameLength ); + } + + spIArrayNode IArrayNode_v1::CreateAlternativeArrayNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) { + return CallSafeFunctionReturningPointer< ICoreObjectFactory, pIArrayNode_base, IArrayNode, uint32, const char *, sizet, const char *, sizet >( + ICoreObjectFactory::GetCoreObjectFactory(), &ICoreObjectFactory::CreateArrayNode, static_cast< uint32 >( IArrayNode::kAFAlternative ), + nameSpace, nameSpaceLength, name, nameLength ); + } + +} + +#endif // BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB diff --git a/public/include/XMPCore/source/IClientDOMParser.cpp b/public/include/XMPCore/source/IClientDOMParser.cpp new file mode 100644 index 0000000..c476782 --- /dev/null +++ b/public/include/XMPCore/source/IClientDOMParser.cpp @@ -0,0 +1,76 @@ +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCore/Interfaces/IClientDOMParser.h" +#include "XMPCore/Interfaces/INode.h" + +#if 1//!BUILDING_XMPCORE_LIB +namespace AdobeXMPCore { + + pINode_base APICALL IClientDOMParser_v1::parse( const char * buffer, sizet bufferLength, pcIConfigurable configurationParameters, ReportErrorAndContinueABISafeProc proc, pcIError_base & error, uint32 & unknownExceptionCaught ) __NOTHROW__ { + unknownExceptionCaught = 0; + error = NULL; + try { + auto node = Parse( buffer, bufferLength, configurationParameters, proc ); + if ( node ) { + node->Acquire(); + return node->GetActualINode(); + } + return NULL; + } catch ( spcIError err ) { + error = err->GetActualIError(); + error->Acquire(); + } catch ( ... ) { + unknownExceptionCaught = 1; + } + return NULL; + } + + uint32 APICALL IClientDOMParser_v1::areKeysCaseSensitive( pcIError_base & error, uint32 & unknownExceptionCaught ) const __NOTHROW__ { + unknownExceptionCaught = 0; + error = NULL; + try { + return AreKeysCaseSensitive() ? 1 : 0; + } catch ( spcIError err ) { + error = err->GetActualIError(); + error->Acquire(); + } catch ( ... ) { + unknownExceptionCaught = 1; + } + return 0; + } + + void APICALL IClientDOMParser_v1::initialize( pIConfigurable configurationParameters, pcIError_base & error, uint32 & unknownExceptionCaught ) __NOTHROW__ { + unknownExceptionCaught = 0; + error = NULL; + try { + Initialize( configurationParameters ); + } catch ( spcIError err ) { + error = err->GetActualIError(); + error->Acquire(); + } catch ( ... ) { + unknownExceptionCaught = 1; + } + } + + uint32 APICALL IClientDOMParser_v1::validate( const uint64 & key, uint32 dataType, const IConfigurable::CombinedDataValue & dataValue, pcIError_base & error, uint32 & unknownExceptionCaught ) __NOTHROW__ { + unknownExceptionCaught = 0; + error = NULL; + try { + return static_cast< uint32 >( Validate( key, static_cast< IConfigurable::eDataType >( dataType ), dataValue ) ); + } catch ( spcIError err ) { + error = err->GetActualIError(); + error->Acquire(); + } catch ( ... ) { + unknownExceptionCaught = 1; + } + return 0; + } +} +#endif // !BUILDING_XMPCORE_LIB diff --git a/public/include/XMPCore/source/IClientDOMSerializer.cpp b/public/include/XMPCore/source/IClientDOMSerializer.cpp new file mode 100644 index 0000000..f1f9f52 --- /dev/null +++ b/public/include/XMPCore/source/IClientDOMSerializer.cpp @@ -0,0 +1,73 @@ +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCore/Interfaces/IClientDOMSerializer.h" +#include "XMPCore/Interfaces/INode.h" +#include "XMPCommon/Interfaces/IUTF8String.h" +#include "XMPCore/Interfaces/INameSpacePrefixMap.h" + +#if !BUILDING_XMPCORE_LIB +namespace AdobeXMPCore { + + void APICALL IClientDOMSerializer_v1::serialize( pINode_base node, pcINameSpacePrefixMap_base map, pcIConfigurable configurationParameters, ReportErrorAndContinueABISafeProc proc, pIUTF8String_base string, pcIError_base & error, uint32 & unknownErrorThrown ) __NOTHROW__ { + unknownErrorThrown = 0; + error = NULL; + try { + Serialize( INode::MakeShared( node ), INameSpacePrefixMap::MakeShared( map ), configurationParameters, proc, IUTF8String::MakeShared( string ) ); + } catch ( spcIError err ) { + error = err->GetActualIError(); + error->Acquire(); + } catch ( ... ) { + unknownErrorThrown = 1; + } + } + + uint32 APICALL IClientDOMSerializer_v1::areKeysCaseSensitive( pcIError_base & error, uint32 & unknownExceptionCaught ) const __NOTHROW__ { + unknownExceptionCaught = 0; + error = NULL; + try { + return AreKeysCaseSensitive() ? 1 : 0; + } catch ( spcIError err ) { + error = err->GetActualIError(); + error->Acquire(); + } catch ( ... ) { + unknownExceptionCaught = 1; + } + return 0; + } + + void APICALL IClientDOMSerializer_v1::initialize( pIConfigurable configurationParameters, pcIError_base & error, uint32 & unknownExceptionCaught ) __NOTHROW__ { + unknownExceptionCaught = 0; + error = NULL; + try { + Initialize( configurationParameters ); + } catch ( spcIError err ) { + error = err->GetActualIError(); + error->Acquire(); + } catch ( ... ) { + unknownExceptionCaught = 1; + } + } + + uint32 APICALL IClientDOMSerializer_v1::validate( const uint64 & key, uint32 dataType, const IConfigurable::CombinedDataValue & dataValue, pcIError_base & error, uint32 & unknownExceptionCaught ) __NOTHROW__ { + unknownExceptionCaught = 0; + error = NULL; + try { + return static_cast< uint32 >( Validate( key, static_cast< IConfigurable::eDataType >( dataType ), dataValue ) ); + } catch ( spcIError err ) { + error = err->GetActualIError(); + error->Acquire(); + } catch ( ... ) { + unknownExceptionCaught = 1; + } + return 0; + } + +} +#endif // !BUILDING_XMPCORE_LIB diff --git a/public/include/XMPCore/source/ICompositeNode.cpp b/public/include/XMPCore/source/ICompositeNode.cpp new file mode 100644 index 0000000..603501b --- /dev/null +++ b/public/include/XMPCore/source/ICompositeNode.cpp @@ -0,0 +1,121 @@ +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +namespace AdobeXMPCore { + class ICompositeNodeProxy; +} + +#define FRIEND_CLASS_DECLARATION() friend class AdobeXMPCore::ICompositeNodeProxy; + +#include "XMPCore/Interfaces/ICompositeNode.h" + +#if !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB + +#include "XMPCommon/Utilities/TWrapperFunctions.h" +#include <assert.h> +#include "XMPCore/Interfaces/IPath.h" +#include "XMPCore/Interfaces/INodeIterator.h" + +namespace AdobeXMPCore { + ICompositeNodeProxy::ICompositeNodeProxy( pICompositeNode ptr ) + : mRawPtr( ptr ) + , INodeProxy( ptr ) {} + + ICompositeNodeProxy::~ICompositeNodeProxy() __NOTHROW__ {} + + pICompositeNode APICALL ICompositeNodeProxy::GetActualICompositeNode() __NOTHROW__ { return mRawPtr; } + + AdobeXMPCore_Int::pICompositeNode_I APICALL ICompositeNodeProxy::GetICompositeNode_I() __NOTHROW__ { + return mRawPtr->GetICompositeNode_I(); + } + + INode_v1::eNodeType APICALL ICompositeNodeProxy::GetNodeTypeAtPath( const spcIPath & path ) const { + return CallConstSafeFunction< ICompositeNode_v1, eNodeType, uint32, pcIPath_base >( + mRawPtr, &ICompositeNode_v1::getNodeTypeAtPath, path ? path->GetActualIPath() : NULL ); + } + + spINode APICALL ICompositeNodeProxy::GetNodeAtPath( const spcIPath & path ) { + return CallSafeFunctionReturningPointer< ICompositeNode_v1, pINode_base, INode, pcIPath_base >( + mRawPtr, &ICompositeNode_v1::getNodeAtPath, path ? path->GetActualIPath() : NULL ); + } + + void APICALL ICompositeNodeProxy::AppendNode( const spINode & node ) { + return CallSafeFunctionReturningVoid< ICompositeNode_v1, pINode_base >( + mRawPtr, &ICompositeNode_v1::appendNode, node ? node->GetActualINode() : NULL ); + } + + void APICALL ICompositeNodeProxy::InsertNodeAtPath( const spINode & node, const spcIPath & path ) { + return CallSafeFunctionReturningVoid< ICompositeNode_v1, pINode_base, pcIPath_base >( + mRawPtr, &ICompositeNode_v1::insertNodeAtPath, node ? node->GetActualINode() : NULL, path ? path->GetActualIPath() : NULL ); + } + + spINode APICALL ICompositeNodeProxy::ReplaceNodeAtPath( const spINode & node, const spcIPath & path ) { + return CallSafeFunctionReturningPointer< ICompositeNode_v1, pINode_base, INode, pINode_base, pcIPath_base >( + mRawPtr, &ICompositeNode_v1::replaceNodeAtPath, node ? node->GetActualINode() : NULL, path ? path->GetActualIPath() : NULL ); + } + + spINode APICALL ICompositeNodeProxy::RemoveNodeAtPath( const spcIPath & path ) { + return CallSafeFunctionReturningPointer< ICompositeNode_v1, pINode_base, INode, pcIPath_base >( + mRawPtr, &ICompositeNode_v1::removeNodeAtPath, path ? path->GetActualIPath() : NULL ); + } + + spINodeIterator APICALL ICompositeNodeProxy::Iterator() { + return CallSafeFunctionReturningPointer< ICompositeNode_v1, pINodeIterator_base, INodeIterator >( + mRawPtr, &ICompositeNode_v1::iterator ); + } + + sizet APICALL ICompositeNodeProxy::ChildCount() const __NOTHROW__ { + return mRawPtr->ChildCount(); + } + + uint32 APICALL ICompositeNodeProxy::getNodeTypeAtPath( pcIPath_base path, pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getNodeTypeAtPath( path, error ); + } + + pINode_base APICALL ICompositeNodeProxy::getNodeAtPath( pcIPath_base path, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->getNodeAtPath( path, error ); + } + + void APICALL ICompositeNodeProxy::appendNode( pINode_base node, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->appendNode( node, error ); + } + + void APICALL ICompositeNodeProxy::insertNodeAtPath( pINode_base node, pcIPath_base path, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->insertNodeAtPath( node, path, error ); + } + + pINode_base APICALL ICompositeNodeProxy::replaceNodeAtPath( pINode_base node, pcIPath_base path, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->replaceNodeAtPath( node, path, error ); + } + + pINode_base APICALL ICompositeNodeProxy::removeNodeAtPath( pcIPath_base path, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->removeNodeAtPath( path, error ); + } + + pINodeIterator_base APICALL ICompositeNodeProxy::iterator( pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->iterator( error ); + } + + spICompositeNode ICompositeNode_v1::MakeShared( pICompositeNode_base ptr ) { + if ( !ptr ) return spICompositeNode(); + pICompositeNode p = ICompositeNode::GetInterfaceVersion() > 1 ? + ptr->GetInterfacePointer< ICompositeNode >() : ptr; + return shared_ptr< ICompositeNode >( new ICompositeNodeProxy( p ) ); + } + +} + +#endif // BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB diff --git a/public/include/XMPCore/source/ICoreConfigurationManager.cpp b/public/include/XMPCore/source/ICoreConfigurationManager.cpp new file mode 100644 index 0000000..af4f74c --- /dev/null +++ b/public/include/XMPCore/source/ICoreConfigurationManager.cpp @@ -0,0 +1,88 @@ +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +namespace AdobeXMPCore { + class ICoreConfigurationManagerProxy; +} + +#define FRIEND_CLASS_DECLARATION() friend class AdobeXMPCore::ICoreConfigurationManagerProxy; + +#include "XMPCore/Interfaces/ICoreConfigurationManager.h" + +#if !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB + +#include "XMPCommon/Utilities/TWrapperFunctions.h" +#include "XMPCore/Interfaces/ICoreObjectFactory.h" +#include <assert.h> + +namespace AdobeXMPCore { + +#if XMP_WinBuild + #pragma warning( push ) + #pragma warning( disable : 4250 ) +#endif + + class ICoreConfigurationManagerProxy + : public virtual ICoreConfigurationManager + , public virtual IConfigurationManagerProxy + { + private: + pICoreConfigurationManager mRawPtr; + + public: + ICoreConfigurationManagerProxy( pICoreConfigurationManager ptr ) + : IConfigurationManagerProxy( ptr ) + , mRawPtr( ptr ) {} + + ~ICoreConfigurationManagerProxy() __NOTHROW__ {} + + pICoreConfigurationManager APICALL GetActualICoreConfigurationManager() __NOTHROW__ { return mRawPtr; } + + void APICALL Acquire() const __NOTHROW__ { assert( false ); } + + void APICALL Release() const __NOTHROW__ { assert( false ); } + + AdobeXMPCommon_Int::pISharedObject_I APICALL GetISharedObject_I() __NOTHROW__ { + return mRawPtr->GetISharedObject_I(); + } + + AdobeXMPCore_Int::pICoreConfigurationManager_I APICALL GetICoreConfigurationManager_I() __NOTHROW__ { + return mRawPtr->GetICoreConfigurationManager_I(); + } + + pvoid APICALL GetInterfacePointer( uint64 interfaceID, uint32 interfaceVersion ) { + return CallSafeFunction< IVersionable, pvoid, pvoid, uint64, uint32 >( + mRawPtr, &IVersionable::getInterfacePointer, interfaceID, interfaceVersion ); + } + + pvoid APICALL getInterfacePointer( uint64 interfaceID, uint32 interfaceVersion, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->getInterfacePointer( interfaceID, interfaceVersion, error ); + } + + }; + + spICoreConfigurationManager ICoreConfigurationManager_v1::MakeShared( pICoreConfigurationManager_base ptr ) { + if ( !ptr ) return spICoreConfigurationManager(); + pICoreConfigurationManager p = ICoreConfigurationManager::GetInterfaceVersion() > 1 ? ptr->GetInterfacePointer< ICoreConfigurationManager >() : ptr; + return shared_ptr< ICoreConfigurationManager >( new ICoreConfigurationManagerProxy( p ) ); + } + + spICoreConfigurationManager ICoreConfigurationManager_v1::GetCoreConfigurationManager() { + return CallSafeFunctionReturningPointer< ICoreObjectFactory, pICoreConfigurationManager_base, ICoreConfigurationManager >( + ICoreObjectFactory::GetCoreObjectFactory(), &ICoreObjectFactory::GetCoreConfigurationManager ); + } + +#if XMP_WinBuild + #pragma warning( pop ) +#endif + +} + +#endif // !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB diff --git a/public/include/XMPCore/source/ICoreObjectFactory.cpp b/public/include/XMPCore/source/ICoreObjectFactory.cpp new file mode 100644 index 0000000..b7e12e8 --- /dev/null +++ b/public/include/XMPCore/source/ICoreObjectFactory.cpp @@ -0,0 +1,83 @@ +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCore/Interfaces/ICoreObjectFactory.h" + +#if !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB + +#include "XMPCommon/Utilities/TWrapperFunctions.h" +#include <assert.h> + +#if LINKING_XMPCORE_LIB + extern "C" AdobeXMPCore::pICoreObjectFactory_base WXMPMeta_GetXMPDOMFactoryInstance_1(); +#endif + +namespace AdobeXMPCore { + + pICoreObjectFactory ICoreObjectFactory_v1::MakeCoreObjectFactory( pICoreObjectFactory_base ptr ) { + if ( ICoreObjectFactory::GetInterfaceVersion() == 1 ) + return ptr; + else + return ptr->GetInterfacePointer< ICoreObjectFactory >(); + } + +#if LINKING_XMPCORE_LIB + static pICoreObjectFactory ManageCoreObjectFactory( bool destroy = false ) { + static pICoreObjectFactory sCoreObjectFactoryPtr( NULL ); + if ( destroy && sCoreObjectFactoryPtr ) { + sCoreObjectFactoryPtr = NULL; + return sCoreObjectFactoryPtr; + } + + if ( !sCoreObjectFactoryPtr ) { + if ( ICoreObjectFactory::GetInterfaceVersion() != 1 ) + sCoreObjectFactoryPtr = WXMPMeta_GetXMPDOMFactoryInstance_1()->GetInterfacePointer< ICoreObjectFactory >(); + else + sCoreObjectFactoryPtr = WXMPMeta_GetXMPDOMFactoryInstance_1(); + } + return sCoreObjectFactoryPtr; + } + + + void ICoreObjectFactory_v1::SetupCoreObjectFactory() { + ManageCoreObjectFactory(); + } +#else + static pICoreObjectFactory ManageCoreObjectFactory( bool destroy = false, pICoreObjectFactory_base coreObjectFactory = NULL ) { + static pICoreObjectFactory sCoreObjectFactoryPtr( NULL ); + if ( destroy && sCoreObjectFactoryPtr ) { + sCoreObjectFactoryPtr = NULL; + return sCoreObjectFactoryPtr; + } + + if ( !sCoreObjectFactoryPtr && coreObjectFactory ) { + if ( ICoreObjectFactory::GetInterfaceVersion() != 1 ) + sCoreObjectFactoryPtr = coreObjectFactory->GetInterfacePointer< ICoreObjectFactory >(); + else + sCoreObjectFactoryPtr = coreObjectFactory; + } + return sCoreObjectFactoryPtr; + } + + void ICoreObjectFactory_v1::SetupCoreObjectFactory( pICoreObjectFactory_base coreObjectFactory ) { + ManageCoreObjectFactory( false, coreObjectFactory ); + } +#endif + + pICoreObjectFactory ICoreObjectFactory_v1::GetCoreObjectFactory() { + return ManageCoreObjectFactory(); + } + + void ICoreObjectFactory_v1::DestroyCoreObjectFactory() { + ManageCoreObjectFactory( true ); + } + +} + +#endif // BUILDING_XMPCORE_LIB diff --git a/public/include/XMPCore/source/IDOMImplementationRegistry.cpp b/public/include/XMPCore/source/IDOMImplementationRegistry.cpp new file mode 100644 index 0000000..35934e2 --- /dev/null +++ b/public/include/XMPCore/source/IDOMImplementationRegistry.cpp @@ -0,0 +1,122 @@ +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +namespace AdobeXMPCore { + class IDOMImplementationRegistryProxy; +} + +#define FRIEND_CLASS_DECLARATION() friend class AdobeXMPCore::IDOMImplementationRegistryProxy; + +#include "XMPCore/Interfaces/IDOMImplementationRegistry.h" + +#if !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB + +#include "XMPCommon/Utilities/TWrapperFunctions.h" +#include <assert.h> +#include "XMPCore/Interfaces/IDOMParser.h" +#include "XMPCore/Interfaces/IDOMSerializer.h" +#include "XMPCore/Interfaces/ICoreObjectFactory.h" + +namespace AdobeXMPCore { + + class IDOMImplementationRegistryProxy + : public virtual IDOMImplementationRegistry + { + private: + pIDOMImplementationRegistry mRawPtr; + + public: + IDOMImplementationRegistryProxy( pIDOMImplementationRegistry ptr ) + : mRawPtr( ptr ) + { + mRawPtr->Acquire(); + } + + ~IDOMImplementationRegistryProxy() __NOTHROW__ { mRawPtr->Release(); } + + pIDOMImplementationRegistry APICALL GetActualIDOMImplementationRegistry() __NOTHROW__ { return mRawPtr; } + + void APICALL Acquire() const __NOTHROW__ { assert( false ); } + + void APICALL Release() const __NOTHROW__ { assert( false ); } + + AdobeXMPCommon_Int::pISharedObject_I APICALL GetISharedObject_I() __NOTHROW__ { + return mRawPtr->GetISharedObject_I(); + } + + AdobeXMPCore_Int::pIDOMImplementationRegistry_I APICALL GetIDOMImplementationRegistry_I() __NOTHROW__ { + return mRawPtr->GetIDOMImplementationRegistry_I(); + } + + pvoid APICALL GetInterfacePointer( uint64 interfaceID, uint32 interfaceVersion ) { + return CallSafeFunction< IVersionable, pvoid, pvoid, uint64, uint32 >( + mRawPtr, &IVersionable::getInterfacePointer, interfaceID, interfaceVersion ); + } + + pvoid APICALL getInterfacePointer( uint64 interfaceID, uint32 interfaceVersion, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->getInterfacePointer( interfaceID, interfaceVersion, error ); + } + + virtual spIDOMParser APICALL GetParser( const char * key ) const { + return CallConstSafeFunctionReturningPointer< IDOMImplementationRegistry, pIDOMParser_base, IDOMParser, const char * >( + mRawPtr, &IDOMImplementationRegistry::getParser, key ); + } + + virtual spIDOMSerializer APICALL GetSerializer( const char * key ) const { + return CallConstSafeFunctionReturningPointer< IDOMImplementationRegistry, pIDOMSerializer_base, IDOMSerializer, const char * >( + mRawPtr, &IDOMImplementationRegistry::getSerializer, key ); + } + + virtual bool APICALL RegisterParser( const char * key, pIClientDOMParser_base parser ) { + return CallSafeFunction< IDOMImplementationRegistry, bool, uint32, const char *, pIClientDOMParser_base >( + mRawPtr, &IDOMImplementationRegistry::registerParser, key, parser ); + } + + virtual bool APICALL RegisterSerializer( const char * key, pIClientDOMSerializer_base serializer ) { + return CallSafeFunction< IDOMImplementationRegistry, bool, uint32, const char *, pIClientDOMSerializer_base >( + mRawPtr, &IDOMImplementationRegistry::registerSerializer, key, serializer ); + } + + virtual pIDOMParser_base APICALL getParser( const char * key, pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getParser( key, error ); + } + + virtual pIDOMSerializer_base APICALL getSerializer( const char * key, pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getSerializer( key, error ); + } + + virtual uint32 APICALL registerParser( const char * key, pIClientDOMParser_base parser, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->registerParser( key, parser, error ); + } + + virtual uint32 APICALL registerSerializer( const char * key, pIClientDOMSerializer_base serializer, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->registerSerializer( key, serializer, error ); + } + + }; + + spIDOMImplementationRegistry IDOMImplementationRegistry_v1::GetDOMImplementationRegistry() { + return CallSafeFunctionReturningPointer< ICoreObjectFactory, pIDOMImplementationRegistry_base, IDOMImplementationRegistry >( + ICoreObjectFactory::GetCoreObjectFactory(), &ICoreObjectFactory::GetDOMImplementationRegistry ); + } + + spIDOMImplementationRegistry IDOMImplementationRegistry_v1::MakeShared( pIDOMImplementationRegistry_base ptr ) { + if ( !ptr ) return spIDOMImplementationRegistry(); + pIDOMImplementationRegistry p = IDOMImplementationRegistry::GetInterfaceVersion() > 1 ? ptr->GetInterfacePointer< IDOMImplementationRegistry >() : ptr; + return shared_ptr< IDOMImplementationRegistry >( new IDOMImplementationRegistryProxy( p ) ); + } + +} + +#endif // BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB diff --git a/public/include/XMPCore/source/IDOMParser.cpp b/public/include/XMPCore/source/IDOMParser.cpp new file mode 100644 index 0000000..a077a5c --- /dev/null +++ b/public/include/XMPCore/source/IDOMParser.cpp @@ -0,0 +1,116 @@ +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +namespace AdobeXMPCore { + class IDOMParserProxy; +} + +#define FRIEND_CLASS_DECLARATION() friend class AdobeXMPCore::IDOMParserProxy; + +#include "XMPCore/Interfaces/IDOMParser.h" + +#if !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB + +#include "XMPCommon/Utilities/TWrapperFunctions.h" +#include <assert.h> +#include "XMPCore/Interfaces/IMetadata.h" + +namespace AdobeXMPCore { + +#if XMP_WinBuild + #pragma warning( push ) + #pragma warning( disable : 4250 ) +#endif + + class IDOMParserProxy + : public virtual IDOMParser + , public virtual IConfigurableProxy + { + private: + pIDOMParser mRawPtr; + + public: + IDOMParserProxy( pIDOMParser ptr ) + : IConfigurableProxy( ptr ) + , mRawPtr( ptr ) + { + mRawPtr->Acquire(); + } + + ~IDOMParserProxy() __NOTHROW__ { mRawPtr->Release(); } + + pIDOMParser APICALL GetActualIDOMParser() __NOTHROW__ { return mRawPtr; } + + void APICALL Acquire() const __NOTHROW__ { assert( false ); } + + void APICALL Release() const __NOTHROW__ { assert( false ); } + + AdobeXMPCommon_Int::pISharedObject_I APICALL GetISharedObject_I() __NOTHROW__ { + return mRawPtr->GetISharedObject_I(); + } + + AdobeXMPCore_Int::pIDOMParser_I APICALL GetIDOMParser_I() __NOTHROW__ { + return mRawPtr->GetIDOMParser_I(); + } + + pvoid APICALL GetInterfacePointer( uint64 interfaceID, uint32 interfaceVersion ) { + return CallSafeFunction< IVersionable, pvoid, pvoid, uint64, uint32 >( + mRawPtr, &IVersionable::getInterfacePointer, interfaceID, interfaceVersion ); + } + + pvoid APICALL getInterfacePointer( uint64 interfaceID, uint32 interfaceVersion, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->getInterfacePointer( interfaceID, interfaceVersion, error ); + } + + virtual spIDOMParser APICALL Clone() const { + return CallConstSafeFunctionReturningPointer< IDOMParser, pIDOMParser_base, IDOMParser >( + mRawPtr, &IDOMParser::clone ); + } + + virtual spIMetadata APICALL Parse( const char * buffer, sizet bufferLength ) { + return CallSafeFunctionReturningPointer< IDOMParser, pIMetadata_base, IMetadata, const char *, sizet >( + mRawPtr, &IDOMParser::parse, buffer, bufferLength ); + } + + virtual void APICALL ParseWithSpecificAction( const char * buffer, sizet bufferLength, eActionType actionType, spINode & node ) { + return CallSafeFunctionReturningVoid< IDOMParser, const char *, sizet, uint32, pINode_base >( + mRawPtr, &IDOMParser::parseWithSpecificAction, buffer, bufferLength, static_cast< uint32 >( actionType ), node ? node->GetActualINode() : NULL ); + } + + virtual pIDOMParser_base APICALL clone( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->clone( error ); + } + + virtual pIMetadata_base APICALL parse( const char * buffer, sizet bufferLength, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->parse( buffer, bufferLength, error ); + } + + virtual void APICALL parseWithSpecificAction( const char * buffer, sizet bufferLength, uint32 actionType, pINode_base node, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->parseWithSpecificAction( buffer, bufferLength, actionType, node, error ); + } + + }; + +#if XMP_WinBuild + #pragma warning( pop ) +#endif + + spIDOMParser IDOMParser_v1::MakeShared( pIDOMParser_base ptr ) { + if ( !ptr ) return spIDOMParser(); + pIDOMParser p = IDOMParser::GetInterfaceVersion() > 1 ? ptr->GetInterfacePointer< IDOMParser >() : ptr; + return shared_ptr< IDOMParser >( new IDOMParserProxy( p ) ); + } + +} + +#endif // BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB diff --git a/public/include/XMPCore/source/IDOMSerializer.cpp b/public/include/XMPCore/source/IDOMSerializer.cpp new file mode 100644 index 0000000..481477a --- /dev/null +++ b/public/include/XMPCore/source/IDOMSerializer.cpp @@ -0,0 +1,109 @@ +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +namespace AdobeXMPCore { + class IDOMSerializerProxy; +} + +#define FRIEND_CLASS_DECLARATION() friend class AdobeXMPCore::IDOMSerializerProxy; + +#include "XMPCore/Interfaces/IDOMSerializer.h" + +#if !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB + +#include "XMPCommon/Utilities/TWrapperFunctions.h" +#include "XMPCommon/Interfaces/IUTF8String.h" +#include "XMPCore/Interfaces/INode.h" +#include "XMPCore/Interfaces/INameSpacePrefixMap.h" + +#include <assert.h> + +namespace AdobeXMPCore { + +#if XMP_WinBuild + #pragma warning( push ) + #pragma warning( disable : 4250 ) +#endif + + class IDOMSerializerProxy + : public virtual IDOMSerializer + , public virtual IConfigurableProxy + { + private: + pIDOMSerializer mRawPtr; + + public: + IDOMSerializerProxy( pIDOMSerializer ptr ) + : IConfigurableProxy( ptr ) + , mRawPtr( ptr ) + { + mRawPtr->Acquire(); + } + + ~IDOMSerializerProxy() __NOTHROW__ { mRawPtr->Release(); } + + pIDOMSerializer APICALL GetActualIDOMSerializer() __NOTHROW__ { return mRawPtr; } + + void APICALL Acquire() const __NOTHROW__ { assert( false ); } + + void APICALL Release() const __NOTHROW__ { assert( false ); } + + AdobeXMPCommon_Int::pISharedObject_I APICALL GetISharedObject_I() __NOTHROW__ { + return mRawPtr->GetISharedObject_I(); + } + + AdobeXMPCore_Int::pIDOMSerializer_I APICALL GetIDOMSerializer_I() __NOTHROW__ { + return mRawPtr->GetIDOMSerializer_I(); + } + + pvoid APICALL GetInterfacePointer( uint64 interfaceID, uint32 interfaceVersion ) { + return CallSafeFunction< IVersionable, pvoid, pvoid, uint64, uint32 >( + mRawPtr, &IVersionable::getInterfacePointer, interfaceID, interfaceVersion ); + } + + pvoid APICALL getInterfacePointer( uint64 interfaceID, uint32 interfaceVersion, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->getInterfacePointer( interfaceID, interfaceVersion, error ); + } + + virtual spIDOMSerializer APICALL Clone() const { + return CallConstSafeFunctionReturningPointer< IDOMSerializer, pIDOMSerializer_base, IDOMSerializer >( + mRawPtr, &IDOMSerializer_v1::clone ); + } + + virtual spIUTF8String APICALL Serialize( const spINode & node, const spcINameSpacePrefixMap & map ) { + return CallSafeFunctionReturningPointer< IDOMSerializer, pIUTF8String_base, IUTF8String, pINode_base, pcINameSpacePrefixMap_base >( + mRawPtr, &IDOMSerializer_v1::serialize, node ? node->GetActualINode() : NULL , map ? map->GetActualINameSpacePrefixMap() : NULL ); + } + + virtual pIDOMSerializer_base APICALL clone( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->clone( error ); + } + + virtual pIUTF8String_base APICALL serialize( pINode_base node, pcINameSpacePrefixMap_base map, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->serialize( node, map, error ); + } + + }; + +#if XMP_WinBuild + #pragma warning( pop ) +#endif + + spIDOMSerializer IDOMSerializer_v1::MakeShared( pIDOMSerializer_base ptr ) { + if ( !ptr ) return spIDOMSerializer(); + pIDOMSerializer p = ptr->GetInterfacePointer< IDOMSerializer >(); + return shared_ptr< IDOMSerializer >( new IDOMSerializerProxy( p ) ); + } + +} + +#endif // !BUILDING_XMPCORE_LIB diff --git a/public/include/XMPCore/source/IMetadata.cpp b/public/include/XMPCore/source/IMetadata.cpp new file mode 100644 index 0000000..9b4eef5 --- /dev/null +++ b/public/include/XMPCore/source/IMetadata.cpp @@ -0,0 +1,113 @@ +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +namespace AdobeXMPCore { + class IMetadataProxy; +} + +#define FRIEND_CLASS_DECLARATION() friend class AdobeXMPCore::IMetadataProxy; + +#include "XMPCore/Interfaces/IMetadata.h" + +#if !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB + +#include "XMPCommon/Utilities/TWrapperFunctions.h" +#include "XMPCommon/Interfaces/IUTF8String.h" +#include "XMPCore/Interfaces/ICoreObjectFactory.h" + +#include <assert.h> + +namespace AdobeXMPCore { + +#if XMP_WinBuild + #pragma warning( push ) + #pragma warning( disable : 4250 ) +#endif + + class IMetadataProxy + : public virtual IMetadata + , public virtual IStructureNodeProxy + { + private: + pIMetadata mRawPtr; + + public: + IMetadataProxy( pIMetadata ptr ) + : mRawPtr( ptr ) + , IStructureNodeProxy( ptr ) + , ICompositeNodeProxy( ptr ) + , INodeProxy( ptr ) {} + + ~IMetadataProxy() __NOTHROW__ {} + + pIMetadata APICALL GetActualIMetadata() __NOTHROW__ { return mRawPtr; } + + void APICALL Acquire() const __NOTHROW__ { assert( false ); } + + void APICALL Release() const __NOTHROW__ { assert( false ); } + + AdobeXMPCommon_Int::pISharedObject_I APICALL GetISharedObject_I() __NOTHROW__ { + return mRawPtr->GetISharedObject_I(); + } + + AdobeXMPCore_Int::pIMetadata_I APICALL GetIMetadata_I() __NOTHROW__ { + return mRawPtr->GetIMetadata_I(); + } + + pvoid APICALL GetInterfacePointer( uint64 interfaceID, uint32 interfaceVersion ) { + return CallSafeFunction< IVersionable, pvoid, pvoid, uint64, uint32 >( + mRawPtr, &IVersionable::getInterfacePointer, interfaceID, interfaceVersion ); + } + + pvoid APICALL getInterfacePointer( uint64 interfaceID, uint32 interfaceVersion, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->getInterfacePointer( interfaceID, interfaceVersion, error ); + } + + virtual spcIUTF8String APICALL GetAboutURI() const { + return CallConstSafeFunctionReturningPointer< IMetadata_v1, pcIUTF8String_base, const IUTF8String >( + mRawPtr, &IMetadata_v1::getAboutURI ); + } + + virtual void APICALL SetAboutURI( const char * uri, sizet uriLength ) __NOTHROW__ { + mRawPtr->SetAboutURI( uri, uriLength ); + } + + virtual pcIUTF8String_base APICALL getAboutURI( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getAboutURI( error ); + } + + virtual void APICALL EnableFeature( const char * key, sizet keyLength ) const __NOTHROW__ { + return mRawPtr->EnableFeature( key, keyLength ); + } + + virtual void APICALL DisableFeature( const char * key, sizet keyLength ) const __NOTHROW__ { + return mRawPtr->DisableFeature( key, keyLength ); + } + }; + +#if XMP_WinBuild + #pragma warning( pop ) +#endif + + spIMetadata IMetadata_v1::MakeShared( pIMetadata_base ptr ) { + if ( !ptr ) return spIMetadata(); + pIMetadata p = IMetadata::GetInterfaceVersion() > 1 ? ptr->GetInterfacePointer< IMetadata >() : ptr; + return shared_ptr< IMetadata >( new IMetadataProxy( p ) ); + } + + spIMetadata IMetadata_v1::CreateMetadata() { + return CallSafeFunctionReturningPointer< ICoreObjectFactory, pIMetadata, IMetadata >( + ICoreObjectFactory::GetCoreObjectFactory(), &ICoreObjectFactory::CreateMetadata ); + } + +} + +#endif // BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB diff --git a/public/include/XMPCore/source/INameSpacePrefixMap.cpp b/public/include/XMPCore/source/INameSpacePrefixMap.cpp new file mode 100644 index 0000000..8dee5b7 --- /dev/null +++ b/public/include/XMPCore/source/INameSpacePrefixMap.cpp @@ -0,0 +1,187 @@ +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +namespace AdobeXMPCore { + class INameSpacePrefixMapProxy; +} + +#define FRIEND_CLASS_DECLARATION() friend class AdobeXMPCore::INameSpacePrefixMapProxy; + +#include "XMPCore/Interfaces/INameSpacePrefixMap.h" +#include "XMPCore/Interfaces/ICoreObjectFactory.h" + +#if !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB + +#include "XMPCommon/Utilities/TWrapperFunctions.h" +#include "XMPCommon/Interfaces/IUTF8String.h" + +#include <assert.h> + +namespace AdobeXMPCore { + + + bool INameSpacePrefixMap::IsEmpty() const __NOTHROW__{ + return this->Size() == 0; + } + + class INameSpacePrefixMapProxy + : public virtual INameSpacePrefixMap + { + private: + pINameSpacePrefixMap mRawPtr; + + public: + INameSpacePrefixMapProxy( pINameSpacePrefixMap ptr ) + : mRawPtr( ptr ) + { + mRawPtr->Acquire(); + } + + ~INameSpacePrefixMapProxy() __NOTHROW__ { mRawPtr->Release(); } + + pINameSpacePrefixMap APICALL GetActualINameSpacePrefixMap() __NOTHROW__ { return mRawPtr; } + + void APICALL Acquire() const __NOTHROW__ { assert( false ); } + + void APICALL Release() const __NOTHROW__ { assert( false ); } + + AdobeXMPCommon_Int::pISharedObject_I APICALL GetISharedObject_I() __NOTHROW__ { + return mRawPtr->GetISharedObject_I(); + } + + AdobeXMPCore_Int::pINameSpacePrefixMap_I APICALL GetINameSpacePrefixMap_I() __NOTHROW__ { + return mRawPtr->GetINameSpacePrefixMap_I(); + } + + pvoid APICALL GetInterfacePointer( uint64 interfaceID, uint32 interfaceVersion ) { + return CallSafeFunction< IVersionable, pvoid, pvoid, uint64, uint32 >( + mRawPtr, &IVersionable::getInterfacePointer, interfaceID, interfaceVersion ); + } + + pvoid APICALL getInterfacePointer( uint64 interfaceID, uint32 interfaceVersion, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->getInterfacePointer( interfaceID, interfaceVersion, error ); + } + + virtual bool APICALL Insert( const char * prefix, sizet prefixLength, const char * nameSpace, sizet nameSpaceLength ) { + return CallSafeFunction< INameSpacePrefixMap_v1, bool, uint32, const char *, sizet, const char *, sizet >( + mRawPtr, &INameSpacePrefixMap_v1::insert, prefix, prefixLength, nameSpace, nameSpaceLength ); + } + + virtual uint32 APICALL insert( const char * prefix, sizet prefixLength, const char * nameSpace, sizet nameSpaceLength, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->insert( prefix, prefixLength, nameSpace, nameSpaceLength, error ); + } + + virtual bool APICALL RemovePrefix( const char * prefix, sizet prefixLength ) { + return CallSafeFunction< INameSpacePrefixMap_v1, bool, uint32, uint32, const char *, sizet >( + mRawPtr, &INameSpacePrefixMap_v1::remove, kPrefixIsParameter, prefix, prefixLength ); + } + + virtual bool APICALL RemoveNameSpace( const char * nameSpace, sizet nameSpaceLength ) { + return CallSafeFunction< INameSpacePrefixMap_v1, bool, uint32, uint32, const char *, sizet >( + mRawPtr, &INameSpacePrefixMap_v1::remove, kNameSpaceIsParameter, nameSpace, nameSpaceLength ); + } + + virtual bool APICALL IsPrefixPresent( const char * prefix, sizet prefixLength ) const { + return CallConstSafeFunction< INameSpacePrefixMap_v1, bool, uint32, uint32, const char *, sizet >( + mRawPtr, &INameSpacePrefixMap_v1::isPresent, kPrefixIsParameter, prefix, prefixLength ); + } + + virtual bool APICALL IsNameSpacePresent( const char * nameSpace, sizet nameSpaceLength ) const { + return CallConstSafeFunction< INameSpacePrefixMap_v1, bool, uint32, uint32, const char *, sizet >( + mRawPtr, &INameSpacePrefixMap_v1::isPresent, kNameSpaceIsParameter, nameSpace, nameSpaceLength ); + } + + virtual spcIUTF8String APICALL GetNameSpace( const char * prefix, sizet prefixLength ) const { + return CallConstSafeFunctionReturningPointer< INameSpacePrefixMap_v1, pcIUTF8String_base, const IUTF8String, uint32, const char *, sizet >( + mRawPtr, &INameSpacePrefixMap_v1::get, kPrefixIsParameter, prefix, prefixLength ); + } + + virtual spcIUTF8String APICALL GetPrefix( const char * nameSpace, sizet nameSpaceLength ) const { + return CallConstSafeFunctionReturningPointer< INameSpacePrefixMap_v1, pcIUTF8String_base, const IUTF8String, uint32, const char *, sizet >( + mRawPtr, &INameSpacePrefixMap_v1::get, kNameSpaceIsParameter, nameSpace, nameSpaceLength ); + } + + virtual sizet APICALL Size() const __NOTHROW__ { + return mRawPtr->Size(); + } + + virtual void APICALL Clear() __NOTHROW__ { + return mRawPtr->Clear(); + } + + virtual spINameSpacePrefixMap APICALL Clone() const { + return CallConstSafeFunctionReturningPointer< INameSpacePrefixMap_v1, pINameSpacePrefixMap_base, INameSpacePrefixMap >( + mRawPtr, &INameSpacePrefixMap_v1::clone ); + } + + virtual pINameSpacePrefixMap_base APICALL clone( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->clone( error ); + } + + virtual uint32 APICALL remove( uint32 keyType, const char * key, sizet keyLength, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->remove( keyType, key, keyLength, error ); + } + + virtual uint32 APICALL isPresent( uint32 keyType, const char * key, sizet keyLength, pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->isPresent( keyType, key, keyLength, error ); + } + + virtual pcIUTF8String_base APICALL get( uint32 keyType, const char * key, sizet keyLength, pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->get( keyType, key, keyLength, error ); + } + + virtual void APICALL EnableThreadSafety() const __NOTHROW__ { + return mRawPtr->EnableThreadSafety(); + } + + virtual void APICALL DisableThreadSafety() const __NOTHROW__ { + return mRawPtr->DisableThreadSafety(); + } + + virtual bool APICALL IsThreadSafe() const { + return mRawPtr->isThreadSafe() != 0; + } + + virtual uint32 APICALL isThreadSafe( ) const __NOTHROW__ { + assert( false ); + return mRawPtr->isThreadSafe(); + } + + virtual AdobeXMPCommon_Int::pIThreadSafe_I APICALL GetIThreadSafe_I() __NOTHROW__ override { + return mRawPtr->GetIThreadSafe_I(); + } + + }; + + spINameSpacePrefixMap INameSpacePrefixMap_v1::MakeShared( pINameSpacePrefixMap_base ptr ) { + if ( !ptr ) return spINameSpacePrefixMap(); + pINameSpacePrefixMap p = INameSpacePrefixMap::GetInterfaceVersion() > 1 ? + ptr->GetInterfacePointer< INameSpacePrefixMap >() : ptr; + return shared_ptr< INameSpacePrefixMap >( new INameSpacePrefixMapProxy( p ) ); + } + + spINameSpacePrefixMap INameSpacePrefixMap_v1::CreateNameSpacePrefixMap() { + return CallSafeFunctionReturningPointer< ICoreObjectFactory, pINameSpacePrefixMap_base, INameSpacePrefixMap >( + ICoreObjectFactory::GetCoreObjectFactory(), &ICoreObjectFactory::CreateNameSpacePrefixMap ); + } + + spcINameSpacePrefixMap INameSpacePrefixMap_v1::GetDefaultNameSpacePrefixMap() { + return CallSafeFunctionReturningPointer< ICoreObjectFactory, pcINameSpacePrefixMap_base, const INameSpacePrefixMap >( + ICoreObjectFactory::GetCoreObjectFactory(), &ICoreObjectFactory::GetDefaultNameSpacePrefixMap ); + } + +} + +#endif // BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB diff --git a/public/include/XMPCore/source/INode.cpp b/public/include/XMPCore/source/INode.cpp new file mode 100644 index 0000000..9d0126c --- /dev/null +++ b/public/include/XMPCore/source/INode.cpp @@ -0,0 +1,377 @@ +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +namespace AdobeXMPCore { + class INodeProxy; +} + +#define FRIEND_CLASS_DECLARATION() friend class AdobeXMPCore::INodeProxy; + +#include "XMPCore/Interfaces/INode.h" + +#if !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB + +#include "XMPCommon/Utilities/TWrapperFunctions.h" +#include "XMPCommon/Interfaces/IUTF8String.h" +#include "XMPCore/Interfaces/IPath.h" +#include "XMPCore/Interfaces/ISimpleNode.h" +#include "XMPCore/Interfaces/INodeIterator.h" +#include "XMPCore/Interfaces/IArrayNode.h" +#include "XMPCore/Interfaces/IMetadata.h" + +#include <assert.h> + +namespace AdobeXMPCore { + + INodeProxy::INodeProxy( pINode ptr ) : mRawPtr( ptr ) { + mRawPtr->Acquire(); + } + + INodeProxy::~INodeProxy() __NOTHROW__ { + mRawPtr->Release(); + } + + pINode APICALL INodeProxy::GetActualINode() __NOTHROW__ { + return mRawPtr; + } + + void APICALL INodeProxy::Acquire() const __NOTHROW__ { + assert( false ); + } + + void APICALL INodeProxy::Release() const __NOTHROW__ { + assert( false ); + } + + AdobeXMPCommon_Int::pISharedObject_I APICALL INodeProxy::GetISharedObject_I() __NOTHROW__ { + return mRawPtr->GetISharedObject_I(); + } + + AdobeXMPCore_Int::pINode_I APICALL INodeProxy::GetINode_I() __NOTHROW__ { + return mRawPtr->GetINode_I(); + } + + pvoid APICALL INodeProxy::getInterfacePointer( uint64 interfaceID, uint32 interfaceVersion, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->getInterfacePointer( interfaceID, interfaceVersion, error ); + } + + spINode APICALL INodeProxy::GetParent() { + return CallSafeFunctionReturningPointer< INode_v1, pINode_base, INode >( + mRawPtr, &INode_v1::getParent ); + } + + void APICALL INodeProxy::SetName( const char * name, sizet nameLength ) { + return CallSafeFunctionReturningVoid< INode_v1, const char *, sizet >( + mRawPtr, &INode_v1::setName, name, nameLength ); + } + + spcIUTF8String APICALL INodeProxy::GetName() const { + return CallConstSafeFunctionReturningPointer< INode_v1, pcIUTF8String_base, const IUTF8String >( + mRawPtr, &INode_v1::getName ); + } + + void APICALL INodeProxy::SetNameSpace( const char * nameSpace, sizet nameSpaceLength ) { + return CallSafeFunctionReturningVoid< INode_v1, const char *, sizet >( + mRawPtr, &INode_v1::setNameSpace, nameSpace, nameSpaceLength ); + + } + + spcIUTF8String APICALL INodeProxy::GetNameSpace() const { + return CallConstSafeFunctionReturningPointer< INode_v1, pcIUTF8String_base, const IUTF8String >( + mRawPtr, &INode_v1::getNameSpace ); + } + + spIPath APICALL INodeProxy::GetPath() const { + return CallConstSafeFunctionReturningPointer< INode_v1, pIPath_base, IPath >( + mRawPtr, &INode_v1::getPath ); + } + + sizet APICALL INodeProxy::QualifiersCount() const __NOTHROW__ { + return mRawPtr->QualifiersCount(); + } + + spINodeIterator APICALL INodeProxy::QualifiersIterator() { + return CallSafeFunctionReturningPointer< INode_v1, pINodeIterator_base, INodeIterator >( + mRawPtr, &INode_v1::qualifiersIterator ); + } + + spINode APICALL INodeProxy::GetQualifier( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) { + return CallSafeFunctionReturningPointer< INode_v1, pINode_base, INode, const char *, sizet, const char *, sizet >( + mRawPtr, &INode_v1::getQualifier, nameSpace, nameSpaceLength, name, nameLength ); + } + + void APICALL INodeProxy::InsertQualifier( const spINode & node ) { + return CallSafeFunctionReturningVoid< INode_v1, pINode_base >( + mRawPtr, &INode_v1::insertQualifier, node ? node->GetActualINode() : NULL ); + } + + spINode APICALL INodeProxy::ReplaceQualifier( const spINode & node ) { + return CallSafeFunctionReturningPointer< INode_v1, pINode_base, INode, pINode_base >( + mRawPtr, &INode_v1::replaceQualifier, node ? node->GetActualINode() : NULL ); + } + + spINode APICALL INodeProxy::RemoveQualifier( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) { + return CallSafeFunctionReturningPointer< INode_v1, pINode_base, INode, const char *, sizet, const char *, sizet >( + mRawPtr, &INode_v1::removeQualifier, nameSpace, nameSpaceLength, name, nameLength ); + } + + INode_v1::eNodeType APICALL INodeProxy::GetNodeType() const { + return CallConstSafeFunction< INode_v1, eNodeType, uint32 >( + mRawPtr, &INode_v1::getNodeType ); + } + + bool APICALL INodeProxy::IsArrayItem() const { + return CallConstSafeFunction< INode_v1, bool, uint32 >( + mRawPtr, &INode_v1::isArrayItem ); + } + + bool APICALL INodeProxy::IsQualifierNode() const { + return CallConstSafeFunction< INode_v1, bool, uint32 >( + mRawPtr, &INode_v1::isQualifierNode ); + } + + sizet APICALL INodeProxy::GetIndex() const { + return CallConstSafeFunction< INode_v1, sizet, sizet >( + mRawPtr, &INode_v1::getIndex ); + } + + bool APICALL INodeProxy::HasQualifiers() const { + return CallConstSafeFunction< INode_v1, bool, uint32 >( + mRawPtr, &INode_v1::hasQualifiers ); + } + + bool APICALL INodeProxy::HasContent() const { + return CallConstSafeFunction< INode_v1, bool, uint32 >( + mRawPtr, &INode_v1::hasContent ); + } + + bool APICALL INodeProxy::IsEmpty() const { + return CallConstSafeFunction< INode_v1, bool, uint32 >( + mRawPtr, &INode_v1::isEmpty ); + } + + bool APICALL INodeProxy::HasChanged() const { + return CallConstSafeFunction< INode_v1, bool, uint32 >( + mRawPtr, &INode_v1::hasChanged ); + } + + void APICALL INodeProxy::AcknowledgeChanges() const __NOTHROW__ { + return mRawPtr->AcknowledgeChanges( ); + } + + void APICALL INodeProxy::Clear( bool contents, bool qualifiers ) { + return CallSafeFunctionReturningVoid< INode_v1, uint32, uint32 >( + mRawPtr, &INode_v1::clear, static_cast< uint32 >( contents ), static_cast< uint32 >( qualifiers ) ); + } + + spINode APICALL INodeProxy::Clone( bool ignoreEmptyNodes, bool ignoreNodesWithOnlyQualifiers ) const { + return CallConstSafeFunctionReturningPointer< INode_v1, pINode_base, INode, uint32, uint32 >( + mRawPtr, &INode_v1::clone, static_cast< uint32 >( ignoreEmptyNodes ), static_cast< uint32 >( ignoreNodesWithOnlyQualifiers ) ); + } + + pINode_base APICALL INodeProxy::getParent( pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->getParent( error ); + } + + void APICALL INodeProxy::setName( const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->setName( name, nameLength, error ); + } + + AdobeXMPCommon::pcIUTF8String_base APICALL INodeProxy::getName( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getName( error ); + } + + void APICALL INodeProxy::setNameSpace( const char * nameSpace, sizet nameSpaceLength, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->setNameSpace( nameSpace, nameSpaceLength, error ); + } + + pcIUTF8String_base APICALL INodeProxy::getNameSpace( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getNameSpace( error ); + } + + pIPath_base APICALL INodeProxy::getPath( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getPath( error ); + } + + pINodeIterator_base APICALL INodeProxy::qualifiersIterator( pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->qualifiersIterator( error ); + } + + pINode_base APICALL INodeProxy::getQualifier( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->getQualifier( nameSpace, nameSpaceLength, name, nameLength, error ); + } + + void APICALL INodeProxy::insertQualifier( pINode_base base, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->insertQualifier( base, error ); + } + + pINode_base APICALL INodeProxy::replaceQualifier( pINode_base node, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->replaceQualifier( node, error ); + } + + pINode_base APICALL INodeProxy::removeQualifier( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->removeQualifier( nameSpace, nameSpaceLength, name, nameLength, error ); + } + + uint32 APICALL INodeProxy::getNodeType( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getNodeType( error ); + } + + uint32 APICALL INodeProxy::isArrayItem( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->isArrayItem( error ); + } + + uint32 APICALL INodeProxy::isQualifierNode( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->isQualifierNode( error ); + } + + sizet APICALL INodeProxy::getIndex( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getIndex( error ); + } + + uint32 APICALL INodeProxy::hasQualifiers( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->hasQualifiers( error ); + } + + uint32 APICALL INodeProxy::hasContent( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->hasContent( error ); + } + + uint32 APICALL INodeProxy::isEmpty( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->isEmpty( error ); + } + + uint32 APICALL INodeProxy::hasChanged( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->hasChanged( error ); + } + + void APICALL INodeProxy::clear( uint32 contents, uint32 qualifiers, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->clear( contents, qualifiers, error ); + } + + pINode_base APICALL INodeProxy::clone( uint32 igoreEmptyNodes, uint32 ignoreNodesWithOnlyQualifiers, pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->clone( igoreEmptyNodes, ignoreNodesWithOnlyQualifiers, error ); + } + + void APICALL INodeProxy::EnableThreadSafety() const __NOTHROW__ { + return mRawPtr->EnableThreadSafety( ); + } + + void APICALL INodeProxy::DisableThreadSafety() const __NOTHROW__ { + return mRawPtr->DisableThreadSafety( ); + } + + bool APICALL INodeProxy::IsThreadSafe() const { + return mRawPtr->isThreadSafe() != 0; + } + + uint32 APICALL INodeProxy::isThreadSafe() const __NOTHROW__ { + assert( false ); + return mRawPtr->isThreadSafe(); + } + + spISimpleNode APICALL INodeProxy::ConvertToSimpleNode() { + return CallSafeFunctionReturningPointer< INode_v1, pISimpleNode_base, ISimpleNode >( + mRawPtr, &INode_v1::convertToSimpleNode ); + } + + spIStructureNode APICALL INodeProxy::ConvertToStructureNode() { + return CallSafeFunctionReturningPointer< INode_v1, pIStructureNode_base, IStructureNode >( + mRawPtr, &INode_v1::convertToStructureNode ); + } + + spIArrayNode APICALL INodeProxy::ConvertToArrayNode() { + return CallSafeFunctionReturningPointer< INode_v1, pIArrayNode_base, IArrayNode >( + mRawPtr, &INode_v1::convertToArrayNode ); + } + + spIMetadata APICALL INodeProxy::ConvertToMetadata() { + return CallSafeFunctionReturningPointer< INode_v1, pIMetadata_base, IMetadata >( + mRawPtr, &INode_v1::convertToMetadata ); + } + + pISimpleNode_base APICALL INodeProxy::convertToSimpleNode( pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->convertToSimpleNode( error ); + } + + pIStructureNode_base APICALL INodeProxy::convertToStructureNode( pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->convertToStructureNode( error ); } + + pIArrayNode_base APICALL INodeProxy::convertToArrayNode( pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->convertToArrayNode( error ); + } + + pIMetadata_base APICALL INodeProxy::convertToMetadata( pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->convertToMetadata( error ); + } + + uint32 APICALL INodeProxy::getParentNodeType( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getParentNodeType( error ); + } + + uint32 APICALL INodeProxy::getQualifierNodeType( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getQualifierNodeType( nameSpace, nameSpaceLength, name, nameLength, error ); + } + + INode_v1::eNodeType APICALL INodeProxy::GetParentNodeType() const { + return CallConstSafeFunction< INode_v1, eNodeType, uint32 >( + mRawPtr, &INode_v1::getParentNodeType ); + } + + INode_v1::eNodeType APICALL INodeProxy::GetQualifierNodeType( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) const { + return CallConstSafeFunction< INode_v1, eNodeType, uint32, const char *, sizet, const char *, sizet >( + mRawPtr, &INode_v1::getQualifierNodeType, nameSpace, nameSpaceLength, name, nameLength ); + } + + AdobeXMPCommon_Int::pIThreadSafe_I APICALL INodeProxy::GetIThreadSafe_I() __NOTHROW__ { + return mRawPtr->GetIThreadSafe_I( ); + } + + pvoid APICALL INodeProxy::GetInterfacePointer( uint64 interfaceID, uint32 interfaceVersion ) { + return CallSafeFunction< IVersionable, pvoid, pvoid, uint64, uint32 >( + mRawPtr, &IVersionable::getInterfacePointer, interfaceID, interfaceVersion ); + } + + spINode INode_v1::MakeShared( pINode_base ptr ) { + if ( !ptr ) return spINode(); + pINode p = INode::GetInterfaceVersion() > 1 ? ptr->GetInterfacePointer< INode >() : ptr; + return shared_ptr< INode >( new INodeProxy( p ) ); + } + +} + +#endif // !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB diff --git a/public/include/XMPCore/source/INodeIterator.cpp b/public/include/XMPCore/source/INodeIterator.cpp new file mode 100644 index 0000000..f2f43a3 --- /dev/null +++ b/public/include/XMPCore/source/INodeIterator.cpp @@ -0,0 +1,105 @@ +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +namespace AdobeXMPCore { + class INodeIteratorProxy; +} + +#define FRIEND_CLASS_DECLARATION() friend class AdobeXMPCore::INodeIteratorProxy; + +#include "XMPCore/Interfaces/INodeIterator.h" + +#if !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB + +#include "XMPCommon/Utilities/TWrapperFunctions.h" +#include <assert.h> + +namespace AdobeXMPCore { + + class INodeIteratorProxy + : public virtual INodeIterator + { + private: + pINodeIterator mRawPtr; + + public: + INodeIteratorProxy( pINodeIterator ptr ) + : mRawPtr( ptr ) + { + mRawPtr->Acquire(); + } + + ~INodeIteratorProxy() __NOTHROW__ { mRawPtr->Release(); } + + pINodeIterator APICALL GetActualINodeIterator() __NOTHROW__ { return mRawPtr; } + + void APICALL Acquire() const __NOTHROW__ { assert( false ); } + + void APICALL Release() const __NOTHROW__ { assert( false ); } + + AdobeXMPCommon_Int::pISharedObject_I APICALL GetISharedObject_I() __NOTHROW__ { + return mRawPtr->GetISharedObject_I(); + } + + AdobeXMPCore_Int::pINodeIterator_I APICALL GetINodeIterator_I() __NOTHROW__ { + return mRawPtr->GetINodeIterator_I(); + } + + pvoid APICALL getInterfacePointer( uint64 interfaceID, uint32 interfaceVersion, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->getInterfacePointer( interfaceID, interfaceVersion, error ); + } + + virtual spINode APICALL GetNode() { + return CallSafeFunctionReturningPointer< INodeIterator_v1, pINode_base, INode >( + mRawPtr, &INodeIterator_v1::getNode ); + } + + virtual INode_v1::eNodeType APICALL GetNodeType() const { + return CallConstSafeFunction< INodeIterator_v1, INode_v1::eNodeType, uint32 >( + mRawPtr, &INodeIterator_v1::getNodeType ); + } + + virtual spINodeIterator APICALL Next() { + return CallSafeFunctionReturningPointer< INodeIterator_v1, pINodeIterator, INodeIterator >( + mRawPtr, &INodeIterator_v1::next ); + } + + virtual uint32 APICALL getNodeType( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getNodeType( error ); + } + + virtual pINode_base APICALL getNode( pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->getNode( error ); + } + + virtual pINodeIterator_base APICALL next( pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->next( error ); + } + + pvoid APICALL GetInterfacePointer( uint64 interfaceID, uint32 interfaceVersion ) { + return CallSafeFunction< IVersionable, pvoid, pvoid, uint64, uint32 >( + mRawPtr, &IVersionable::getInterfacePointer, interfaceID, interfaceVersion ); + } + + }; + + spINodeIterator INodeIterator_v1::MakeShared( pINodeIterator_base ptr ) { + if ( !ptr ) return spINodeIterator(); + //return shared_ptr< INodeIterator >( new INodeIteratorProxy( ptr ) ); + pINodeIterator p = INodeIterator::GetInterfaceVersion() > 1 ? ptr->GetInterfacePointer< INodeIterator >() : ptr; + return shared_ptr< INodeIterator >( new INodeIteratorProxy( p ) ); + } + +} + +#endif // BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB diff --git a/public/include/XMPCore/source/IPath.cpp b/public/include/XMPCore/source/IPath.cpp new file mode 100644 index 0000000..f0b99c3 --- /dev/null +++ b/public/include/XMPCore/source/IPath.cpp @@ -0,0 +1,157 @@ +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +namespace AdobeXMPCore { + class IPathProxy; +} + +#define FRIEND_CLASS_DECLARATION() friend class AdobeXMPCore::IPathProxy; + +#include "XMPCore/Interfaces/IPath.h" + +#if !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB + +#include "XMPCommon/Utilities/TWrapperFunctions.h" +#include "XMPCore/Interfaces/INameSpacePrefixMap.h" +#include "XMPCommon/Interfaces/IUTF8String.h" +#include "XMPCore/Interfaces/IPathSegment.h" +#include "XMPCore/Interfaces/ICoreObjectFactory.h" + +#include <assert.h> + +namespace AdobeXMPCore { + + class IPathProxy + : public virtual IPath + { + private: + pIPath mRawPtr; + + public: + IPathProxy( pIPath ptr ) + : mRawPtr( ptr ) + { + mRawPtr->Acquire(); + } + + ~IPathProxy() __NOTHROW__ { mRawPtr->Release(); } + + pIPath APICALL GetActualIPath() __NOTHROW__ { return mRawPtr; } + + void APICALL Acquire() const __NOTHROW__ { assert( false ); } + + void APICALL Release() const __NOTHROW__ { assert( false ); } + + AdobeXMPCommon_Int::pISharedObject_I APICALL GetISharedObject_I() __NOTHROW__ { + return mRawPtr->GetISharedObject_I(); + } + + AdobeXMPCore_Int::pIPath_I APICALL GetIPath_I() __NOTHROW__ { + return mRawPtr->GetIPath_I(); + } + + pvoid APICALL GetInterfacePointer( uint64 interfaceID, uint32 interfaceVersion ) { + return CallSafeFunction< IVersionable, pvoid, pvoid, uint64, uint32 >( + mRawPtr, &IVersionable::getInterfacePointer, interfaceID, interfaceVersion ); + } + + pvoid APICALL getInterfacePointer( uint64 interfaceID, uint32 interfaceVersion, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->getInterfacePointer( interfaceID, interfaceVersion, error ); + } + + virtual spcINameSpacePrefixMap APICALL RegisterNameSpacePrefixMap( const spcINameSpacePrefixMap & map ) { + return CallSafeFunctionReturningPointer< IPath_v1, pcINameSpacePrefixMap_base, const INameSpacePrefixMap, pcINameSpacePrefixMap_base >( + mRawPtr, &IPath_v1::registerNameSpacePrefixMap, map ? map->GetActualINameSpacePrefixMap() : NULL ); + } + + virtual pcINameSpacePrefixMap_base APICALL registerNameSpacePrefixMap( pcINameSpacePrefixMap_base map, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->registerNameSpacePrefixMap( map, error ); + } + + virtual spIUTF8String APICALL Serialize( const spcINameSpacePrefixMap & map ) const { + return CallConstSafeFunctionReturningPointer< IPath_v1, pIUTF8String_base, IUTF8String, pcINameSpacePrefixMap_base >( + mRawPtr, &IPath_v1::serialize, map ? map->GetActualINameSpacePrefixMap() : NULL ); + } + + virtual pIUTF8String_base APICALL serialize( pcINameSpacePrefixMap_base map, pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->serialize( map, error ); + } + + virtual void APICALL AppendPathSegment( const spcIPathSegment & segment ) { + return CallSafeFunctionReturningVoid< IPath_v1, pcIPathSegment_base >( + mRawPtr, &IPath_v1::appendPathSegment, segment ? segment->GetActualIPathSegment() : NULL ); + } + + virtual void APICALL appendPathSegment( pcIPathSegment_base segment, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->appendPathSegment( segment, error ); + } + + virtual spcIPathSegment APICALL RemovePathSegment( sizet index ) { + return CallSafeFunctionReturningPointer< IPath_v1, pcIPathSegment_base, const IPathSegment, sizet >( + mRawPtr, &IPath_v1::removePathSegment, index ); + } + + virtual pcIPathSegment_base APICALL removePathSegment( sizet index, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->removePathSegment( index, error ); + } + + virtual spcIPathSegment APICALL GetPathSegment( sizet index ) const { + return CallConstSafeFunctionReturningPointer< IPath_v1, pcIPathSegment_base, const IPathSegment, sizet >( + mRawPtr, &IPath_v1::getPathSegment, index ); + } + + virtual pcIPathSegment_base APICALL getPathSegment( sizet index, pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getPathSegment( index, error ); + } + + virtual sizet APICALL Size() const __NOTHROW__ { + return mRawPtr->Size( ); + } + + virtual void APICALL Clear() __NOTHROW__ { + return mRawPtr->Clear( ); + } + + virtual spIPath APICALL Clone( sizet startingIndex, sizet countOfSegments ) const { + return CallConstSafeFunctionReturningPointer< IPath_v1, pIPath_base, IPath, sizet, sizet >( + mRawPtr, &IPath_v1::clone, startingIndex, countOfSegments ); + } + + virtual pIPath_base APICALL clone( sizet startingIndex, sizet countOfSegemetns, pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->clone( startingIndex, countOfSegemetns, error ); + } + + }; + + spIPath IPath_v1::MakeShared( pIPath_base ptr ) { + if ( !ptr ) return spIPath(); + pIPath p = IPath::GetInterfaceVersion() > 1 ? ptr->GetInterfacePointer< IPath >() : ptr; + return shared_ptr< IPath >( new IPathProxy( p ) ); + } + + spIPath IPath_v1::CreatePath() { + return CallSafeFunctionReturningPointer< ICoreObjectFactory, pIPath_base, IPath >( + ICoreObjectFactory::GetCoreObjectFactory(), &ICoreObjectFactory::CreatePath ); + } + + spIPath IPath_v1::ParsePath( const char * path, sizet pathLength, const spcINameSpacePrefixMap & map ) { + return CallSafeFunctionReturningPointer< ICoreObjectFactory, pIPath_base, IPath, const char *, sizet, pcINameSpacePrefixMap_base >( + ICoreObjectFactory::GetCoreObjectFactory(), &ICoreObjectFactory::ParsePath, path, pathLength, map ? map->GetActualINameSpacePrefixMap() : NULL ); + } + +} + +#endif // BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB diff --git a/public/include/XMPCore/source/IPathSegment.cpp b/public/include/XMPCore/source/IPathSegment.cpp new file mode 100644 index 0000000..4228492 --- /dev/null +++ b/public/include/XMPCore/source/IPathSegment.cpp @@ -0,0 +1,146 @@ +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +namespace AdobeXMPCore { + class IPathSegmentProxy; +} + +#define FRIEND_CLASS_DECLARATION() friend class AdobeXMPCore::IPathSegmentProxy; + +#include "XMPCore/Interfaces/IPathSegment.h" + +#if !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB + +#include "XMPCommon/Utilities/TWrapperFunctions.h" +#include "XMPCommon/Interfaces/IUTF8String.h" +#include "XMPCommon/Interfaces/IError.h" +#include "XMPCore/Interfaces/ICoreObjectFactory.h" + +#include <assert.h> + +namespace AdobeXMPCore { + + class IPathSegmentProxy + : public virtual IPathSegment + { + private: + pIPathSegment mRawPtr; + + public: + IPathSegmentProxy( pIPathSegment ptr ) + : mRawPtr( ptr ) + { + mRawPtr->Acquire(); + } + + ~IPathSegmentProxy() __NOTHROW__ { mRawPtr->Release(); } + + pIPathSegment APICALL GetActualIPathSegment() __NOTHROW__ { return mRawPtr; } + + void APICALL Acquire() const __NOTHROW__ { assert( false ); } + + void APICALL Release() const __NOTHROW__ { assert( false ); } + + AdobeXMPCommon_Int::pISharedObject_I APICALL GetISharedObject_I() __NOTHROW__ { + return mRawPtr->GetISharedObject_I(); + } + + AdobeXMPCore_Int::pIPathSegment_I APICALL GetIPathSegment_I() __NOTHROW__ { + return mRawPtr->GetIPathSegment_I(); + } + + pvoid APICALL GetInterfacePointer( uint64 interfaceID, uint32 interfaceVersion ) { + return CallSafeFunction< IVersionable, pvoid, pvoid, uint64, uint32 >( + mRawPtr, &IVersionable::getInterfacePointer, interfaceID, interfaceVersion ); + } + + pvoid APICALL getInterfacePointer( uint64 interfaceID, uint32 interfaceVersion, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->getInterfacePointer( interfaceID, interfaceVersion, error ); + } + + virtual spcIUTF8String APICALL GetNameSpace() const { + return CallConstSafeFunctionReturningPointer< IPathSegment_v1, pcIUTF8String_base, const IUTF8String >( + mRawPtr, &IPathSegment_v1::getNameSpace ); + } + + virtual pcIUTF8String_base APICALL getNameSpace( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getNameSpace( error ); + } + + virtual spcIUTF8String APICALL GetName() const { + return CallConstSafeFunctionReturningPointer< IPathSegment_v1, pcIUTF8String_base, const IUTF8String >( + mRawPtr, &IPathSegment_v1::getName ); + } + + virtual pcIUTF8String_base APICALL getName( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getName( error ); + } + + virtual ePathSegmentType APICALL GetType() const { + return CallConstSafeFunction< IPathSegment_v1, ePathSegmentType, uint32 >( + mRawPtr, &IPathSegment_v1::getType ); + } + + virtual uint32 APICALL getType( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getType( error ); + } + + virtual sizet APICALL GetIndex() const __NOTHROW__ { + return mRawPtr->GetIndex(); + } + + virtual spcIUTF8String APICALL GetValue() const { + return CallConstSafeFunctionReturningPointer< IPathSegment_v1, pcIUTF8String_base, const IUTF8String >( + mRawPtr, &IPathSegment_v1::getValue ); + } + + virtual pcIUTF8String_base APICALL getValue( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getValue( error ); + } + + }; + + spIPathSegment IPathSegment_v1::MakeShared( pIPathSegment_base ptr ) { + if ( !ptr ) return spIPathSegment(); + pIPathSegment p = IPathSegment::GetInterfaceVersion() > 1 ? + ptr->GetInterfacePointer< IPathSegment >() : ptr; + return shared_ptr< IPathSegment >( new IPathSegmentProxy( p ) ); + } + + spcIPathSegment IPathSegment_v1::CreatePropertyPathSegment( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) { + return CallSafeFunctionReturningPointer< ICoreObjectFactory, pcIPathSegment_base, const IPathSegment, const char *, sizet, const char *, sizet >( + ICoreObjectFactory::GetCoreObjectFactory(), &ICoreObjectFactory::CreatePropertyPathSegment, nameSpace, nameSpaceLength, name, nameLength ); + } + + spcIPathSegment IPathSegment_v1::CreateArrayIndexPathSegment( const char * nameSpace, sizet nameSpaceLength, sizet index ) { + return CallSafeFunctionReturningPointer< ICoreObjectFactory, pcIPathSegment_base, const IPathSegment, const char *, sizet, sizet >( + ICoreObjectFactory::GetCoreObjectFactory(), &ICoreObjectFactory::CreateArrayIndexPathSegment, nameSpace, nameSpaceLength, index ); + } + + spcIPathSegment IPathSegment_v1::CreateQualifierPathSegment( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) { + return CallSafeFunctionReturningPointer< ICoreObjectFactory, pcIPathSegment_base, const IPathSegment, const char *, sizet, const char *, sizet >( + ICoreObjectFactory::GetCoreObjectFactory(), &ICoreObjectFactory::CreateQualifierPathSegment, nameSpace, nameSpaceLength, name, nameLength ); + } + + spcIPathSegment IPathSegment_v1::CreateQualifierSelectorPathSegment( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, + const char * value, sizet valueLength ) + { + return CallSafeFunctionReturningPointer< ICoreObjectFactory, pcIPathSegment_base, const IPathSegment, const char *, sizet, const char *, sizet, const char *, sizet >( + ICoreObjectFactory::GetCoreObjectFactory(), &ICoreObjectFactory::CreateQualifierSelectorPathSegment, nameSpace, nameSpaceLength, name, nameLength, value, valueLength ); + } + +} + +#endif // BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB + diff --git a/public/include/XMPCore/source/ISimpleNode.cpp b/public/include/XMPCore/source/ISimpleNode.cpp new file mode 100644 index 0000000..170192f --- /dev/null +++ b/public/include/XMPCore/source/ISimpleNode.cpp @@ -0,0 +1,111 @@ +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +namespace AdobeXMPCore { + class ISimpleNodeProxy; +} + +#define FRIEND_CLASS_DECLARATION() friend class AdobeXMPCore::ISimpleNodeProxy; + +#include "XMPCore/Interfaces/ISimpleNode.h" + +#if !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB + +#include "XMPCommon/Utilities/TWrapperFunctions.h" +#include "XMPCommon/Interfaces/IUTF8String.h" +#include "XMPCore/Interfaces/ICoreObjectFactory.h" + +#include <assert.h> + +namespace AdobeXMPCore { + +#if XMP_WinBuild + #pragma warning( push ) + #pragma warning( disable : 4250 ) +#endif + + class ISimpleNodeProxy + : public virtual ISimpleNode + , public virtual INodeProxy + { + private: + pISimpleNode mRawPtr; + + public: + ISimpleNodeProxy( pISimpleNode ptr ) + : mRawPtr( ptr ) + , INodeProxy( ptr ) {} + + ~ISimpleNodeProxy() __NOTHROW__ {} + + pISimpleNode APICALL GetActualISimpleNode() __NOTHROW__ { return mRawPtr; } + + AdobeXMPCore_Int::pISimpleNode_I APICALL GetISimpleNode_I() __NOTHROW__ { + return mRawPtr->GetISimpleNode_I(); + } + + virtual spcIUTF8String APICALL GetValue() const { + return CallConstSafeFunctionReturningPointer< ISimpleNode_v1, pcIUTF8String_base, const IUTF8String >( + mRawPtr, &ISimpleNode_v1::getValue ); + } + + virtual void APICALL SetValue( const char * value, sizet valueLength ) { + return CallSafeFunctionReturningVoid< ISimpleNode_v1, const char *, sizet >( + mRawPtr, &ISimpleNode_v1::setValue, value, valueLength ); + } + + virtual bool APICALL IsURIType() const { + return CallConstSafeFunction< ISimpleNode_v1, bool, uint32 >( + mRawPtr, &ISimpleNode_v1::isURIType ); + } + + virtual void APICALL SetURIType( bool isURI ) { + return CallSafeFunctionReturningVoid< ISimpleNode_v1, uint32 >( + mRawPtr, &ISimpleNode_v1::setURIType, isURI ? 1 : 0 ); + } + + virtual pcIUTF8String_base APICALL getValue( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getValue( error ); + } + + virtual void APICALL setValue( const char * value, sizet valueLength, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->setValue( value, valueLength, error ); + } + + virtual uint32 APICALL isURIType( pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->isURIType( error ); + } + + virtual void APICALL setURIType( uint32 isURI, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->setURIType( isURI, error ); + } + + }; + + spISimpleNode ISimpleNode_v1::CreateSimpleNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, const char * value, sizet valueLength ) { + return CallSafeFunctionReturningPointer< ICoreObjectFactory, pISimpleNode_base, ISimpleNode, const char *, sizet, const char *, sizet, const char *, sizet >( + ICoreObjectFactory::GetCoreObjectFactory(), &ICoreObjectFactory::CreateSimpleNode, nameSpace, nameSpaceLength, name, nameLength, value, valueLength ); + } + + spISimpleNode ISimpleNode_v1::MakeShared( pISimpleNode_base ptr ) { + if ( !ptr ) return spISimpleNode(); + pISimpleNode p = ISimpleNode::GetInterfaceVersion() > 1 ? ptr->GetInterfacePointer< ISimpleNode >() : ptr; + return shared_ptr< ISimpleNode >( new ISimpleNodeProxy( p ) ); + } + +#if XMP_WinBuild + #pragma warning( pop ) +#endif +} + +#endif // !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB diff --git a/public/include/XMPCore/source/IStructureNode.cpp b/public/include/XMPCore/source/IStructureNode.cpp new file mode 100644 index 0000000..32aa76d --- /dev/null +++ b/public/include/XMPCore/source/IStructureNode.cpp @@ -0,0 +1,104 @@ +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +namespace AdobeXMPCore { + class IStructureNodeProxy; +} + +#define FRIEND_CLASS_DECLARATION() friend class AdobeXMPCore::IStructureNodeProxy; + +#include "XMPCore/Interfaces/IStructureNode.h" + +#if !BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB + +#include "XMPCommon/Utilities/TWrapperFunctions.h" +#include "XMPCore/Interfaces/ICoreObjectFactory.h" +#include <assert.h> + +namespace AdobeXMPCore { + + + IStructureNodeProxy::IStructureNodeProxy( pIStructureNode ptr ) : mRawPtr( ptr ) + , ICompositeNodeProxy( ptr ) + , INodeProxy( ptr ) { } + + IStructureNodeProxy::~IStructureNodeProxy() __NOTHROW__ { } + + AdobeXMPCore_Int::pIStructureNode_I APICALL IStructureNodeProxy::GetIStructureNode_I() __NOTHROW__ { + return mRawPtr->GetIStructureNode_I(); + } + + INode_v1::eNodeType APICALL IStructureNodeProxy::GetChildNodeType( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) const { + return CallConstSafeFunction< IStructureNode_v1, eNodeType, uint32, const char *, sizet, const char *, sizet >( + mRawPtr, &IStructureNode_v1::getChildNodeType, nameSpace, nameSpaceLength, name, nameLength ); + } + + spINode APICALL IStructureNodeProxy::GetNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) { + return CallSafeFunctionReturningPointer< IStructureNode_v1, pINode_base, INode, const char *, sizet, const char *, sizet >( + mRawPtr, &IStructureNode_v1::getNode, nameSpace, nameSpaceLength, name, nameLength ); + } + + void APICALL IStructureNodeProxy::InsertNode( const spINode & node ) { + return CallSafeFunctionReturningVoid< IStructureNode_v1, pINode_base >( + mRawPtr, &IStructureNode_v1::insertNode, node ? node->GetActualINode() : NULL ); + } + + spINode APICALL IStructureNodeProxy::ReplaceNode( const spINode & node ) { + return CallSafeFunctionReturningPointer< IStructureNode_v1, pINode_base, INode, pINode_base >( + mRawPtr, &IStructureNode_v1::replaceNode, node ? node->GetActualINode() : NULL ); + } + + spINode APICALL IStructureNodeProxy::RemoveNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) { + return CallSafeFunctionReturningPointer< IStructureNode_v1, pINode_base, INode, const char *, sizet, const char *, sizet >( + mRawPtr, &IStructureNode_v1::removeNode, nameSpace, nameSpaceLength, name, nameLength ); + } + + uint32 APICALL IStructureNodeProxy::getChildNodeType( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) const __NOTHROW__ { + assert( false ); + return mRawPtr->getChildNodeType( nameSpace, nameSpaceLength, name, nameLength, error ); + } + + pINode_base APICALL IStructureNodeProxy::getNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->getNode( nameSpace, nameSpaceLength, name, nameLength, error ); + } + + void APICALL IStructureNodeProxy::insertNode( pINode_base node, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->insertNode( node, error ); + } + + pINode_base APICALL IStructureNodeProxy::replaceNode( pINode_base node, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->replaceNode( node, error ); + } + + pINode_base APICALL IStructureNodeProxy::removeNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength, pcIError_base & error ) __NOTHROW__ { + assert( false ); + return mRawPtr->removeNode( nameSpace, nameSpaceLength, name, nameLength, error ); + } + + pIStructureNode APICALL IStructureNodeProxy::GetActualIStructureNode() __NOTHROW__ { + return mRawPtr; + } + + spIStructureNode IStructureNode_v1::MakeShared( pIStructureNode_base ptr ) { + if ( !ptr ) return spIStructureNode(); + pIStructureNode p = IStructureNode::GetInterfaceVersion() > 1 ? ptr->GetInterfacePointer< IStructureNode >() : ptr; + return shared_ptr< IStructureNode >( new IStructureNodeProxy( p ) ); + } + + spIStructureNode IStructureNode_v1::CreateStructureNode( const char * nameSpace, sizet nameSpaceLength, const char * name, sizet nameLength ) { + return CallSafeFunctionReturningPointer< ICoreObjectFactory, pIStructureNode_base, IStructureNode, const char *, sizet, const char *, sizet >( + ICoreObjectFactory::GetCoreObjectFactory(), &ICoreObjectFactory::CreateStructureNode, nameSpace, nameSpaceLength, name, nameLength ); + } + +} + +#endif // BUILDING_XMPCORE_LIB && !SOURCE_COMPILING_XMPCORE_LIB |