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