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