1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
|
// =================================================================================================
// Copyright 2004 Adobe
// All Rights Reserved.
//
// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
// of the Adobe license agreement accompanying it. If you have received this file from a source other
// than Adobe, then your use, modification, or distribution of it requires the prior written permission
// of Adobe.
// =================================================================================================
// *** Should change "type * inParam" to "type & inParam"
#include "public/include/XMP_Environment.h" // ! This must be the first include!
#include "public/include/XMP_Const.h"
#include "public/include/client-glue/WXMPUtils.hpp"
#include "XMPCore/source/XMPCore_Impl.hpp"
#include "XMPCore/source/XMPUtils.hpp"
#if XMP_WinBuild
#pragma warning ( disable : 4101 ) // unreferenced local variable
#pragma warning ( disable : 4189 ) // local variable is initialized but not referenced
#pragma warning ( disable : 4800 ) // forcing value to bool 'true' or 'false' (performance warning)
#if XMP_DebugBuild
#pragma warning ( disable : 4297 ) // function assumed not to throw an exception but does
#endif
#endif
#if __cplusplus
extern "C" {
#endif
// =================================================================================================
// Class Static Wrappers
// =====================
void
WXMPUtils_ComposeArrayItemPath_1 ( XMP_StringPtr schemaNS,
XMP_StringPtr arrayName,
XMP_Index itemIndex,
void * itemPath,
SetClientStringProc SetClientString,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_ComposeArrayItemPath_1" )
if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
if ( (arrayName == 0) || (*arrayName == 0) ) XMP_Throw ( "Empty array name", kXMPErr_BadXPath );
XMP_VarString localStr;
XMPUtils::ComposeArrayItemPath ( schemaNS, arrayName, itemIndex, &localStr );
if ( itemPath != 0 ) (*SetClientString) ( itemPath, localStr.c_str(), static_cast< XMP_StringLen >( localStr.size() ) );
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_ComposeStructFieldPath_1 ( XMP_StringPtr schemaNS,
XMP_StringPtr structName,
XMP_StringPtr fieldNS,
XMP_StringPtr fieldName,
void * fieldPath,
SetClientStringProc SetClientString,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_ComposeStructFieldPath_1" )
if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
if ( (structName == 0) || (*structName == 0) ) XMP_Throw ( "Empty struct name", kXMPErr_BadXPath );
if ( (fieldNS == 0) || (*fieldNS == 0) ) XMP_Throw ( "Empty field namespace URI", kXMPErr_BadSchema );
if ( (fieldName == 0) || (*fieldName == 0) ) XMP_Throw ( "Empty field name", kXMPErr_BadXPath );
XMP_VarString localStr;
XMPUtils::ComposeStructFieldPath ( schemaNS, structName, fieldNS, fieldName, &localStr );
if ( fieldPath != 0 ) (*SetClientString) ( fieldPath, localStr.c_str(), static_cast< XMP_StringLen >( localStr.size() ));
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_ComposeQualifierPath_1 ( XMP_StringPtr schemaNS,
XMP_StringPtr propName,
XMP_StringPtr qualNS,
XMP_StringPtr qualName,
void * qualPath,
SetClientStringProc SetClientString,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_ComposeQualifierPath_1" )
if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
if ( (propName == 0) || (*propName == 0) ) XMP_Throw ( "Empty property name", kXMPErr_BadXPath );
if ( (qualNS == 0) || (*qualNS == 0) ) XMP_Throw ( "Empty qualifier namespace URI", kXMPErr_BadSchema );
if ( (qualName == 0) || (*qualName == 0) ) XMP_Throw ( "Empty qualifier name", kXMPErr_BadXPath );
XMP_VarString localStr;
XMPUtils::ComposeQualifierPath ( schemaNS, propName, qualNS, qualName, &localStr );
if ( qualPath != 0 ) (*SetClientString) ( qualPath, localStr.c_str(), static_cast< XMP_StringLen >( localStr.size() ) );
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_ComposeLangSelector_1 ( XMP_StringPtr schemaNS,
XMP_StringPtr arrayName,
XMP_StringPtr langName,
void * selPath,
SetClientStringProc SetClientString,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_ComposeLangSelector_1" )
if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
if ( (arrayName == 0) || (*arrayName == 0) ) XMP_Throw ( "Empty array name", kXMPErr_BadXPath );
if ( (langName == 0) || (*langName == 0) ) XMP_Throw ( "Empty language name", kXMPErr_BadParam );
XMP_VarString localStr;
XMPUtils::ComposeLangSelector ( schemaNS, arrayName, langName, &localStr );
if ( selPath != 0 ) (*SetClientString) ( selPath, localStr.c_str(), static_cast< XMP_StringLen >( localStr.size() ) );
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_ComposeFieldSelector_1 ( XMP_StringPtr schemaNS,
XMP_StringPtr arrayName,
XMP_StringPtr fieldNS,
XMP_StringPtr fieldName,
XMP_StringPtr fieldValue,
void * selPath,
SetClientStringProc SetClientString,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_ComposeFieldSelector_1" )
if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
if ( (arrayName == 0) || (*arrayName == 0) ) XMP_Throw ( "Empty array name", kXMPErr_BadXPath );
if ( (fieldNS == 0) || (*fieldNS == 0) ) XMP_Throw ( "Empty field namespace URI", kXMPErr_BadSchema );
if ( (fieldName == 0) || (*fieldName == 0) ) XMP_Throw ( "Empty field name", kXMPErr_BadXPath );
if ( fieldValue == 0 ) fieldValue = "";
XMP_VarString localStr;
XMPUtils::ComposeFieldSelector ( schemaNS, arrayName, fieldNS, fieldName, fieldValue, &localStr );
if ( selPath != 0 ) (*SetClientString) ( selPath, localStr.c_str(), static_cast< XMP_StringLen >( localStr.size() ));
XMP_EXIT
}
// =================================================================================================
void
WXMPUtils_ConvertFromBool_1 ( XMP_Bool binValue,
void * strValue,
SetClientStringProc SetClientString,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_ConvertFromBool_1" )
XMP_VarString localStr;
XMPUtils::ConvertFromBool ( binValue, &localStr );
if ( strValue != 0 ) (*SetClientString) ( strValue, localStr.c_str(), static_cast< XMP_StringLen >( localStr.size() ) );
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_ConvertFromInt_1 ( XMP_Int32 binValue,
XMP_StringPtr format,
void * strValue,
SetClientStringProc SetClientString,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_ConvertFromInt_1" )
if ( format == 0 ) format = "";
XMP_VarString localStr;
XMPUtils::ConvertFromInt ( binValue, format, &localStr );
if ( strValue != 0 ) (*SetClientString) ( strValue, localStr.c_str(), static_cast< XMP_StringLen >( localStr.size() ) );
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_ConvertFromInt64_1 ( XMP_Int64 binValue,
XMP_StringPtr format,
void * strValue,
SetClientStringProc SetClientString,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_ConvertFromInt64_1" )
if ( format == 0 ) format = "";
XMP_VarString localStr;
XMPUtils::ConvertFromInt64 ( binValue, format, &localStr );
if ( strValue != 0 ) (*SetClientString) ( strValue, localStr.c_str(), static_cast< XMP_StringLen >( localStr.size() ) );
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_ConvertFromFloat_1 ( double binValue,
XMP_StringPtr format,
void * strValue,
SetClientStringProc SetClientString,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_ConvertFromFloat_1" )
if ( format == 0 ) format = "";
XMP_VarString localStr;
XMPUtils::ConvertFromFloat ( binValue, format, &localStr );
if ( strValue != 0 ) (*SetClientString) ( strValue, localStr.c_str(), static_cast< XMP_StringLen >( localStr.size() ) );
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_ConvertFromDate_1 ( const XMP_DateTime & binValue,
void * strValue,
SetClientStringProc SetClientString,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_ConvertFromDate_1" )
XMP_VarString localStr;
XMPUtils::ConvertFromDate( binValue, &localStr );
if ( strValue != 0 ) (*SetClientString) ( strValue, localStr.c_str(), static_cast< XMP_StringLen >( localStr.size() ) );
XMP_EXIT
}
// =================================================================================================
void
WXMPUtils_ConvertToBool_1 ( XMP_StringPtr strValue,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_ConvertToBool_1" )
if ( (strValue == 0) || (*strValue == 0) ) XMP_Throw ( "Empty string value", kXMPErr_BadParam);
XMP_Bool result = XMPUtils::ConvertToBool ( strValue );
wResult->int32Result = result;
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_ConvertToInt_1 ( XMP_StringPtr strValue,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_ConvertToInt_1" )
if ( (strValue == 0) || (*strValue == 0) ) XMP_Throw ( "Empty string value", kXMPErr_BadParam);
XMP_Int32 result = XMPUtils::ConvertToInt ( strValue );
wResult->int32Result = result;
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_ConvertToInt64_1 ( XMP_StringPtr strValue,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_ConvertToInt64_1" )
if ( (strValue == 0) || (*strValue == 0) ) XMP_Throw ( "Empty string value", kXMPErr_BadParam);
XMP_Int64 result = XMPUtils::ConvertToInt64 ( strValue );
wResult->int64Result = result;
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_ConvertToFloat_1 ( XMP_StringPtr strValue,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_ConvertToFloat_1")
if ( (strValue == 0) || (*strValue == 0) ) XMP_Throw ( "Empty string value", kXMPErr_BadParam);
double result = XMPUtils::ConvertToFloat ( strValue );
wResult->floatResult = result;
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_ConvertToDate_1 ( XMP_StringPtr strValue,
XMP_DateTime * binValue,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_ConvertToDate_1" )
if ( binValue == 0 ) XMP_Throw ( "Null output date", kXMPErr_BadParam); // ! Pointer is from the client.
XMPUtils::ConvertToDate ( strValue, binValue );
XMP_EXIT
}
// =================================================================================================
void
WXMPUtils_CurrentDateTime_1 ( XMP_DateTime * time,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_CurrentDateTime_1" )
if ( time == 0 ) XMP_Throw ( "Null output date", kXMPErr_BadParam);
XMPUtils::CurrentDateTime ( time );
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_SetTimeZone_1 ( XMP_DateTime * time,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_SetTimeZone_1" )
if ( time == 0 ) XMP_Throw ( "Null output date", kXMPErr_BadParam);
XMPUtils::SetTimeZone ( time );
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_ConvertToUTCTime_1 ( XMP_DateTime * time,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_ConvertToUTCTime_1" )
if ( time == 0 ) XMP_Throw ( "Null output date", kXMPErr_BadParam);
XMPUtils::ConvertToUTCTime ( time );
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_ConvertToLocalTime_1 ( XMP_DateTime * time,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_ConvertToLocalTime_1" )
if ( time == 0 ) XMP_Throw ( "Null output date", kXMPErr_BadParam);
XMPUtils::ConvertToLocalTime ( time );
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_CompareDateTime_1 ( const XMP_DateTime & left,
const XMP_DateTime & right,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_CompareDateTime_1" )
int result = XMPUtils::CompareDateTime ( left, right );
wResult->int32Result = result;
XMP_EXIT
}
// =================================================================================================
void
WXMPUtils_EncodeToBase64_1 ( XMP_StringPtr rawStr,
XMP_StringLen rawLen,
void * encodedStr,
SetClientStringProc SetClientString,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_EncodeToBase64_1" )
XMP_VarString localStr;
XMPUtils::EncodeToBase64 ( rawStr, rawLen, &localStr );
if ( encodedStr != 0 ) (*SetClientString) ( encodedStr, localStr.c_str(), static_cast< XMP_StringLen >( localStr.size()) );
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_DecodeFromBase64_1 ( XMP_StringPtr encodedStr,
XMP_StringLen encodedLen,
void * rawStr,
SetClientStringProc SetClientString,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_DecodeFromBase64_1" )
XMP_VarString localStr;
XMPUtils::DecodeFromBase64 ( encodedStr, encodedLen, &localStr );
if ( rawStr != 0 ) (*SetClientString) ( rawStr, localStr.c_str(), static_cast< XMP_StringLen >( localStr.size()) );
XMP_EXIT
}
// =================================================================================================
void
WXMPUtils_PackageForJPEG_1 ( XMPMetaRef wxmpObj,
void * stdStr,
void * extStr,
void * digestStr,
SetClientStringProc SetClientString,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_PackageForJPEG_1" )
XMP_VarString localStdStr;
XMP_VarString localExtStr;
XMP_VarString localDigestStr;
const XMPMeta & xmpObj = WtoXMPMeta_Ref ( wxmpObj );
XMP_AutoLock metaLock ( &xmpObj.lock, kXMP_ReadLock );
XMPUtils::PackageForJPEG ( xmpObj, &localStdStr, &localExtStr, &localDigestStr );
if ( stdStr != 0 ) (*SetClientString) ( stdStr, localStdStr.c_str(), static_cast< XMP_StringLen >( localStdStr.size()) );
if ( extStr != 0 ) (*SetClientString) ( extStr, localExtStr.c_str(), static_cast< XMP_StringLen >( localExtStr.size()) );
if ( digestStr != 0 ) (*SetClientString) ( digestStr, localDigestStr.c_str(), static_cast< XMP_StringLen >( localDigestStr.size()) );
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_MergeFromJPEG_1 ( XMPMetaRef wfullXMP,
XMPMetaRef wextendedXMP,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_MergeFromJPEG_1" )
if ( wfullXMP == 0 ) XMP_Throw ( "Output XMP pointer is null", kXMPErr_BadParam );
if ( wfullXMP == wextendedXMP ) XMP_Throw ( "Full and extended XMP pointers match", kXMPErr_BadParam );
XMPMeta * fullXMP = WtoXMPMeta_Ptr ( wfullXMP );
XMP_AutoLock fullXMPLock ( &fullXMP->lock, kXMP_WriteLock );
const XMPMeta & extendedXMP = WtoXMPMeta_Ref ( wextendedXMP );
XMP_AutoLock extendedXMPLock ( &extendedXMP.lock, kXMP_ReadLock );
XMPUtils::MergeFromJPEG ( fullXMP, extendedXMP );
XMP_EXIT
}
// =================================================================================================
void
WXMPUtils_CatenateArrayItems_1 ( XMPMetaRef wxmpObj,
XMP_StringPtr schemaNS,
XMP_StringPtr arrayName,
XMP_StringPtr separator,
XMP_StringPtr quotes,
XMP_OptionBits options,
void * catedStr,
SetClientStringProc SetClientString,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_CatenateArrayItems_1" )
if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
if ( (arrayName == 0) || (*arrayName == 0) ) XMP_Throw ( "Empty array name", kXMPErr_BadXPath );
if ( separator == 0 ) separator = "; ";
if ( quotes == 0 ) quotes = "\"";
XMP_VarString localStr;
const XMPMeta & xmpObj = WtoXMPMeta_Ref ( wxmpObj );
XMP_AutoLock metaLock ( &xmpObj.lock, kXMP_ReadLock );
XMPUtils::CatenateArrayItems ( xmpObj, schemaNS, arrayName, separator, quotes, options, &localStr );
if ( catedStr != 0 ) (*SetClientString) ( catedStr, localStr.c_str(), static_cast< XMP_StringLen >( localStr.size() ));
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_SeparateArrayItems_1 ( XMPMetaRef wxmpObj,
XMP_StringPtr schemaNS,
XMP_StringPtr arrayName,
XMP_OptionBits options,
XMP_StringPtr catedStr,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_SeparateArrayItems_1" )
if ( wxmpObj == 0 ) XMP_Throw ( "Output XMP pointer is null", kXMPErr_BadParam );
if ( (schemaNS == 0) || (*schemaNS == 0) ) XMP_Throw ( "Empty schema namespace URI", kXMPErr_BadSchema );
if ( (arrayName == 0) || (*arrayName == 0) ) XMP_Throw ( "Empty array name", kXMPErr_BadXPath );
if ( catedStr == 0 ) catedStr = "";
XMPMeta * xmpObj = WtoXMPMeta_Ptr ( wxmpObj );
XMP_AutoLock metaLock ( &xmpObj->lock, kXMP_WriteLock );
XMPUtils::SeparateArrayItems ( xmpObj, schemaNS, arrayName, options, catedStr );
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_ApplyTemplate_1 ( XMPMetaRef wWorkingXMP,
XMPMetaRef wTemplateXMP,
XMP_OptionBits actions,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_ApplyTemplate_1" )
XMP_Assert ( (wWorkingXMP != 0) && (wTemplateXMP != 0) ); // Client glue enforced.
XMPMeta * workingXMP = WtoXMPMeta_Ptr ( wWorkingXMP );
XMP_AutoLock workingLock ( &workingXMP->lock, kXMP_WriteLock );
const XMPMeta & templateXMP = WtoXMPMeta_Ref ( wTemplateXMP );
XMP_AutoLock templateLock ( &templateXMP.lock, kXMP_ReadLock );
XMPUtils::ApplyTemplate ( workingXMP, templateXMP, actions );
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_RemoveProperties_1 ( XMPMetaRef wxmpObj,
XMP_StringPtr schemaNS,
XMP_StringPtr propName,
XMP_OptionBits options,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_RemoveProperties_1" )
if ( wxmpObj == 0 ) XMP_Throw ( "Output XMP pointer is null", kXMPErr_BadParam );
if ( schemaNS == 0 ) schemaNS = "";
if ( propName == 0 ) propName = "";
XMPMeta * xmpObj = WtoXMPMeta_Ptr ( wxmpObj );
XMP_AutoLock metaLock ( &xmpObj->lock, kXMP_WriteLock );
XMPUtils::RemoveProperties ( xmpObj, schemaNS, propName, options );
XMP_EXIT
}
// -------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------
void
WXMPUtils_DuplicateSubtree_1 ( XMPMetaRef wSource,
XMPMetaRef wDest,
XMP_StringPtr sourceNS,
XMP_StringPtr sourceRoot,
XMP_StringPtr destNS,
XMP_StringPtr destRoot,
XMP_OptionBits options,
WXMP_Result * wResult )
{
XMP_ENTER_Static ( "WXMPUtils_DuplicateSubtree_1" )
if ( wDest == 0 ) XMP_Throw ( "Output XMP pointer is null", kXMPErr_BadParam );
if ( (sourceNS == 0) || (*sourceNS == 0) ) XMP_Throw ( "Empty source schema URI", kXMPErr_BadSchema );
if ( (sourceRoot == 0) || (*sourceRoot == 0) ) XMP_Throw ( "Empty source root name", kXMPErr_BadXPath );
if ( destNS == 0 ) destNS = sourceNS;
if ( destRoot == 0 ) destRoot = sourceRoot;
const XMPMeta & source = WtoXMPMeta_Ref ( wSource );
XMP_AutoLock sourceLock ( &source.lock, kXMP_ReadLock, (wSource != wDest) );
XMPMeta * dest = WtoXMPMeta_Ptr ( wDest );
XMP_AutoLock destLock ( &dest->lock, kXMP_WriteLock );
XMPUtils::DuplicateSubtree ( source, dest, sourceNS, sourceRoot, destNS, destRoot, options );
XMP_EXIT
}
// =================================================================================================
#if __cplusplus
} /* extern "C" */
#endif
|