summaryrefslogtreecommitdiff
path: root/public/include/XMPCore/Interfaces/ICoreObjectFactory.h
blob: 234a6856ed52cba5b8d1e3df467131711ed9edf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
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__