1 // =================================================================================================
2 // Copyright 2002-2008 Adobe Systems Incorporated
3 // All Rights Reserved.
4 //
5 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
6 // of the Adobe license agreement accompanying it.
7 // =================================================================================================
8
9 #include "XMP_Environment.h" // ! This must be the first include!
10 #include "XMPCore_Impl.hpp"
11
12 #include "XMPMeta.hpp"
13 #include "client-glue/WXMPMeta.hpp"
14
15 #if XMP_WinBuild
16 #ifdef _MSC_VER
17 #pragma warning ( disable : 4101 ) // unreferenced local variable
18 #pragma warning ( disable : 4189 ) // local variable is initialized but not referenced
19 #pragma warning ( disable : 4702 ) // unreachable code
20 #pragma warning ( disable : 4800 ) // forcing value to bool 'true' or 'false' (performance warning)
21 #if XMP_DebugBuild
22 #pragma warning ( disable : 4297 ) // function assumed not to throw an exception but does
23 #endif
24 #endif
25 #endif
26
27 #if __cplusplus
28 extern "C" {
29 #endif
30
31 // =================================================================================================
32 // Init/Term Wrappers
33 // ==================
34
35 /* class static */ void
WXMPMeta_GetVersionInfo_1(XMP_VersionInfo * info)36 WXMPMeta_GetVersionInfo_1 ( XMP_VersionInfo * info )
37 {
38 WXMP_Result * wResult = &void_wResult; // ! Needed to "fool" the EnterWrapper macro.
39 XMP_ENTER_WRAPPER_NO_LOCK ( "WXMPMeta_GetVersionInfo_1" )
40
41 XMPMeta::GetVersionInfo ( info );
42
43 XMP_EXIT_WRAPPER_NO_THROW
44 }
45
46 // -------------------------------------------------------------------------------------------------
47
48 /* class static */ void
WXMPMeta_Initialize_1(WXMP_Result * wResult)49 WXMPMeta_Initialize_1 ( WXMP_Result * wResult )
50 {
51 XMP_ENTER_WRAPPER_NO_LOCK ( "WXMPMeta_Initialize_1" )
52
53 bool ok = XMPMeta::Initialize();
54 wResult->int32Result = ok;
55
56 XMP_EXIT_WRAPPER
57 }
58 // -------------------------------------------------------------------------------------------------
59
60 /* class static */ void
WXMPMeta_Terminate_1()61 WXMPMeta_Terminate_1()
62 {
63 WXMP_Result * wResult = &void_wResult; // ! Needed to "fool" the EnterWrapper macro.
64 XMP_ENTER_WRAPPER_NO_LOCK ( "WXMPMeta_Terminate_1" )
65
66 XMPMeta::Terminate();
67
68 XMP_EXIT_WRAPPER_NO_THROW
69 }
70
71 // =================================================================================================
72 // CTor/DTor Wrappers
73 // ==================
74
75 void
WXMPMeta_CTor_1(WXMP_Result * wResult)76 WXMPMeta_CTor_1 ( WXMP_Result * wResult )
77 {
78 XMP_ENTER_WRAPPER ( "WXMPMeta_CTor_1" )
79
80 XMPMeta * xmpObj = new XMPMeta();
81 ++xmpObj->clientRefs;
82 XMP_Assert ( xmpObj->clientRefs == 1 );
83 wResult->ptrResult = XMPMetaRef ( xmpObj );
84
85 XMP_EXIT_WRAPPER
86 }
87
88 // -------------------------------------------------------------------------------------------------
89
90 void
WXMPMeta_IncrementRefCount_1(XMPMetaRef xmpRef)91 WXMPMeta_IncrementRefCount_1 ( XMPMetaRef xmpRef )
92 {
93 WXMP_Result * wResult = &void_wResult; // ! Needed to "fool" the EnterWrapper macro.
94 XMP_ENTER_WRAPPER ( "WXMPMeta_IncrementRefCount_1" )
95
96 XMPMeta * thiz = (XMPMeta*)xmpRef;
97
98 ++thiz->clientRefs;
99 XMP_Assert ( thiz->clientRefs > 0 );
100
101 XMP_EXIT_WRAPPER_NO_THROW
102 }
103
104 // -------------------------------------------------------------------------------------------------
105
106 void
WXMPMeta_DecrementRefCount_1(XMPMetaRef xmpRef)107 WXMPMeta_DecrementRefCount_1 ( XMPMetaRef xmpRef )
108 {
109 WXMP_Result * wResult = &void_wResult; // ! Needed to "fool" the EnterWrapper macro.
110 XMP_ENTER_WRAPPER ( "WXMPMeta_DecrementRefCount_1" )
111
112 XMPMeta * thiz = (XMPMeta*)xmpRef;
113
114 XMP_Assert ( thiz->clientRefs > 0 );
115 --thiz->clientRefs;
116 if ( thiz->clientRefs <= 0 ) delete ( thiz );
117
118 XMP_EXIT_WRAPPER_NO_THROW
119 }
120
121 // =================================================================================================
122 // Class Static Wrappers
123 // =====================
124 //
125 // These are DLL-entry wrappers for class-static functions. They all follow a simple pattern:
126 //
127 // try
128 // acquire toolbox lock
129 // validate parameters
130 // call through to the implementation
131 // retain toolbox lock if necessary
132 // catch anything and return an appropriate XMP_Error object
133 // return null (no error if we get to here)
134 //
135 // The toolbox lock is acquired through a local wrapper object that automatically unlocks when the
136 // try-block is exited. The lock must be retained if the function is returning a string result. The
137 // output string is owned by the toolkit, the client must copy the string then release the lock.
138 // The lock used here is the overall toolkit lock. For simplicity at this time the lock is a simple
139 // mutual exclusion lock, we do not allow multiple concurrent readers.
140 //
141 // The one exception to this model is UnlockToolkit. It does not acquire the toolkit lock since this
142 // is the function the client calls to release the lock after copying an output string!
143 //
144 // =================================================================================================
145
146 /* class static */ void
WXMPMeta_GetGlobalOptions_1(WXMP_Result * wResult)147 WXMPMeta_GetGlobalOptions_1 ( WXMP_Result * wResult )
148 {
149 XMP_ENTER_WRAPPER ( "WXMPMeta_GetGlobalOptions_1" )
150
151 XMP_OptionBits options = XMPMeta::GetGlobalOptions();
152 wResult->int32Result = options;
153
154 XMP_EXIT_WRAPPER
155 }
156
157 // -------------------------------------------------------------------------------------------------
158
159 /* class static */ void
WXMPMeta_SetGlobalOptions_1(XMP_OptionBits options,WXMP_Result * wResult)160 WXMPMeta_SetGlobalOptions_1 ( XMP_OptionBits options,
161 WXMP_Result * wResult )
162 {
163 XMP_ENTER_WRAPPER ( "WXMPMeta_SetGlobalOptions_1" )
164
165 XMPMeta::SetGlobalOptions ( options );
166
167 XMP_EXIT_WRAPPER
168 }
169 // -------------------------------------------------------------------------------------------------
170
171 /* class static */ void
WXMPMeta_DumpNamespaces_1(XMP_TextOutputProc outProc,void * refCon,WXMP_Result * wResult)172 WXMPMeta_DumpNamespaces_1 ( XMP_TextOutputProc outProc,
173 void * refCon,
174 WXMP_Result * wResult )
175 {
176 XMP_ENTER_WRAPPER ( "WXMPMeta_DumpNamespaces_1" )
177
178 if ( outProc == 0 ) XMP_Throw ( "Null client output routine", kXMPErr_BadParam );
179
180 XMP_Status status = XMPMeta::DumpNamespaces ( outProc, refCon );
181 wResult->int32Result = status;
182
183 XMP_EXIT_WRAPPER
184 }
185
186 // -------------------------------------------------------------------------------------------------
187
188 /* class static */ void
WXMPMeta_DumpAliases_1(XMP_TextOutputProc outProc,void * refCon,WXMP_Result * wResult)189 WXMPMeta_DumpAliases_1 ( XMP_TextOutputProc outProc,
190 void * refCon,
191 WXMP_Result * wResult )
192 {
193 XMP_ENTER_WRAPPER ( "WXMPMeta_DumpAliases_1" )
194
195 if ( outProc == 0 ) XMP_Throw ( "Null client output routine", kXMPErr_BadParam );
196
197 XMP_Status status = XMPMeta::DumpAliases ( outProc, refCon );
198 wResult->int32Result = status;
199
200 XMP_EXIT_WRAPPER
201 }
202
203 // -------------------------------------------------------------------------------------------------
204
205 /* class static */ void
WXMPMeta_Unlock_1(XMP_OptionBits options)206 WXMPMeta_Unlock_1 ( XMP_OptionBits options )
207 {
208 WXMP_Result * wResult = &void_wResult; // ! Needed to "fool" the EnterWrapper macro.
209 XMP_ENTER_WRAPPER_NO_LOCK ( "WXMPMeta_Unlock_1" )
210
211 XMPMeta::Unlock ( options );
212
213 XMP_EXIT_WRAPPER_NO_THROW
214 }
215
216 // -------------------------------------------------------------------------------------------------
217
218 /* class static */ void
WXMPMeta_RegisterNamespace_1(XMP_StringPtr namespaceURI,XMP_StringPtr prefix,WXMP_Result * wResult)219 WXMPMeta_RegisterNamespace_1 ( XMP_StringPtr namespaceURI,
220 XMP_StringPtr prefix,
221 WXMP_Result * wResult )
222 {
223 XMP_ENTER_WRAPPER ( "WXMPMeta_RegisterNamespace_1" )
224
225 if ( (namespaceURI == 0) || (*namespaceURI == 0) ) XMP_Throw ( "Empty namespace URI", kXMPErr_BadSchema );
226 if ( (prefix == 0) || (*prefix == 0) ) XMP_Throw ( "Empty prefix", kXMPErr_BadSchema );
227
228 XMPMeta::RegisterNamespace ( namespaceURI, prefix );
229
230 XMP_EXIT_WRAPPER
231 }
232
233 // -------------------------------------------------------------------------------------------------
234
235 /* class static */ void
WXMPMeta_GetNamespacePrefix_1(XMP_StringPtr namespaceURI,XMP_StringPtr * namespacePrefix,XMP_StringLen * prefixSize,WXMP_Result * wResult)236 WXMPMeta_GetNamespacePrefix_1 ( XMP_StringPtr namespaceURI,
237 XMP_StringPtr * namespacePrefix,
238 XMP_StringLen * prefixSize,
239 WXMP_Result * wResult )
240 {
241 XMP_ENTER_WRAPPER ( "WXMPMeta_GetNamespacePrefix_1" )
242
243 if ( (namespaceURI == 0) || (*namespaceURI == 0) ) XMP_Throw ( "Empty namespace URI", kXMPErr_BadSchema );
244
245 if ( namespacePrefix == 0 ) namespacePrefix = &voidStringPtr;
246 if ( prefixSize == 0 ) prefixSize = &voidStringLen;
247
248 bool found = XMPMeta::GetNamespacePrefix ( namespaceURI, namespacePrefix, prefixSize );
249 wResult->int32Result = found;
250
251 XMP_EXIT_WRAPPER_KEEP_LOCK ( found )
252 }
253
254 // -------------------------------------------------------------------------------------------------
255
256 /* class static */ void
WXMPMeta_GetNamespaceURI_1(XMP_StringPtr namespacePrefix,XMP_StringPtr * namespaceURI,XMP_StringLen * uriSize,WXMP_Result * wResult)257 WXMPMeta_GetNamespaceURI_1 ( XMP_StringPtr namespacePrefix,
258 XMP_StringPtr * namespaceURI,
259 XMP_StringLen * uriSize,
260 WXMP_Result * wResult )
261 {
262 XMP_ENTER_WRAPPER ( "WXMPMeta_GetNamespaceURI_1" )
263
264 if ( (namespacePrefix == 0) || (*namespacePrefix == 0) ) XMP_Throw ( "Empty namespace prefix", kXMPErr_BadSchema );
265
266 if ( namespaceURI == 0 ) namespaceURI = &voidStringPtr;
267 if ( uriSize == 0 ) uriSize = &voidStringLen;
268
269 bool found = XMPMeta::GetNamespaceURI ( namespacePrefix, namespaceURI, uriSize );
270 wResult->int32Result = found;
271
272 XMP_EXIT_WRAPPER_KEEP_LOCK ( found )
273 }
274
275 // -------------------------------------------------------------------------------------------------
276
277 /* class static */ void
WXMPMeta_DeleteNamespace_1(XMP_StringPtr namespaceURI,WXMP_Result * wResult)278 WXMPMeta_DeleteNamespace_1 ( XMP_StringPtr namespaceURI,
279 WXMP_Result * wResult )
280 {
281 XMP_ENTER_WRAPPER ( "WXMPMeta_DeleteNamespace_1" )
282
283 if ( (namespaceURI == 0) || (*namespaceURI == 0) ) XMP_Throw ( "Empty namespace URI", kXMPErr_BadSchema );
284
285 XMPMeta::DeleteNamespace ( namespaceURI );
286
287 XMP_EXIT_WRAPPER
288 }
289
290 // -------------------------------------------------------------------------------------------------
291
292 /* class static */ void
WXMPMeta_RegisterAlias_1(XMP_StringPtr aliasNS,XMP_StringPtr aliasProp,XMP_StringPtr actualNS,XMP_StringPtr actualProp,XMP_OptionBits arrayForm,WXMP_Result * wResult)293 WXMPMeta_RegisterAlias_1 ( XMP_StringPtr aliasNS,
294 XMP_StringPtr aliasProp,
295 XMP_StringPtr actualNS,
296 XMP_StringPtr actualProp,
297 XMP_OptionBits arrayForm,
298 WXMP_Result * wResult )
299 {
300 XMP_ENTER_WRAPPER ( "WXMPMeta_RegisterAlias_1" )
301
302 if ( (aliasNS == 0) || (*aliasNS == 0) ) XMP_Throw ( "Empty alias namespace URI", kXMPErr_BadSchema );
303 if ( (aliasProp == 0) || (*aliasProp == 0) ) XMP_Throw ( "Empty alias property name", kXMPErr_BadXPath );
304 if ( (actualNS == 0) || (*actualNS == 0) ) XMP_Throw ( "Empty actual namespace URI", kXMPErr_BadSchema );
305 if ( (actualProp == 0) || (*actualProp == 0) ) XMP_Throw ( "Empty actual property name", kXMPErr_BadXPath );
306
307 XMPMeta::RegisterAlias ( aliasNS, aliasProp, actualNS, actualProp, arrayForm );
308
309 XMP_EXIT_WRAPPER
310 }
311
312 // -------------------------------------------------------------------------------------------------
313
314 /* class static */ void
WXMPMeta_ResolveAlias_1(XMP_StringPtr aliasNS,XMP_StringPtr aliasProp,XMP_StringPtr * actualNS,XMP_StringLen * nsSize,XMP_StringPtr * actualProp,XMP_StringLen * propSize,XMP_OptionBits * arrayForm,WXMP_Result * wResult)315 WXMPMeta_ResolveAlias_1 ( XMP_StringPtr aliasNS,
316 XMP_StringPtr aliasProp,
317 XMP_StringPtr * actualNS,
318 XMP_StringLen * nsSize,
319 XMP_StringPtr * actualProp,
320 XMP_StringLen * propSize,
321 XMP_OptionBits * arrayForm,
322 WXMP_Result * wResult )
323 {
324 XMP_ENTER_WRAPPER ( "WXMPMeta_ResolveAlias_1" )
325
326 if ( (aliasNS == 0) || (*aliasNS == 0) ) XMP_Throw ( "Empty alias namespace URI", kXMPErr_BadSchema );
327 if ( (aliasProp == 0) || (*aliasProp == 0) ) XMP_Throw ( "Empty alias property name", kXMPErr_BadXPath );
328
329 if ( actualNS == 0 ) actualNS = &voidStringPtr;
330 if ( nsSize == 0 ) nsSize = &voidStringLen;
331 if ( actualProp == 0 ) actualProp = &voidStringPtr;
332 if ( propSize == 0 ) propSize = &voidStringLen;
333 if ( arrayForm == 0 ) arrayForm = &voidOptionBits;
334
335 bool found = XMPMeta::ResolveAlias ( aliasNS, aliasProp, actualNS, nsSize, actualProp, propSize, arrayForm );
336 wResult->int32Result = found;
337
338 XMP_EXIT_WRAPPER_KEEP_LOCK ( found )
339 }
340
341 // -------------------------------------------------------------------------------------------------
342
343 /* class static */ void
WXMPMeta_DeleteAlias_1(XMP_StringPtr aliasNS,XMP_StringPtr aliasProp,WXMP_Result * wResult)344 WXMPMeta_DeleteAlias_1 ( XMP_StringPtr aliasNS,
345 XMP_StringPtr aliasProp,
346 WXMP_Result * wResult )
347 {
348 XMP_ENTER_WRAPPER ( "WXMPMeta_DeleteAlias_1" )
349
350 if ( (aliasNS == 0) || (*aliasNS == 0) ) XMP_Throw ( "Empty alias namespace URI", kXMPErr_BadSchema );
351 if ( (aliasProp == 0) || (*aliasProp == 0) ) XMP_Throw ( "Empty alias property name", kXMPErr_BadXPath );
352
353 XMPMeta::DeleteAlias ( aliasNS, aliasProp );
354
355 XMP_EXIT_WRAPPER
356 }
357
358 // -------------------------------------------------------------------------------------------------
359
360 /* class static */ void
WXMPMeta_RegisterStandardAliases_1(XMP_StringPtr schemaNS,WXMP_Result * wResult)361 WXMPMeta_RegisterStandardAliases_1 ( XMP_StringPtr schemaNS,
362 WXMP_Result * wResult )
363 {
364 XMP_ENTER_WRAPPER ( "WXMPMeta_RegisterStandardAliases_1" )
365
366 if ( schemaNS == 0 ) schemaNS = "";
367
368 XMPMeta::RegisterStandardAliases ( schemaNS );
369
370 XMP_EXIT_WRAPPER
371 }
372
373 // =================================================================================================
374 // Class Method Wrappers
375 // =====================
376 //
377 // These are DLL-entry wrappers for the methods. They all follow a simple pattern:
378 //
379 // validate parameters
380 // try
381 // acquire object lock
382 // call through to the implementation
383 // retain object lock if necessary
384 // catch anything and return an appropriate XMP_Error object
385 // return null (no error if we get to here)
386 //
387 // The object lock is acquired through a local wrapper object that automatically unlocks when the
388 // try-block is exited. The lock must be retained if the function is returning a string result. The
389 // output string is owned by the object, the client must copy the string then release the lock. The
390 // lock used here is the per-object lock. For simplicity at this time the lock is a simple mutual
391 // exclusion lock, we do not allow multiple concurrent readers.
392 //
393 // The one exception to this model is UnlockObject. It does not acquire the object lock since this
394 // is the function the client calls to release the lock after copying an output string!
395 //
396 // =================================================================================================
397
398 void
WXMPMeta_GetProperty_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr propName,XMP_StringPtr * propValue,XMP_StringLen * valueSize,XMP_OptionBits * options,WXMP_Result * wResult)399 WXMPMeta_GetProperty_1 ( XMPMetaRef xmpRef,
400 XMP_StringPtr schemaNS,
401 XMP_StringPtr propName,
402 XMP_StringPtr * propValue,
403 XMP_StringLen * valueSize,
404 XMP_OptionBits * options,
405 WXMP_Result * wResult ) /* const */
406 {
407 XMP_ENTER_WRAPPER ( "WXMPMeta_GetProperty_1" )
408
409 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
410 if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
411
412 if ( propValue == 0 ) propValue = &voidStringPtr;
413 if ( valueSize == 0 ) valueSize = &voidStringLen;
414 if ( options == 0 ) options = &voidOptionBits;
415
416 const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
417 bool found = meta.GetProperty ( schemaNS, propName, propValue, valueSize, options );
418 wResult->int32Result = found;
419
420 XMP_EXIT_WRAPPER_KEEP_LOCK ( found )
421 }
422
423 // -------------------------------------------------------------------------------------------------
424
425 void
WXMPMeta_GetArrayItem_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr arrayName,XMP_Index itemIndex,XMP_StringPtr * itemValue,XMP_StringLen * valueSize,XMP_OptionBits * options,WXMP_Result * wResult)426 WXMPMeta_GetArrayItem_1 ( XMPMetaRef xmpRef,
427 XMP_StringPtr schemaNS,
428 XMP_StringPtr arrayName,
429 XMP_Index itemIndex,
430 XMP_StringPtr * itemValue,
431 XMP_StringLen * valueSize,
432 XMP_OptionBits * options,
433 WXMP_Result * wResult ) /* const */
434 {
435 XMP_ENTER_WRAPPER ( "WXMPMeta_GetArrayItem_1" )
436
437 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
438 if ( (arrayName == 0) || (*arrayName == 0) ) XMP_Throw ( "Empty array name", kXMPErr_BadXPath );
439
440 if ( itemValue == 0 ) itemValue = &voidStringPtr;
441 if ( valueSize == 0 ) valueSize = &voidStringLen;
442 if ( options == 0 ) options = &voidOptionBits;
443
444 const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
445 bool found = meta.GetArrayItem ( schemaNS, arrayName, itemIndex, itemValue, valueSize, options );
446 wResult->int32Result = found;
447
448 XMP_EXIT_WRAPPER_KEEP_LOCK ( found )
449 }
450
451 // -------------------------------------------------------------------------------------------------
452
453 void
WXMPMeta_GetStructField_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr structName,XMP_StringPtr fieldNS,XMP_StringPtr fieldName,XMP_StringPtr * fieldValue,XMP_StringLen * valueSize,XMP_OptionBits * options,WXMP_Result * wResult)454 WXMPMeta_GetStructField_1 ( XMPMetaRef xmpRef,
455 XMP_StringPtr schemaNS,
456 XMP_StringPtr structName,
457 XMP_StringPtr fieldNS,
458 XMP_StringPtr fieldName,
459 XMP_StringPtr * fieldValue,
460 XMP_StringLen * valueSize,
461 XMP_OptionBits * options,
462 WXMP_Result * wResult ) /* const */
463 {
464 XMP_ENTER_WRAPPER ( "WXMPMeta_GetStructField_1" )
465
466 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
467 if ( (structName == 0) || (*structName == 0) ) XMP_Throw ( "Empty struct name", kXMPErr_BadXPath );
468 if ( (fieldNS == 0) || (*fieldNS == 0) ) XMP_Throw ( "Empty field namespace URI", kXMPErr_BadSchema );
469 if ( (fieldName == 0) || (*fieldName == 0) ) XMP_Throw ( "Empty field name", kXMPErr_BadXPath );
470
471 if ( fieldValue == 0 ) fieldValue = &voidStringPtr;
472 if ( valueSize == 0 ) valueSize = &voidStringLen;
473 if ( options == 0 ) options = &voidOptionBits;
474
475 const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
476 bool found = meta.GetStructField ( schemaNS, structName, fieldNS, fieldName, fieldValue, valueSize, options );
477 wResult->int32Result = found;
478
479 XMP_EXIT_WRAPPER_KEEP_LOCK ( found )
480 }
481
482 // -------------------------------------------------------------------------------------------------
483
484 void
WXMPMeta_GetQualifier_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr propName,XMP_StringPtr qualNS,XMP_StringPtr qualName,XMP_StringPtr * qualValue,XMP_StringLen * valueSize,XMP_OptionBits * options,WXMP_Result * wResult)485 WXMPMeta_GetQualifier_1 ( XMPMetaRef xmpRef,
486 XMP_StringPtr schemaNS,
487 XMP_StringPtr propName,
488 XMP_StringPtr qualNS,
489 XMP_StringPtr qualName,
490 XMP_StringPtr * qualValue,
491 XMP_StringLen * valueSize,
492 XMP_OptionBits * options,
493 WXMP_Result * wResult ) /* const */
494 {
495 XMP_ENTER_WRAPPER ( "WXMPMeta_GetQualifier_1" )
496
497 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
498 if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
499 if ( (qualNS == 0) || (*qualNS == 0) ) XMP_Throw ( "Empty qualifier namespace URI", kXMPErr_BadSchema );
500 if ( (qualName == 0) || (*qualName == 0) ) XMP_Throw ( "Empty qualifier name", kXMPErr_BadXPath );
501
502 if ( qualValue == 0 ) qualValue = &voidStringPtr;
503 if ( valueSize == 0 ) valueSize = &voidStringLen;
504 if ( options == 0 ) options = &voidOptionBits;
505
506 const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
507 bool found = meta.GetQualifier ( schemaNS, propName, qualNS, qualName, qualValue, valueSize, options );
508 wResult->int32Result = found;
509
510 XMP_EXIT_WRAPPER_KEEP_LOCK ( found )
511 }
512
513 // -------------------------------------------------------------------------------------------------
514
515 void
WXMPMeta_SetProperty_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr propName,XMP_StringPtr propValue,XMP_OptionBits options,WXMP_Result * wResult)516 WXMPMeta_SetProperty_1 ( XMPMetaRef xmpRef,
517 XMP_StringPtr schemaNS,
518 XMP_StringPtr propName,
519 XMP_StringPtr propValue,
520 XMP_OptionBits options,
521 WXMP_Result * wResult )
522 {
523 XMP_ENTER_WRAPPER ( "WXMPMeta_SetProperty_1" )
524
525 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
526 if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
527
528 XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
529 meta->SetProperty ( schemaNS, propName, propValue, options );
530
531 XMP_EXIT_WRAPPER
532 }
533
534 // -------------------------------------------------------------------------------------------------
535
536 void
WXMPMeta_SetArrayItem_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr arrayName,XMP_Index itemIndex,XMP_StringPtr itemValue,XMP_OptionBits options,WXMP_Result * wResult)537 WXMPMeta_SetArrayItem_1 ( XMPMetaRef xmpRef,
538 XMP_StringPtr schemaNS,
539 XMP_StringPtr arrayName,
540 XMP_Index itemIndex,
541 XMP_StringPtr itemValue,
542 XMP_OptionBits options,
543 WXMP_Result * wResult )
544 {
545 XMP_ENTER_WRAPPER ( "WXMPMeta_SetArrayItem_1" )
546
547 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
548 if ( (arrayName == 0) || (*arrayName == 0) ) XMP_Throw ( "Empty array name", kXMPErr_BadXPath );
549
550 XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
551 meta->SetArrayItem ( schemaNS, arrayName, itemIndex, itemValue, options );
552
553 XMP_EXIT_WRAPPER
554 }
555
556 // -------------------------------------------------------------------------------------------------
557
558 void
WXMPMeta_AppendArrayItem_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr arrayName,XMP_OptionBits arrayOptions,XMP_StringPtr itemValue,XMP_OptionBits options,WXMP_Result * wResult)559 WXMPMeta_AppendArrayItem_1 ( XMPMetaRef xmpRef,
560 XMP_StringPtr schemaNS,
561 XMP_StringPtr arrayName,
562 XMP_OptionBits arrayOptions,
563 XMP_StringPtr itemValue,
564 XMP_OptionBits options,
565 WXMP_Result * wResult )
566 {
567 XMP_ENTER_WRAPPER ( "WXMPMeta_AppendArrayItem_1" )
568
569 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
570 if ( (arrayName == 0) || (*arrayName == 0) ) XMP_Throw ( "Empty array name", kXMPErr_BadXPath );
571
572 XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
573 meta->AppendArrayItem ( schemaNS, arrayName, arrayOptions, itemValue, options );
574
575 XMP_EXIT_WRAPPER
576 }
577
578 // -------------------------------------------------------------------------------------------------
579
580 void
WXMPMeta_SetStructField_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr structName,XMP_StringPtr fieldNS,XMP_StringPtr fieldName,XMP_StringPtr fieldValue,XMP_OptionBits options,WXMP_Result * wResult)581 WXMPMeta_SetStructField_1 ( XMPMetaRef xmpRef,
582 XMP_StringPtr schemaNS,
583 XMP_StringPtr structName,
584 XMP_StringPtr fieldNS,
585 XMP_StringPtr fieldName,
586 XMP_StringPtr fieldValue,
587 XMP_OptionBits options,
588 WXMP_Result * wResult )
589 {
590 XMP_ENTER_WRAPPER ( "WXMPMeta_SetStructField_1" )
591
592 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
593 if ( (structName == 0) || (*structName == 0) ) XMP_Throw ( "Empty struct name", kXMPErr_BadXPath );
594 if ( (fieldNS == 0) || (*fieldNS == 0) ) XMP_Throw ( "Empty field namespace URI", kXMPErr_BadSchema );
595 if ( (fieldName == 0) || (*fieldName == 0) ) XMP_Throw ( "Empty field name", kXMPErr_BadXPath );
596
597 XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
598 meta->SetStructField ( schemaNS, structName, fieldNS, fieldName, fieldValue, options );
599
600 XMP_EXIT_WRAPPER
601 }
602
603 // -------------------------------------------------------------------------------------------------
604
605 void
WXMPMeta_SetQualifier_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr propName,XMP_StringPtr qualNS,XMP_StringPtr qualName,XMP_StringPtr qualValue,XMP_OptionBits options,WXMP_Result * wResult)606 WXMPMeta_SetQualifier_1 ( XMPMetaRef xmpRef,
607 XMP_StringPtr schemaNS,
608 XMP_StringPtr propName,
609 XMP_StringPtr qualNS,
610 XMP_StringPtr qualName,
611 XMP_StringPtr qualValue,
612 XMP_OptionBits options,
613 WXMP_Result * wResult )
614 {
615 XMP_ENTER_WRAPPER ( "WXMPMeta_SetQualifier_1" )
616
617 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
618 if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
619 if ( (qualNS == 0) || (*qualNS == 0) ) XMP_Throw ( "Empty qualifier namespace URI", kXMPErr_BadSchema );
620 if ( (qualName == 0) || (*qualName == 0) ) XMP_Throw ( "Empty qualifier name", kXMPErr_BadXPath );
621
622 XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
623 meta->SetQualifier ( schemaNS, propName, qualNS, qualName, qualValue, options );
624
625 XMP_EXIT_WRAPPER
626 }
627
628 // -------------------------------------------------------------------------------------------------
629
630 void
WXMPMeta_DeleteProperty_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr propName,WXMP_Result * wResult)631 WXMPMeta_DeleteProperty_1 ( XMPMetaRef xmpRef,
632 XMP_StringPtr schemaNS,
633 XMP_StringPtr propName,
634 WXMP_Result * wResult )
635 {
636 XMP_ENTER_WRAPPER ( "WXMPMeta_DeleteProperty_1" )
637
638 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
639 if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
640
641 XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
642 meta->DeleteProperty ( schemaNS, propName );
643
644 XMP_EXIT_WRAPPER
645 }
646
647 // -------------------------------------------------------------------------------------------------
648
649 void
WXMPMeta_DeleteArrayItem_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr arrayName,XMP_Index itemIndex,WXMP_Result * wResult)650 WXMPMeta_DeleteArrayItem_1 ( XMPMetaRef xmpRef,
651 XMP_StringPtr schemaNS,
652 XMP_StringPtr arrayName,
653 XMP_Index itemIndex,
654 WXMP_Result * wResult )
655 {
656 XMP_ENTER_WRAPPER ( "WXMPMeta_DeleteArrayItem_1" )
657
658 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
659 if ( (arrayName == 0) || (*arrayName == 0) ) XMP_Throw ( "Empty array name", kXMPErr_BadXPath );
660
661 XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
662 meta->DeleteArrayItem ( schemaNS, arrayName, itemIndex );
663
664 XMP_EXIT_WRAPPER
665 }
666
667 // -------------------------------------------------------------------------------------------------
668
669 void
WXMPMeta_DeleteStructField_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr structName,XMP_StringPtr fieldNS,XMP_StringPtr fieldName,WXMP_Result * wResult)670 WXMPMeta_DeleteStructField_1 ( XMPMetaRef xmpRef,
671 XMP_StringPtr schemaNS,
672 XMP_StringPtr structName,
673 XMP_StringPtr fieldNS,
674 XMP_StringPtr fieldName,
675 WXMP_Result * wResult )
676 {
677 XMP_ENTER_WRAPPER ( "WXMPMeta_DeleteStructField_1" )
678
679 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
680 if ( (structName == 0) || (*structName == 0) ) XMP_Throw ( "Empty struct name", kXMPErr_BadXPath );
681 if ( (fieldNS == 0) || (*fieldNS == 0) ) XMP_Throw ( "Empty field namespace URI", kXMPErr_BadSchema );
682 if ( (fieldName == 0) || (*fieldName == 0) ) XMP_Throw ( "Empty field name", kXMPErr_BadXPath );
683
684 XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
685 meta->DeleteStructField ( schemaNS, structName, fieldNS, fieldName );
686
687 XMP_EXIT_WRAPPER
688 }
689
690 // -------------------------------------------------------------------------------------------------
691
692 void
WXMPMeta_DeleteQualifier_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr propName,XMP_StringPtr qualNS,XMP_StringPtr qualName,WXMP_Result * wResult)693 WXMPMeta_DeleteQualifier_1 ( XMPMetaRef xmpRef,
694 XMP_StringPtr schemaNS,
695 XMP_StringPtr propName,
696 XMP_StringPtr qualNS,
697 XMP_StringPtr qualName,
698 WXMP_Result * wResult )
699 {
700 XMP_ENTER_WRAPPER ( "WXMPMeta_DeleteQualifier_1" )
701
702 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
703 if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
704 if ( (qualNS == 0) || (*qualNS == 0) ) XMP_Throw ( "Empty qualifier namespace URI", kXMPErr_BadSchema );
705 if ( (qualName == 0) || (*qualName == 0) ) XMP_Throw ( "Empty qualifier name", kXMPErr_BadXPath );
706
707 XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
708 meta->DeleteQualifier ( schemaNS, propName, qualNS, qualName );
709
710 XMP_EXIT_WRAPPER
711 }
712
713 // -------------------------------------------------------------------------------------------------
714
715 void
WXMPMeta_DoesPropertyExist_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr propName,WXMP_Result * wResult)716 WXMPMeta_DoesPropertyExist_1 ( XMPMetaRef xmpRef,
717 XMP_StringPtr schemaNS,
718 XMP_StringPtr propName,
719 WXMP_Result * wResult ) /* const */
720 {
721 XMP_ENTER_WRAPPER ( "WXMPMeta_DoesPropertyExist_1" )
722
723 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
724 if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
725
726 const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
727 bool found = meta.DoesPropertyExist ( schemaNS, propName );
728 wResult->int32Result = found;
729
730 XMP_EXIT_WRAPPER
731 }
732
733 // -------------------------------------------------------------------------------------------------
734
735 void
WXMPMeta_DoesArrayItemExist_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr arrayName,XMP_Index itemIndex,WXMP_Result * wResult)736 WXMPMeta_DoesArrayItemExist_1 ( XMPMetaRef xmpRef,
737 XMP_StringPtr schemaNS,
738 XMP_StringPtr arrayName,
739 XMP_Index itemIndex,
740 WXMP_Result * wResult ) /* const */
741 {
742 XMP_ENTER_WRAPPER ( "WXMPMeta_DoesArrayItemExist_1" )
743
744 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
745 if ( (arrayName == 0) || (*arrayName == 0) ) XMP_Throw ( "Empty array name", kXMPErr_BadXPath );
746
747 const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
748 bool found = meta.DoesArrayItemExist ( schemaNS, arrayName, itemIndex );
749 wResult->int32Result = found;
750
751 XMP_EXIT_WRAPPER
752 }
753
754 // -------------------------------------------------------------------------------------------------
755
756 void
WXMPMeta_DoesStructFieldExist_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr structName,XMP_StringPtr fieldNS,XMP_StringPtr fieldName,WXMP_Result * wResult)757 WXMPMeta_DoesStructFieldExist_1 ( XMPMetaRef xmpRef,
758 XMP_StringPtr schemaNS,
759 XMP_StringPtr structName,
760 XMP_StringPtr fieldNS,
761 XMP_StringPtr fieldName,
762 WXMP_Result * wResult ) /* const */
763 {
764 XMP_ENTER_WRAPPER ( "WXMPMeta_DoesStructFieldExist_1" )
765
766 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
767 if ( (structName == 0) || (*structName == 0) ) XMP_Throw ( "Empty struct name", kXMPErr_BadXPath );
768 if ( (fieldNS == 0) || (*fieldNS == 0) ) XMP_Throw ( "Empty field namespace URI", kXMPErr_BadSchema );
769 if ( (fieldName == 0) || (*fieldName == 0) ) XMP_Throw ( "Empty field name", kXMPErr_BadXPath );
770
771 const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
772 bool found = meta.DoesStructFieldExist ( schemaNS, structName, fieldNS, fieldName );
773 wResult->int32Result = found;
774
775 XMP_EXIT_WRAPPER
776 }
777
778 // -------------------------------------------------------------------------------------------------
779
780 void
WXMPMeta_DoesQualifierExist_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr propName,XMP_StringPtr qualNS,XMP_StringPtr qualName,WXMP_Result * wResult)781 WXMPMeta_DoesQualifierExist_1 ( XMPMetaRef xmpRef,
782 XMP_StringPtr schemaNS,
783 XMP_StringPtr propName,
784 XMP_StringPtr qualNS,
785 XMP_StringPtr qualName,
786 WXMP_Result * wResult ) /* const */
787 {
788 XMP_ENTER_WRAPPER ( "WXMPMeta_DoesQualifierExist_1" )
789
790 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
791 if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
792 if ( (qualNS == 0) || (*qualNS == 0) ) XMP_Throw ( "Empty qualifier namespace URI", kXMPErr_BadSchema );
793 if ( (qualName == 0) || (*qualName == 0) ) XMP_Throw ( "Empty qualifier name", kXMPErr_BadXPath );
794
795 const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
796 bool found = meta.DoesQualifierExist ( schemaNS, propName, qualNS, qualName );
797 wResult->int32Result = found;
798
799 XMP_EXIT_WRAPPER
800 }
801
802 // -------------------------------------------------------------------------------------------------
803
804 void
WXMPMeta_GetLocalizedText_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr arrayName,XMP_StringPtr genericLang,XMP_StringPtr specificLang,XMP_StringPtr * actualLang,XMP_StringLen * langSize,XMP_StringPtr * itemValue,XMP_StringLen * valueSize,XMP_OptionBits * options,WXMP_Result * wResult)805 WXMPMeta_GetLocalizedText_1 ( XMPMetaRef xmpRef,
806 XMP_StringPtr schemaNS,
807 XMP_StringPtr arrayName,
808 XMP_StringPtr genericLang,
809 XMP_StringPtr specificLang,
810 XMP_StringPtr * actualLang,
811 XMP_StringLen * langSize,
812 XMP_StringPtr * itemValue,
813 XMP_StringLen * valueSize,
814 XMP_OptionBits * options,
815 WXMP_Result * wResult ) /* const */
816 {
817 XMP_ENTER_WRAPPER ( "WXMPMeta_GetLocalizedText_1" )
818
819 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
820 if ( (arrayName == 0) || (*arrayName == 0) ) XMP_Throw ( "Empty array name", kXMPErr_BadXPath );
821 if ( genericLang == 0 ) genericLang = "";
822 if ( (specificLang == 0) ||(*specificLang == 0) ) XMP_Throw ( "Empty specific language", kXMPErr_BadParam );
823
824 if ( actualLang == 0 ) actualLang = &voidStringPtr;
825 if ( langSize == 0 ) langSize = &voidStringLen;
826 if ( itemValue == 0 ) itemValue = &voidStringPtr;
827 if ( valueSize == 0 ) valueSize = &voidStringLen;
828 if ( options == 0 ) options = &voidOptionBits;
829
830 const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
831 bool found = meta.GetLocalizedText ( schemaNS, arrayName, genericLang, specificLang,
832 actualLang, langSize, itemValue, valueSize, options );
833 wResult->int32Result = found;
834
835 XMP_EXIT_WRAPPER_KEEP_LOCK ( found )
836 }
837
838 // -------------------------------------------------------------------------------------------------
839
840 void
WXMPMeta_SetLocalizedText_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr arrayName,XMP_StringPtr genericLang,XMP_StringPtr specificLang,XMP_StringPtr itemValue,XMP_OptionBits options,WXMP_Result * wResult)841 WXMPMeta_SetLocalizedText_1 ( XMPMetaRef xmpRef,
842 XMP_StringPtr schemaNS,
843 XMP_StringPtr arrayName,
844 XMP_StringPtr genericLang,
845 XMP_StringPtr specificLang,
846 XMP_StringPtr itemValue,
847 XMP_OptionBits options,
848 WXMP_Result * wResult )
849 {
850 XMP_ENTER_WRAPPER ( "WXMPMeta_SetLocalizedText_1" )
851
852 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
853 if ( (arrayName == 0) || (*arrayName == 0) ) XMP_Throw ( "Empty array name", kXMPErr_BadXPath );
854 if ( genericLang == 0 ) genericLang = "";
855 if ( (specificLang == 0) ||(*specificLang == 0) ) XMP_Throw ( "Empty specific language", kXMPErr_BadParam );
856 if ( itemValue == 0 ) itemValue = "";
857
858 XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
859 meta->SetLocalizedText ( schemaNS, arrayName, genericLang, specificLang, itemValue, options );
860
861 XMP_EXIT_WRAPPER
862 }
863
864 // -------------------------------------------------------------------------------------------------
865
866 void
WXMPMeta_GetProperty_Bool_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr propName,XMP_Bool * propValue,XMP_OptionBits * options,WXMP_Result * wResult)867 WXMPMeta_GetProperty_Bool_1 ( XMPMetaRef xmpRef,
868 XMP_StringPtr schemaNS,
869 XMP_StringPtr propName,
870 XMP_Bool * propValue,
871 XMP_OptionBits * options,
872 WXMP_Result * wResult ) /* const */
873 {
874 XMP_ENTER_WRAPPER ( "WXMPMeta_GetProperty_Bool_1" )
875
876 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
877 if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
878
879 if ( propValue == 0 ) propValue = &voidByte;
880 if ( options == 0 ) options = &voidOptionBits;
881
882 const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
883 bool value;
884 bool found = meta.GetProperty_Bool ( schemaNS, propName, &value, options );
885 if ( propValue != 0 ) *propValue = value;
886 wResult->int32Result = found;
887
888 XMP_EXIT_WRAPPER
889 }
890
891 // -------------------------------------------------------------------------------------------------
892
893 void
WXMPMeta_GetProperty_Int_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr propName,XMP_Int32 * propValue,XMP_OptionBits * options,WXMP_Result * wResult)894 WXMPMeta_GetProperty_Int_1 ( XMPMetaRef xmpRef,
895 XMP_StringPtr schemaNS,
896 XMP_StringPtr propName,
897 XMP_Int32 * propValue,
898 XMP_OptionBits * options,
899 WXMP_Result * wResult ) /* const */
900 {
901 XMP_ENTER_WRAPPER ( "WXMPMeta_GetProperty_Int_1" )
902
903 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
904 if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
905
906 if ( propValue == 0 ) propValue = &voidInt32;
907 if ( options == 0 ) options = &voidOptionBits;
908
909 const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
910 bool found = meta.GetProperty_Int ( schemaNS, propName, propValue, options );
911 wResult->int32Result = found;
912
913 XMP_EXIT_WRAPPER
914 }
915
916 // -------------------------------------------------------------------------------------------------
917
918 void
WXMPMeta_GetProperty_Int64_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr propName,XMP_Int64 * propValue,XMP_OptionBits * options,WXMP_Result * wResult)919 WXMPMeta_GetProperty_Int64_1 ( XMPMetaRef xmpRef,
920 XMP_StringPtr schemaNS,
921 XMP_StringPtr propName,
922 XMP_Int64 * propValue,
923 XMP_OptionBits * options,
924 WXMP_Result * wResult ) /* const */
925 {
926 XMP_ENTER_WRAPPER ( "WXMPMeta_GetProperty_Int64_1" )
927
928 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
929 if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
930
931 if ( propValue == 0 ) propValue = &voidInt64;
932 if ( options == 0 ) options = &voidOptionBits;
933
934 const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
935 bool found = meta.GetProperty_Int64 ( schemaNS, propName, propValue, options );
936 wResult->int32Result = found;
937
938 XMP_EXIT_WRAPPER
939 }
940
941 // -------------------------------------------------------------------------------------------------
942
943 void
WXMPMeta_GetProperty_Float_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr propName,double * propValue,XMP_OptionBits * options,WXMP_Result * wResult)944 WXMPMeta_GetProperty_Float_1 ( XMPMetaRef xmpRef,
945 XMP_StringPtr schemaNS,
946 XMP_StringPtr propName,
947 double * propValue,
948 XMP_OptionBits * options,
949 WXMP_Result * wResult ) /* const */
950 {
951 XMP_ENTER_WRAPPER ( "WXMPMeta_GetProperty_Float_1" )
952
953 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
954 if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
955
956 if ( propValue == 0 ) propValue = &voidDouble;
957 if ( options == 0 ) options = &voidOptionBits;
958
959 const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
960 bool found = meta.GetProperty_Float ( schemaNS, propName, propValue, options );
961 wResult->int32Result = found;
962
963 XMP_EXIT_WRAPPER
964 }
965
966 // -------------------------------------------------------------------------------------------------
967
968 void
WXMPMeta_GetProperty_Date_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr propName,XMP_DateTime * propValue,XMP_OptionBits * options,WXMP_Result * wResult)969 WXMPMeta_GetProperty_Date_1 ( XMPMetaRef xmpRef,
970 XMP_StringPtr schemaNS,
971 XMP_StringPtr propName,
972 XMP_DateTime * propValue,
973 XMP_OptionBits * options,
974 WXMP_Result * wResult ) /* const */
975 {
976 XMP_ENTER_WRAPPER ( "WXMPMeta_GetProperty_Date_1" )
977
978 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
979 if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
980
981 if ( propValue == 0 ) propValue = &voidDateTime;
982 if ( options == 0 ) options = &voidOptionBits;
983
984 const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
985 bool found = meta.GetProperty_Date ( schemaNS, propName, propValue, options );
986 wResult->int32Result = found;
987
988 XMP_EXIT_WRAPPER
989 }
990
991 // -------------------------------------------------------------------------------------------------
992
993 void
WXMPMeta_SetProperty_Bool_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr propName,XMP_Bool propValue,XMP_OptionBits options,WXMP_Result * wResult)994 WXMPMeta_SetProperty_Bool_1 ( XMPMetaRef xmpRef,
995 XMP_StringPtr schemaNS,
996 XMP_StringPtr propName,
997 XMP_Bool propValue,
998 XMP_OptionBits options,
999 WXMP_Result * wResult )
1000 {
1001 XMP_ENTER_WRAPPER ( "WXMPMeta_SetProperty_Bool_1" )
1002
1003 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
1004 if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
1005
1006 XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
1007 meta->SetProperty_Bool ( schemaNS, propName, propValue, options );
1008
1009 XMP_EXIT_WRAPPER
1010 }
1011
1012 // -------------------------------------------------------------------------------------------------
1013
1014 void
WXMPMeta_SetProperty_Int_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr propName,XMP_Int32 propValue,XMP_OptionBits options,WXMP_Result * wResult)1015 WXMPMeta_SetProperty_Int_1 ( XMPMetaRef xmpRef,
1016 XMP_StringPtr schemaNS,
1017 XMP_StringPtr propName,
1018 XMP_Int32 propValue,
1019 XMP_OptionBits options,
1020 WXMP_Result * wResult )
1021 {
1022 XMP_ENTER_WRAPPER ( "WXMPMeta_SetProperty_Int_1" )
1023
1024 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
1025 if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
1026
1027 XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
1028 meta->SetProperty_Int ( schemaNS, propName, propValue, options );
1029
1030 XMP_EXIT_WRAPPER
1031 }
1032
1033 // -------------------------------------------------------------------------------------------------
1034
1035 void
WXMPMeta_SetProperty_Int64_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr propName,XMP_Int64 propValue,XMP_OptionBits options,WXMP_Result * wResult)1036 WXMPMeta_SetProperty_Int64_1 ( XMPMetaRef xmpRef,
1037 XMP_StringPtr schemaNS,
1038 XMP_StringPtr propName,
1039 XMP_Int64 propValue,
1040 XMP_OptionBits options,
1041 WXMP_Result * wResult )
1042 {
1043 XMP_ENTER_WRAPPER ( "WXMPMeta_SetProperty_Int64_1" )
1044
1045 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
1046 if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
1047
1048 XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
1049 meta->SetProperty_Int64 ( schemaNS, propName, propValue, options );
1050
1051 XMP_EXIT_WRAPPER
1052 }
1053
1054 // -------------------------------------------------------------------------------------------------
1055
1056 void
WXMPMeta_SetProperty_Float_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr propName,double propValue,XMP_OptionBits options,WXMP_Result * wResult)1057 WXMPMeta_SetProperty_Float_1 ( XMPMetaRef xmpRef,
1058 XMP_StringPtr schemaNS,
1059 XMP_StringPtr propName,
1060 double propValue,
1061 XMP_OptionBits options,
1062 WXMP_Result * wResult )
1063 {
1064 XMP_ENTER_WRAPPER ( "WXMPMeta_SetProperty_Float_1" )
1065
1066 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
1067 if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
1068
1069 XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
1070 meta->SetProperty_Float ( schemaNS, propName, propValue, options );
1071
1072 XMP_EXIT_WRAPPER
1073 }
1074
1075 // -------------------------------------------------------------------------------------------------
1076
1077 void
WXMPMeta_SetProperty_Date_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr propName,const XMP_DateTime & propValue,XMP_OptionBits options,WXMP_Result * wResult)1078 WXMPMeta_SetProperty_Date_1 ( XMPMetaRef xmpRef,
1079 XMP_StringPtr schemaNS,
1080 XMP_StringPtr propName,
1081 const XMP_DateTime & propValue,
1082 XMP_OptionBits options,
1083 WXMP_Result * wResult )
1084 {
1085 XMP_ENTER_WRAPPER ( "WXMPMeta_SetProperty_Date_1" )
1086
1087 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
1088 if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
1089
1090 XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
1091 meta->SetProperty_Date ( schemaNS, propName, propValue, options );
1092
1093 XMP_EXIT_WRAPPER
1094 }
1095
1096 // -------------------------------------------------------------------------------------------------
1097
1098 void
WXMPMeta_DumpObject_1(XMPMetaRef xmpRef,XMP_TextOutputProc outProc,void * refCon,WXMP_Result * wResult)1099 WXMPMeta_DumpObject_1 ( XMPMetaRef xmpRef,
1100 XMP_TextOutputProc outProc,
1101 void * refCon,
1102 WXMP_Result * wResult ) /* const */
1103 {
1104 XMP_ENTER_WRAPPER ( "WXMPMeta_DumpObject_1" )
1105
1106 if ( outProc == 0 ) XMP_Throw ( "Null client output routine", kXMPErr_BadParam );
1107
1108 const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
1109 XMP_Status status = meta.DumpObject ( outProc, refCon );
1110 wResult->int32Result = status;
1111
1112 XMP_EXIT_WRAPPER
1113 }
1114
1115 // -------------------------------------------------------------------------------------------------
1116
1117 void
WXMPMeta_Sort_1(XMPMetaRef xmpRef,WXMP_Result * wResult)1118 WXMPMeta_Sort_1 ( XMPMetaRef xmpRef,
1119 WXMP_Result * wResult )
1120 {
1121 XMP_ENTER_WRAPPER ( "WXMPMeta_Sort_1" )
1122
1123 XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
1124 meta->Sort();
1125
1126 XMP_EXIT_WRAPPER
1127 }
1128
1129 // -------------------------------------------------------------------------------------------------
1130
1131 void
WXMPMeta_Erase_1(XMPMetaRef xmpRef,WXMP_Result * wResult)1132 WXMPMeta_Erase_1 ( XMPMetaRef xmpRef,
1133 WXMP_Result * wResult )
1134 {
1135 XMP_ENTER_WRAPPER ( "WXMPMeta_Erase_1" )
1136
1137 XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
1138 meta->Erase();
1139
1140 XMP_EXIT_WRAPPER
1141 }
1142
1143 // -------------------------------------------------------------------------------------------------
1144
1145 void
WXMPMeta_Clone_1(XMPMetaRef xmpRef,XMP_OptionBits options,WXMP_Result * wResult)1146 WXMPMeta_Clone_1 ( XMPMetaRef xmpRef,
1147 XMP_OptionBits options,
1148 WXMP_Result * wResult ) /* const */
1149 {
1150 XMP_ENTER_WRAPPER ( "WXMPMeta_Clone_1" )
1151
1152 const XMPMeta & xOriginal = WtoXMPMeta_Ref ( xmpRef );
1153 XMPMeta * xClone = new XMPMeta;
1154 xOriginal.Clone ( xClone, options );
1155 XMP_Assert ( xClone->clientRefs == 0 ); // ! Gets incremented in TXMPMeta::Clone.
1156 wResult->ptrResult = xClone;
1157
1158 XMP_EXIT_WRAPPER
1159 }
1160
1161 // -------------------------------------------------------------------------------------------------
1162
1163 void
WXMPMeta_CountArrayItems_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr arrayName,WXMP_Result * wResult)1164 WXMPMeta_CountArrayItems_1 ( XMPMetaRef xmpRef,
1165 XMP_StringPtr schemaNS,
1166 XMP_StringPtr arrayName,
1167 WXMP_Result * wResult ) /* const */
1168 {
1169 XMP_ENTER_WRAPPER ( "WXMPMeta_CountArrayItems_1" )
1170
1171 if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
1172 if ( (arrayName == 0) || (*arrayName == 0) ) XMP_Throw ( "Empty array name", kXMPErr_BadXPath );
1173
1174 const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
1175 XMP_Index count = meta.CountArrayItems ( schemaNS, arrayName );
1176 wResult->int32Result = count;
1177
1178 XMP_EXIT_WRAPPER
1179 }
1180
1181 // -------------------------------------------------------------------------------------------------
1182
1183 void
WXMPMeta_UnlockObject_1(XMPMetaRef xmpRef,XMP_OptionBits options)1184 WXMPMeta_UnlockObject_1 ( XMPMetaRef xmpRef,
1185 XMP_OptionBits options ) /* const */
1186 {
1187 WXMP_Result * wResult = &void_wResult; // ! Needed to "fool" the EnterWrapper macro.
1188 XMP_ENTER_WRAPPER_NO_LOCK ( "WXMPMeta_UnlockObject_1" )
1189
1190 const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
1191 meta.UnlockObject ( options );
1192
1193 XMP_EXIT_WRAPPER_NO_THROW
1194 }
1195
1196 // -------------------------------------------------------------------------------------------------
1197
1198 void
WXMPMeta_GetObjectName_1(XMPMetaRef xmpRef,XMP_StringPtr * namePtr,XMP_StringLen * nameLen,WXMP_Result * wResult)1199 WXMPMeta_GetObjectName_1 ( XMPMetaRef xmpRef,
1200 XMP_StringPtr * namePtr,
1201 XMP_StringLen * nameLen,
1202 WXMP_Result * wResult ) /* const */
1203 {
1204 XMP_ENTER_WRAPPER ( "WXMPMeta_GetObjectName_1" )
1205
1206 if ( namePtr == 0 ) namePtr = &voidStringPtr;
1207 if ( nameLen == 0 ) nameLen = &voidStringLen;
1208
1209 const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
1210 meta.GetObjectName ( namePtr, nameLen );
1211
1212 XMP_EXIT_WRAPPER_KEEP_LOCK ( true ) // ! Always keep the lock, a string is always returned!
1213 }
1214
1215 // -------------------------------------------------------------------------------------------------
1216
1217 void
WXMPMeta_SetObjectName_1(XMPMetaRef xmpRef,XMP_StringPtr name,WXMP_Result * wResult)1218 WXMPMeta_SetObjectName_1 ( XMPMetaRef xmpRef,
1219 XMP_StringPtr name,
1220 WXMP_Result * wResult )
1221 {
1222 XMP_ENTER_WRAPPER ( "WXMPMeta_SetObjectName_1" )
1223
1224 if ( name == 0 ) name = "";
1225
1226 XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
1227 meta->SetObjectName ( name );
1228
1229 XMP_EXIT_WRAPPER
1230 }
1231
1232 // -------------------------------------------------------------------------------------------------
1233
1234 void
WXMPMeta_GetObjectOptions_1(XMPMetaRef xmpRef,WXMP_Result * wResult)1235 WXMPMeta_GetObjectOptions_1 ( XMPMetaRef xmpRef,
1236 WXMP_Result * wResult ) /* const */
1237 {
1238 XMP_ENTER_WRAPPER ( "WXMPMeta_GetObjectOptions_1" )
1239
1240 const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
1241 XMP_OptionBits options = meta.GetObjectOptions();
1242 wResult->int32Result = options;
1243
1244 XMP_EXIT_WRAPPER
1245 }
1246
1247 // -------------------------------------------------------------------------------------------------
1248
1249 void
WXMPMeta_SetObjectOptions_1(XMPMetaRef xmpRef,XMP_OptionBits options,WXMP_Result * wResult)1250 WXMPMeta_SetObjectOptions_1 ( XMPMetaRef xmpRef,
1251 XMP_OptionBits options,
1252 WXMP_Result * wResult )
1253 {
1254 XMP_ENTER_WRAPPER ( "WXMPMeta_SetObjectOptions_1" )
1255
1256 XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
1257 meta->SetObjectOptions ( options );
1258
1259 XMP_EXIT_WRAPPER
1260 }
1261
1262 // -------------------------------------------------------------------------------------------------
1263
1264 void
WXMPMeta_ParseFromBuffer_1(XMPMetaRef xmpRef,XMP_StringPtr buffer,XMP_StringLen bufferSize,XMP_OptionBits options,WXMP_Result * wResult)1265 WXMPMeta_ParseFromBuffer_1 ( XMPMetaRef xmpRef,
1266 XMP_StringPtr buffer,
1267 XMP_StringLen bufferSize,
1268 XMP_OptionBits options,
1269 WXMP_Result * wResult )
1270 {
1271 XMP_ENTER_WRAPPER ( "WXMPMeta_ParseFromBuffer_1" )
1272
1273 XMPMeta * meta = WtoXMPMeta_Ptr ( xmpRef );
1274 meta->ParseFromBuffer ( buffer, bufferSize, options );
1275
1276 XMP_EXIT_WRAPPER
1277 }
1278
1279 // -------------------------------------------------------------------------------------------------
1280
1281 void
WXMPMeta_SerializeToBuffer_1(XMPMetaRef xmpRef,XMP_StringPtr * rdfString,XMP_StringLen * rdfSize,XMP_OptionBits options,XMP_StringLen padding,XMP_StringPtr newline,XMP_StringPtr indent,XMP_Index baseIndent,WXMP_Result * wResult)1282 WXMPMeta_SerializeToBuffer_1 ( XMPMetaRef xmpRef,
1283 XMP_StringPtr * rdfString,
1284 XMP_StringLen * rdfSize,
1285 XMP_OptionBits options,
1286 XMP_StringLen padding,
1287 XMP_StringPtr newline,
1288 XMP_StringPtr indent,
1289 XMP_Index baseIndent,
1290 WXMP_Result * wResult ) /* const */
1291 {
1292 XMP_ENTER_WRAPPER ( "WXMPMeta_SerializeToBuffer_1" )
1293
1294 if ( rdfString == 0 ) rdfString = &voidStringPtr;
1295 if ( rdfSize == 0 ) rdfSize = &voidStringLen;
1296
1297 if ( newline == 0 ) newline = "";
1298 if ( indent == 0 ) indent = "";
1299
1300 const XMPMeta & meta = WtoXMPMeta_Ref ( xmpRef );
1301 meta.SerializeToBuffer ( rdfString, rdfSize, options, padding, newline, indent, baseIndent );
1302
1303 XMP_EXIT_WRAPPER_KEEP_LOCK ( true ) // ! Always keep the lock, a string is always returned!
1304 }
1305
1306 // =================================================================================================
1307
1308 #if __cplusplus
1309 } /* extern "C" */
1310 #endif
1311