Debian Codegraph @

xmpsdk/include/client-glue/TXMPMeta.incl_cpp

raw
1 // =================================================================================================
2 // ADOBE SYSTEMS INCORPORATED
3 // Copyright 2002-2008 Adobe Systems Incorporated
4 // All Rights Reserved
5 //
6 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
7 // of the Adobe license agreement accompanying it.
8 // =================================================================================================
9
10 // ================================================================================================
11 /// \file TXMPMeta.incl_cpp
12 /// \brief The implementation of the TXMPMeta template class.
13
14 #include "XMPSDK.hpp"
15 #include "client-glue/WXMP_Common.hpp"
16 #include "client-glue/WXMPMeta.hpp"
17
18 // =================================================================================================
19 // Implementation Guidelines
20 // =========================
21 //
22 // The implementations of the template functions are very stylized. ...
23 //
24 // =================================================================================================
25
26 #ifndef XMP_TraceCTorDTor
27 #define XMP_TraceCTorDTor 0
28 #endif
29
30 #if XMP_TraceCTorDTor
31 class XMPeek { // Hack to peek at the client ref count in the internal object.
32 public:
33 XMPeek();
34 virtual ~XMPeek();
35 XMP_Int32 clientRefs;
36 };
37 #endif
38
39 // =================================================================================================
40 // Local utilities
41 // ===============
42
43 // -------------------------------------------------------------------------------------------------
44
45 class TOPW_Info {
46 public:
47 XMP_TextOutputProc clientProc;
48 void * clientRefCon;
49 TOPW_Info ( XMP_TextOutputProc proc, void * refCon ) : clientProc(proc), clientRefCon(refCon) {};
50 private:
51 TOPW_Info() {}; // ! Hide default constructor.
52 };
53
54 static XMP_Status TextOutputProcWrapper ( void * refCon,
55 XMP_StringPtr buffer,
56 XMP_StringLen bufferSize )
57 {
58 try { // Don't let client callback exceptions propagate across DLL boundaries.
59 TOPW_Info * info = (TOPW_Info*)refCon;
60 return info->clientProc ( info->clientRefCon, buffer, bufferSize );
61 } catch ( ... ) {
62 return -1;
63 }
64 }
65
66 // =================================================================================================
67 // Initialization and termination
68 // ==============================
69
70 XMP_MethodIntro(TXMPMeta,void)::
71 GetVersionInfo ( XMP_VersionInfo * info )
72 {
73 WrapNoCheckVoid ( zXMPMeta_GetVersionInfo_1 ( info ) );
74 }
75
76 // -------------------------------------------------------------------------------------------------
77
78 XMP_MethodIntro(TXMPMeta,bool)::
79 Initialize()
80 {
81 WrapCheckBool ( ok, zXMPMeta_Initialize_1() );
82 return ok;
83 }
84 // -------------------------------------------------------------------------------------------------
85
86 XMP_MethodIntro(TXMPMeta,void)::
87 Terminate()
88 {
89 WrapNoCheckVoid ( zXMPMeta_Terminate_1() );
90 }
91
92 // =================================================================================================
93 // Constuctors, destructor, operators
94 // ==================================
95
96 static XMPMetaRef DefaultCTor()
97 {
98 WrapCheckMetaRef ( newRef, zXMPMeta_CTor_1() );
99 return newRef;
100 }
101
102 // -------------------------------------------------------------------------------------------------
103
104 XMP_CTorDTorIntro(TXMPMeta)::
105 TXMPMeta() : xmpRef(DefaultCTor())
106 {
107 #if XMP_TraceCTorDTor
108 XMPeek* xmPtr = (XMPeek*)this->xmpRef;
109 printf ( "Default construct TXMPMeta @ %.8X, ref = %.8X, count = %d\n", this, xmPtr, xmPtr->clientRefs );
110 #endif
111 }
112
113 // -------------------------------------------------------------------------------------------------
114
115 XMP_CTorDTorIntro(TXMPMeta)::
116 TXMPMeta ( const TXMPMeta<tStringObj> & original ) : xmpRef(original.xmpRef)
117 {
118 WXMPMeta_IncrementRefCount_1 ( this->xmpRef );
119 #if XMP_TraceCTorDTor
120 XMPeek* xmPtr = (XMPeek*)this->xmpRef;
121 printf ( "Copy construct TXMPMeta @ %.8X, ref = %.8X, count = %d\n", this, xmPtr, xmPtr->clientRefs );
122 #endif
123 }
124
125 // -------------------------------------------------------------------------------------------------
126
127 XMP_MethodIntro(TXMPMeta,void)::
128 operator= ( const TXMPMeta<tStringObj> & rhs )
129 {
130 #if XMP_TraceCTorDTor
131 XMPeek* xmLHS = (XMPeek*)this->xmpRef;
132 XMPeek* xmRHS = (XMPeek*)rhs.xmpRef;
133 printf ( "Assign TXMPMeta, lhs @ %.8X, rhs @ %.8X\n", this, &rhs );
134 printf ( " original lhs ref = %.8X, count = %d\n", xmLHS, xmLHS->clientRefs );
135 printf ( " original rhs ref = %.8X, count = %d\n", xmRHS, xmRHS->clientRefs );
136 #endif
137 XMPMetaRef oldRef = this->xmpRef; // ! Decrement last so errors leave client object OK.
138 this->xmpRef = rhs.xmpRef;
139 WXMPMeta_IncrementRefCount_1 ( this->xmpRef ); // Increment the count on the new ref.
140 WXMPMeta_DecrementRefCount_1 ( oldRef ); // Decrement the count on the old ref.
141 #if XMP_TraceCTorDTor
142 printf ( " result lhs ref = %.8X, count = %d\n", xmLHS, xmLHS->clientRefs );
143 #endif
144 }
145
146 // -------------------------------------------------------------------------------------------------
147
148 XMP_CTorDTorIntro(TXMPMeta)::
149 TXMPMeta ( XMPMetaRef _xmpRef ) : xmpRef(_xmpRef)
150 {
151 WXMPMeta_IncrementRefCount_1 ( this->xmpRef );
152 #if XMP_TraceCTorDTor
153 XMPeek* xmPtr = (XMPeek*)this->xmpRef;
154 printf ( "Ref construct TXMPMeta @ %.8X, ref = %.8X, count = %d\n", this, xmPtr, xmPtr->clientRefs );
155 #endif
156 }
157
158 // -------------------------------------------------------------------------------------------------
159
160 XMP_CTorDTorIntro(TXMPMeta)::
161 TXMPMeta ( XMP_StringPtr buffer,
162 XMP_StringLen xmpSize ) : xmpRef(DefaultCTor())
163 {
164 #if XMP_TraceCTorDTor
165 XMPeek* xmPtr = (XMPeek*)this->xmpRef;
166 printf ( "Parse construct TXMPMeta @ %.8X, ref = %.8X, count = %d\n", this, xmPtr, xmPtr->clientRefs );
167 #endif
168 try {
169 this->ParseFromBuffer ( buffer, xmpSize );
170 } catch ( ... ) {
171 WXMPMeta_DecrementRefCount_1 ( this->xmpRef );
172 this->xmpRef = 0;
173 throw;
174 }
175 }
176
177 // -------------------------------------------------------------------------------------------------
178
179 XMP_CTorDTorIntro(TXMPMeta)::
180 ~TXMPMeta() throw()
181 {
182 #if XMP_TraceCTorDTor
183 XMPeek* xmPtr = (XMPeek*)this->xmpRef;
184 printf ( "Destruct TXMPMeta @ %.8X, ref = %.8X, count = %d\n", this, xmPtr, xmPtr->clientRefs );
185 #endif
186 WXMPMeta_DecrementRefCount_1 ( this->xmpRef );
187 this->xmpRef = 0;
188
189 } // ~TXMPMeta ()
190
191 // =================================================================================================
192 // Global state functions
193 // ======================
194
195 XMP_MethodIntro(TXMPMeta,XMP_OptionBits)::
196 GetGlobalOptions()
197 {
198 WrapCheckOptions ( options, zXMPMeta_GetGlobalOptions_1() );
199 return options;
200 }
201
202 // -------------------------------------------------------------------------------------------------
203
204 XMP_MethodIntro(TXMPMeta,void)::
205 SetGlobalOptions ( XMP_OptionBits options )
206 {
207 WrapCheckVoid ( zXMPMeta_SetGlobalOptions_1 ( options ) );
208 }
209
210 // -------------------------------------------------------------------------------------------------
211
212 // -------------------------------------------------------------------------------------------------
213
214 XMP_MethodIntro(TXMPMeta,XMP_Status)::
215 DumpNamespaces ( XMP_TextOutputProc outProc,
216 void * refCon )
217 {
218 TOPW_Info info ( outProc, refCon );
219 WrapCheckStatus ( status, zXMPMeta_DumpNamespaces_1 ( TextOutputProcWrapper, &info ) );
220 return status;
221 }
222
223 // -------------------------------------------------------------------------------------------------
224
225 XMP_MethodIntro(TXMPMeta,XMP_Status)::
226 DumpAliases ( XMP_TextOutputProc outProc,
227 void * refCon )
228 {
229 TOPW_Info info ( outProc, refCon );
230 WrapCheckStatus ( status, zXMPMeta_DumpAliases_1 ( TextOutputProcWrapper, &info ) );
231 return status;
232 }
233
234 // -------------------------------------------------------------------------------------------------
235
236 XMP_MethodIntro(TXMPMeta,void)::
237 RegisterNamespace ( XMP_StringPtr namespaceURI,
238 XMP_StringPtr prefix )
239 {
240 WrapCheckVoid ( zXMPMeta_RegisterNamespace_1 ( namespaceURI, prefix ) );
241 }
242
243 // -------------------------------------------------------------------------------------------------
244
245 XMP_MethodIntro(TXMPMeta,bool)::
246 GetNamespacePrefix ( XMP_StringPtr namespaceURI,
247 tStringObj * namespacePrefix )
248 {
249 XMP_StringPtr resultPtr = 0;
250 XMP_StringLen resultLen = 0;
251 WrapCheckBool ( found, zXMPMeta_GetNamespacePrefix_1 ( namespaceURI, &resultPtr, &resultLen ) );
252 if ( found ) {
253 if ( namespacePrefix != 0 ) namespacePrefix->assign ( resultPtr, resultLen );
254 WXMPMeta_Unlock_1 ( 0 );
255 }
256 return found;
257 }
258
259 // -------------------------------------------------------------------------------------------------
260
261 XMP_MethodIntro(TXMPMeta,bool)::
262 GetNamespaceURI ( XMP_StringPtr namespacePrefix,
263 tStringObj * namespaceURI )
264 {
265 XMP_StringPtr resultPtr = 0;
266 XMP_StringLen resultLen = 0;
267 WrapCheckBool ( found, zXMPMeta_GetNamespaceURI_1 ( namespacePrefix, &resultPtr, &resultLen ) );
268 if ( found ) {
269 if ( namespaceURI != 0 ) namespaceURI->assign ( resultPtr, resultLen );
270 WXMPMeta_Unlock_1 ( 0 );
271 }
272 return found;
273 }
274
275 // -------------------------------------------------------------------------------------------------
276
277 XMP_MethodIntro(TXMPMeta,void)::
278 DeleteNamespace ( XMP_StringPtr namespaceURI )
279 {
280 WrapCheckVoid ( zXMPMeta_DeleteNamespace_1 ( namespaceURI ) );
281 }
282
283 // -------------------------------------------------------------------------------------------------
284
285 XMP_MethodIntro(TXMPMeta,void)::
286 RegisterAlias ( XMP_StringPtr aliasNS,
287 XMP_StringPtr aliasProp,
288 XMP_StringPtr actualNS,
289 XMP_StringPtr actualProp,
290 XMP_OptionBits arrayForm )
291 {
292 WrapCheckVoid ( zXMPMeta_RegisterAlias_1 ( aliasNS, aliasProp, actualNS, actualProp, arrayForm ) );
293 }
294
295 // -------------------------------------------------------------------------------------------------
296
297 XMP_MethodIntro(TXMPMeta,bool)::
298 ResolveAlias ( XMP_StringPtr aliasNS,
299 XMP_StringPtr aliasProp,
300 tStringObj * actualNS,
301 tStringObj * actualProp,
302 XMP_OptionBits * arrayForm )
303 {
304 XMP_StringPtr nsPtr = 0;
305 XMP_StringLen nsLen = 0;
306 XMP_StringPtr propPtr = 0;
307 XMP_StringLen propLen = 0;
308 WrapCheckBool ( found, zXMPMeta_ResolveAlias_1 ( aliasNS, aliasProp, &nsPtr, &nsLen, &propPtr, &propLen, arrayForm ) );
309 if ( found ) {
310 if ( actualNS != 0 ) actualNS->assign ( nsPtr, nsLen );
311 if ( actualProp != 0 ) actualProp->assign ( propPtr, propLen );
312 WXMPMeta_Unlock_1 ( 0 );
313 }
314 return found;
315 }
316
317 // -------------------------------------------------------------------------------------------------
318
319 XMP_MethodIntro(TXMPMeta,void)::
320 DeleteAlias ( XMP_StringPtr aliasNS,
321 XMP_StringPtr aliasProp )
322 {
323 WrapCheckVoid ( zXMPMeta_DeleteAlias_1 ( aliasNS, aliasProp ) );
324 }
325
326 // -------------------------------------------------------------------------------------------------
327
328 XMP_MethodIntro(TXMPMeta,void)::
329 RegisterStandardAliases ( XMP_StringPtr schemaNS )
330 {
331 WrapCheckVoid ( zXMPMeta_RegisterStandardAliases_1 ( schemaNS ) );
332 }
333
334 // =================================================================================================
335 // Basic property manipulation functions
336 // =====================================
337
338 XMP_MethodIntro(TXMPMeta,bool)::
339 GetProperty ( XMP_StringPtr schemaNS,
340 XMP_StringPtr propName,
341 tStringObj * propValue,
342 XMP_OptionBits * options ) const
343 {
344 XMP_StringPtr resultPtr = 0;
345 XMP_StringLen resultLen = 0;
346 WrapCheckBool ( found, zXMPMeta_GetProperty_1 ( schemaNS, propName, &resultPtr, &resultLen, options ) );
347 if ( found ) {
348 if ( propValue != 0 ) propValue->assign ( resultPtr, resultLen );
349 WXMPMeta_UnlockObject_1 ( this->xmpRef, 0 );
350 }
351 return found;
352 }
353
354 // -------------------------------------------------------------------------------------------------
355
356 XMP_MethodIntro(TXMPMeta,bool)::
357 GetArrayItem ( XMP_StringPtr schemaNS,
358 XMP_StringPtr arrayName,
359 XMP_Index itemIndex,
360 tStringObj * itemValue,
361 XMP_OptionBits * options ) const
362 {
363 XMP_StringPtr resultPtr = 0;
364 XMP_StringLen resultLen = 0;
365 WrapCheckBool ( found, zXMPMeta_GetArrayItem_1 ( schemaNS, arrayName, itemIndex, &resultPtr, &resultLen, options ) );
366 if ( found ) {
367 if ( itemValue != 0 ) itemValue->assign ( resultPtr, resultLen );
368 WXMPMeta_UnlockObject_1 ( this->xmpRef, 0 );
369 }
370 return found;
371 }
372
373 // -------------------------------------------------------------------------------------------------
374
375 XMP_MethodIntro(TXMPMeta,bool)::
376 GetStructField ( XMP_StringPtr schemaNS,
377 XMP_StringPtr structName,
378 XMP_StringPtr fieldNS,
379 XMP_StringPtr fieldName,
380 tStringObj * fieldValue,
381 XMP_OptionBits * options ) const
382 {
383 XMP_StringPtr resultPtr = 0;
384 XMP_StringLen resultLen = 0;
385 WrapCheckBool ( found, zXMPMeta_GetStructField_1 ( schemaNS, structName, fieldNS, fieldName, &resultPtr, &resultLen, options ) );
386 if ( found ) {
387 if ( fieldValue != 0 ) fieldValue->assign ( resultPtr, resultLen );
388 WXMPMeta_UnlockObject_1 ( this->xmpRef, 0 );
389 }
390 return found;
391 }
392
393 // -------------------------------------------------------------------------------------------------
394
395 XMP_MethodIntro(TXMPMeta,bool)::
396 GetQualifier ( XMP_StringPtr schemaNS,
397 XMP_StringPtr propName,
398 XMP_StringPtr qualNS,
399 XMP_StringPtr qualName,
400 tStringObj * qualValue,
401 XMP_OptionBits * options ) const
402 {
403 XMP_StringPtr resultPtr = 0;
404 XMP_StringLen resultLen = 0;
405 WrapCheckBool ( found, zXMPMeta_GetQualifier_1 ( schemaNS, propName, qualNS, qualName, &resultPtr, &resultLen, options ) );
406 if ( found ) {
407 if ( qualValue != 0 ) qualValue->assign ( resultPtr, resultLen );
408 WXMPMeta_UnlockObject_1 ( this->xmpRef, 0 );
409 }
410 return found;
411 } //GetQualifier ()
412
413 // -------------------------------------------------------------------------------------------------
414
415 XMP_MethodIntro(TXMPMeta,void)::
416 SetProperty ( XMP_StringPtr schemaNS,
417 XMP_StringPtr propName,
418 XMP_StringPtr propValue,
419 XMP_OptionBits options /* = 0 */ )
420 {
421 WrapCheckVoid ( zXMPMeta_SetProperty_1 ( schemaNS, propName, propValue, options ) );
422 }
423
424 // -------------------------------------------------------------------------------------------------
425
426 XMP_MethodIntro(TXMPMeta,void)::
427 SetProperty ( XMP_StringPtr schemaNS,
428 XMP_StringPtr propName,
429 const tStringObj & propValue,
430 XMP_OptionBits options /* = 0 */ )
431 {
432 this->SetProperty ( schemaNS, propName, propValue.c_str(), options );
433 }
434
435 // -------------------------------------------------------------------------------------------------
436
437 XMP_MethodIntro(TXMPMeta,void)::
438 SetArrayItem ( XMP_StringPtr schemaNS,
439 XMP_StringPtr arrayName,
440 XMP_Index itemIndex,
441 XMP_StringPtr itemValue,
442 XMP_OptionBits options /* = 0 */ )
443 {
444 WrapCheckVoid ( zXMPMeta_SetArrayItem_1 ( schemaNS, arrayName, itemIndex, itemValue, options ) );
445 }
446
447 // -------------------------------------------------------------------------------------------------
448
449 XMP_MethodIntro(TXMPMeta,void)::
450 SetArrayItem ( XMP_StringPtr schemaNS,
451 XMP_StringPtr arrayName,
452 XMP_Index itemIndex,
453 const tStringObj & itemValue,
454 XMP_OptionBits options /* = 0 */ )
455 {
456 this->SetArrayItem ( schemaNS, arrayName, itemIndex, itemValue.c_str(), options );
457 }
458
459 // -------------------------------------------------------------------------------------------------
460
461 XMP_MethodIntro(TXMPMeta,void)::
462 AppendArrayItem ( XMP_StringPtr schemaNS,
463 XMP_StringPtr arrayName,
464 XMP_OptionBits arrayOptions,
465 XMP_StringPtr itemValue,
466 XMP_OptionBits options /* = 0 */ )
467 {
468 WrapCheckVoid ( zXMPMeta_AppendArrayItem_1 ( schemaNS, arrayName, arrayOptions, itemValue, options ) );
469 }
470
471 // -------------------------------------------------------------------------------------------------
472
473 XMP_MethodIntro(TXMPMeta,void)::
474 AppendArrayItem ( XMP_StringPtr schemaNS,
475 XMP_StringPtr arrayName,
476 XMP_OptionBits arrayOptions,
477 const tStringObj & itemValue,
478 XMP_OptionBits options /* = 0 */ )
479 {
480 this->AppendArrayItem ( schemaNS, arrayName, arrayOptions, itemValue.c_str(), options );
481 }
482
483 // -------------------------------------------------------------------------------------------------
484
485 XMP_MethodIntro(TXMPMeta,void)::
486 SetStructField ( XMP_StringPtr schemaNS,
487 XMP_StringPtr structName,
488 XMP_StringPtr fieldNS,
489 XMP_StringPtr fieldName,
490 XMP_StringPtr fieldValue,
491 XMP_OptionBits options /* = 0 */ )
492 {
493 WrapCheckVoid ( zXMPMeta_SetStructField_1 ( schemaNS, structName, fieldNS, fieldName, fieldValue, options ) );
494 }
495
496 // -------------------------------------------------------------------------------------------------
497
498 XMP_MethodIntro(TXMPMeta,void)::
499 SetStructField ( XMP_StringPtr schemaNS,
500 XMP_StringPtr structName,
501 XMP_StringPtr fieldNS,
502 XMP_StringPtr fieldName,
503 const tStringObj & fieldValue,
504 XMP_OptionBits options /* = 0 */ )
505 {
506 this->SetStructField ( schemaNS, structName, fieldNS, fieldName, fieldValue.c_str(), options );
507 }
508
509 // -------------------------------------------------------------------------------------------------
510
511 XMP_MethodIntro(TXMPMeta,void)::
512 SetQualifier ( XMP_StringPtr schemaNS,
513 XMP_StringPtr propName,
514 XMP_StringPtr qualNS,
515 XMP_StringPtr qualName,
516 XMP_StringPtr qualValue,
517 XMP_OptionBits options /* = 0 */ )
518 {
519 WrapCheckVoid ( zXMPMeta_SetQualifier_1 ( schemaNS, propName, qualNS, qualName, qualValue, options ) );
520 }
521
522 // -------------------------------------------------------------------------------------------------
523
524 XMP_MethodIntro(TXMPMeta,void)::
525 SetQualifier ( XMP_StringPtr schemaNS,
526 XMP_StringPtr propName,
527 XMP_StringPtr qualNS,
528 XMP_StringPtr qualName,
529 const tStringObj & qualValue,
530 XMP_OptionBits options /* = 0 */ )
531 {
532 this->SetQualifier ( schemaNS, propName, qualNS, qualName, qualValue.c_str(), options );
533 }
534
535 // -------------------------------------------------------------------------------------------------
536
537 XMP_MethodIntro(TXMPMeta,void)::
538 DeleteProperty ( XMP_StringPtr schemaNS,
539 XMP_StringPtr propName )
540 {
541 WrapCheckVoid ( zXMPMeta_DeleteProperty_1 ( schemaNS, propName ) );
542 }
543
544 // -------------------------------------------------------------------------------------------------
545
546 XMP_MethodIntro(TXMPMeta,void)::
547 DeleteArrayItem ( XMP_StringPtr schemaNS,
548 XMP_StringPtr arrayName,
549 XMP_Index itemIndex )
550 {
551 WrapCheckVoid ( zXMPMeta_DeleteArrayItem_1 ( schemaNS, arrayName, itemIndex ) );
552 }
553
554 // -------------------------------------------------------------------------------------------------
555
556 XMP_MethodIntro(TXMPMeta,void)::
557 DeleteStructField ( XMP_StringPtr schemaNS,
558 XMP_StringPtr structName,
559 XMP_StringPtr fieldNS,
560 XMP_StringPtr fieldName )
561 {
562 WrapCheckVoid ( zXMPMeta_DeleteStructField_1 ( schemaNS, structName, fieldNS, fieldName ) );
563 }
564
565 // -------------------------------------------------------------------------------------------------
566
567 XMP_MethodIntro(TXMPMeta,void)::
568 DeleteQualifier ( XMP_StringPtr schemaNS,
569 XMP_StringPtr propName,
570 XMP_StringPtr qualNS,
571 XMP_StringPtr qualName )
572 {
573 WrapCheckVoid ( zXMPMeta_DeleteQualifier_1 ( schemaNS, propName, qualNS, qualName ) );
574 }
575
576 // -------------------------------------------------------------------------------------------------
577
578 XMP_MethodIntro(TXMPMeta,bool)::
579 DoesPropertyExist ( XMP_StringPtr schemaNS,
580 XMP_StringPtr propName ) const
581 {
582 WrapCheckBool ( exists, zXMPMeta_DoesPropertyExist_1 ( schemaNS, propName ) );
583 return exists;
584 }
585
586 // -------------------------------------------------------------------------------------------------
587
588 XMP_MethodIntro(TXMPMeta,bool)::
589 DoesArrayItemExist ( XMP_StringPtr schemaNS,
590 XMP_StringPtr arrayName,
591 XMP_Index itemIndex ) const
592 {
593 WrapCheckBool ( exists, zXMPMeta_DoesArrayItemExist_1 ( schemaNS, arrayName, itemIndex ) );
594 return exists;
595 }
596
597 // -------------------------------------------------------------------------------------------------
598
599 XMP_MethodIntro(TXMPMeta,bool)::
600 DoesStructFieldExist ( XMP_StringPtr schemaNS,
601 XMP_StringPtr structName,
602 XMP_StringPtr fieldNS,
603 XMP_StringPtr fieldName ) const
604 {
605 WrapCheckBool ( exists, zXMPMeta_DoesStructFieldExist_1 ( schemaNS, structName, fieldNS, fieldName ) );
606 return exists;
607 }
608
609 // -------------------------------------------------------------------------------------------------
610
611 XMP_MethodIntro(TXMPMeta,bool)::
612 DoesQualifierExist ( XMP_StringPtr schemaNS,
613 XMP_StringPtr propName,
614 XMP_StringPtr qualNS,
615 XMP_StringPtr qualName ) const
616 {
617 WrapCheckBool ( exists, zXMPMeta_DoesQualifierExist_1 ( schemaNS, propName, qualNS, qualName ) );
618 return exists;
619 }
620
621 // =================================================================================================
622 // Specialized Get and Set functions
623 // =================================
624
625 XMP_MethodIntro(TXMPMeta,bool)::
626 GetLocalizedText ( XMP_StringPtr schemaNS,
627 XMP_StringPtr altTextName,
628 XMP_StringPtr genericLang,
629 XMP_StringPtr specificLang,
630 tStringObj * actualLang,
631 tStringObj * itemValue,
632 XMP_OptionBits * options ) const
633 {
634 XMP_StringPtr langPtr = 0;
635 XMP_StringLen langLen = 0;
636 XMP_StringPtr itemPtr = 0;
637 XMP_StringLen itemLen = 0;
638 WrapCheckBool ( found, zXMPMeta_GetLocalizedText_1 ( schemaNS, altTextName, genericLang, specificLang,
639 &langPtr, &langLen, &itemPtr, &itemLen, options ) );
640 if ( found ) {
641 if ( actualLang != 0 ) actualLang->assign ( langPtr, langLen );
642 if ( itemValue != 0 ) itemValue->assign ( itemPtr, itemLen );
643 WXMPMeta_UnlockObject_1 ( this->xmpRef, kXMP_NoOptions );
644 }
645 return found;
646 }
647
648 // -------------------------------------------------------------------------------------------------
649
650 XMP_MethodIntro(TXMPMeta,void)::
651 SetLocalizedText ( XMP_StringPtr schemaNS,
652 XMP_StringPtr altTextName,
653 XMP_StringPtr genericLang,
654 XMP_StringPtr specificLang,
655 XMP_StringPtr itemValue,
656 XMP_OptionBits options /* = 0 */ )
657 {
658 WrapCheckVoid ( zXMPMeta_SetLocalizedText_1 ( schemaNS, altTextName, genericLang, specificLang, itemValue, options ) );
659 }
660
661 // -------------------------------------------------------------------------------------------------
662
663 XMP_MethodIntro(TXMPMeta,void)::
664 SetLocalizedText ( XMP_StringPtr schemaNS,
665 XMP_StringPtr altTextName,
666 XMP_StringPtr genericLang,
667 XMP_StringPtr specificLang,
668 const tStringObj & itemValue,
669 XMP_OptionBits options /* = 0 */ )
670 {
671 this->SetLocalizedText ( schemaNS, altTextName, genericLang, specificLang, itemValue.c_str(), options );
672 }
673
674 // -------------------------------------------------------------------------------------------------
675
676 XMP_MethodIntro(TXMPMeta,bool)::
677 GetProperty_Bool ( XMP_StringPtr schemaNS,
678 XMP_StringPtr propName,
679 bool * propValue,
680 XMP_OptionBits * options ) const
681 {
682 XMP_Bool binValue;
683 WrapCheckBool ( found, zXMPMeta_GetProperty_Bool_1 ( schemaNS, propName, &binValue, options ) );
684 if ( found && (propValue != 0) ) *propValue = binValue;
685 return found;
686 }
687
688 // -------------------------------------------------------------------------------------------------
689
690 XMP_MethodIntro(TXMPMeta,bool)::
691 GetProperty_Int ( XMP_StringPtr schemaNS,
692 XMP_StringPtr propName,
693 long * propValue,
694 XMP_OptionBits * options ) const
695 {
696 XMP_Int32 abiValue;
697 WrapCheckBool ( found, zXMPMeta_GetProperty_Int_1 ( schemaNS, propName, &abiValue, options ) );
698 if ( found && (propValue != 0) ) *propValue = abiValue;
699 return found;
700 }
701
702 // -------------------------------------------------------------------------------------------------
703
704 XMP_MethodIntro(TXMPMeta,bool)::
705 GetProperty_Int64 ( XMP_StringPtr schemaNS,
706 XMP_StringPtr propName,
707 long long * propValue,
708 XMP_OptionBits * options ) const
709 {
710 XMP_Int64 abiValue;
711 WrapCheckBool ( found, zXMPMeta_GetProperty_Int64_1 ( schemaNS, propName, &abiValue, options ) );
712 if ( found && (propValue != 0) ) *propValue = abiValue;
713 return found;
714 }
715
716 // -------------------------------------------------------------------------------------------------
717
718 XMP_MethodIntro(TXMPMeta,bool)::
719 GetProperty_Float ( XMP_StringPtr schemaNS,
720 XMP_StringPtr propName,
721 double * propValue,
722 XMP_OptionBits * options ) const
723 {
724 WrapCheckBool ( found, zXMPMeta_GetProperty_Float_1 ( schemaNS, propName, propValue, options ) );
725 return found;
726 }
727
728 // -------------------------------------------------------------------------------------------------
729
730 XMP_MethodIntro(TXMPMeta,bool)::
731 GetProperty_Date ( XMP_StringPtr schemaNS,
732 XMP_StringPtr propName,
733 XMP_DateTime * propValue,
734 XMP_OptionBits * options ) const
735 {
736 WrapCheckBool ( found, zXMPMeta_GetProperty_Date_1 ( schemaNS, propName, propValue, options ) );
737 return found;
738 }
739
740 // -------------------------------------------------------------------------------------------------
741
742 XMP_MethodIntro(TXMPMeta,void)::
743 SetProperty_Bool ( XMP_StringPtr schemaNS,
744 XMP_StringPtr propName,
745 bool propValue,
746 XMP_OptionBits options /* = 0 */ )
747 {
748 WrapCheckVoid ( zXMPMeta_SetProperty_Bool_1 ( schemaNS, propName, propValue, options ) );
749 }
750
751 // -------------------------------------------------------------------------------------------------
752
753 XMP_MethodIntro(TXMPMeta,void)::
754 SetProperty_Int ( XMP_StringPtr schemaNS,
755 XMP_StringPtr propName,
756 long propValue,
757 XMP_OptionBits options /* = 0 */ )
758 {
759 WrapCheckVoid ( zXMPMeta_SetProperty_Int_1 ( schemaNS, propName, propValue, options ) );
760 }
761
762 // -------------------------------------------------------------------------------------------------
763
764 XMP_MethodIntro(TXMPMeta,void)::
765 SetProperty_Int64 ( XMP_StringPtr schemaNS,
766 XMP_StringPtr propName,
767 long long propValue,
768 XMP_OptionBits options /* = 0 */ )
769 {
770 WrapCheckVoid ( zXMPMeta_SetProperty_Int64_1 ( schemaNS, propName, propValue, options ) );
771 }
772
773 // -------------------------------------------------------------------------------------------------
774
775 XMP_MethodIntro(TXMPMeta,void)::
776 SetProperty_Float ( XMP_StringPtr schemaNS,
777 XMP_StringPtr propName,
778 double propValue,
779 XMP_OptionBits options /* = 0 */ )
780 {
781 WrapCheckVoid ( zXMPMeta_SetProperty_Float_1 ( schemaNS, propName, propValue, options ) );
782 }
783
784 // -------------------------------------------------------------------------------------------------
785
786 XMP_MethodIntro(TXMPMeta,void)::
787 SetProperty_Date ( XMP_StringPtr schemaNS,
788 XMP_StringPtr propName,
789 const XMP_DateTime & propValue,
790 XMP_OptionBits options /* = 0 */ )
791 {
792 WrapCheckVoid ( zXMPMeta_SetProperty_Date_1 ( schemaNS, propName, propValue, options ) );
793 }
794
795 // =================================================================================================
796 // Miscellaneous Member Functions
797 // ==============================
798
799 XMP_MethodIntro(TXMPMeta,XMPMetaRef)::
800 GetInternalRef() const
801 {
802 return this->xmpRef;
803 }
804
805 // -------------------------------------------------------------------------------------------------
806
807 XMP_MethodIntro(TXMPMeta,void)::
808 GetObjectName ( tStringObj * name ) const
809 {
810 XMP_StringPtr namePtr = 0;
811 XMP_StringLen nameLen = 0;
812 WrapCheckVoid ( zXMPMeta_GetObjectName_1 ( &namePtr, &nameLen ) );
813 if ( name != 0 ) name->assign ( namePtr, nameLen );
814 WXMPMeta_UnlockObject_1 ( this->xmpRef, 0 );
815 }
816
817 // -------------------------------------------------------------------------------------------------
818
819 XMP_MethodIntro(TXMPMeta,void)::
820 SetObjectName ( XMP_StringPtr name )
821 {
822 WrapCheckVoid ( zXMPMeta_SetObjectName_1 ( name ) );
823 }
824
825 // -------------------------------------------------------------------------------------------------
826
827 XMP_MethodIntro(TXMPMeta,void)::
828 SetObjectName ( tStringObj name )
829 {
830 this->SetObjectName ( name.c_str() );
831 }
832
833 // -------------------------------------------------------------------------------------------------
834
835 XMP_MethodIntro(TXMPMeta,XMP_OptionBits)::
836 GetObjectOptions() const
837 {
838 WrapCheckOptions ( options, zXMPMeta_GetObjectOptions_1() );
839 return options;
840 }
841
842 // -------------------------------------------------------------------------------------------------
843
844 XMP_MethodIntro(TXMPMeta,void)::
845 SetObjectOptions ( XMP_OptionBits options )
846 {
847 WrapCheckVoid ( zXMPMeta_SetObjectOptions_1 ( options ) );
848 }
849
850 // -------------------------------------------------------------------------------------------------
851
852 XMP_MethodIntro(TXMPMeta,void)::
853 Sort()
854 {
855 WrapCheckVoid ( zXMPMeta_Sort_1() );
856 }
857
858 // -------------------------------------------------------------------------------------------------
859
860 XMP_MethodIntro(TXMPMeta,void)::
861 Erase()
862 {
863 WrapCheckVoid ( zXMPMeta_Erase_1() );
864 }
865
866 // -------------------------------------------------------------------------------------------------
867
868 XMP_MethodIntro(TXMPMeta,TXMPMeta<tStringObj>)::
869 Clone ( XMP_OptionBits options ) const
870 {
871 WrapCheckMetaRef ( cloneRef, zXMPMeta_Clone_1 ( options ) );
872 return TXMPMeta<tStringObj> ( cloneRef ); // Ref construct will increment the clientRefs.
873 }
874
875 // -------------------------------------------------------------------------------------------------
876
877 XMP_MethodIntro(TXMPMeta,XMP_Index)::
878 CountArrayItems ( XMP_StringPtr schemaNS,
879 XMP_StringPtr arrayName ) const
880 {
881 WrapCheckIndex ( count, zXMPMeta_CountArrayItems_1 ( schemaNS, arrayName ) );
882 return count;
883 }
884
885 // -------------------------------------------------------------------------------------------------
886
887 XMP_MethodIntro(TXMPMeta,XMP_Status)::
888 DumpObject ( XMP_TextOutputProc outProc,
889 void * refCon ) const
890 {
891 TOPW_Info info ( outProc, refCon );
892 WrapCheckStatus ( status, zXMPMeta_DumpObject_1 ( TextOutputProcWrapper, &info ) );
893 return status;
894 }
895
896 // -------------------------------------------------------------------------------------------------
897
898 XMP_MethodIntro(TXMPMeta,void)::
899 ParseFromBuffer ( XMP_StringPtr buffer,
900 XMP_StringLen bufferSize,
901 XMP_OptionBits options /* = 0 */ )
902 {
903 WrapCheckVoid ( zXMPMeta_ParseFromBuffer_1 ( buffer, bufferSize, options ) );
904 }
905
906 // -------------------------------------------------------------------------------------------------
907
908 XMP_MethodIntro(TXMPMeta,void)::
909 SerializeToBuffer ( tStringObj * pktString,
910 XMP_OptionBits options,
911 XMP_StringLen padding,
912 XMP_StringPtr newline,
913 XMP_StringPtr indent,
914 XMP_Index baseIndent /* = 0 */ ) const
915 {
916 XMP_StringPtr resultPtr = 0;
917 XMP_StringLen resultLen = 0;
918 WrapCheckVoid ( zXMPMeta_SerializeToBuffer_1 ( &resultPtr, &resultLen, options, padding, newline, indent, baseIndent ) );
919 if ( pktString != 0 ) pktString->assign ( resultPtr, resultLen );
920 WXMPMeta_UnlockObject_1 ( this->xmpRef, 0 );
921 }
922
923 // -------------------------------------------------------------------------------------------------
924
925 XMP_MethodIntro(TXMPMeta,void)::
926 SerializeToBuffer ( tStringObj * pktString,
927 XMP_OptionBits options /* = 0 */,
928 XMP_StringLen padding /* = 0 */ ) const
929 {
930 this->SerializeToBuffer ( pktString, options, padding, "", "", 0 );
931 }
932
933 // -------------------------------------------------------------------------------------------------
934
935 // =================================================================================================