TXMPUtils.hpp
Go to the documentation of this file.
1 #ifndef __TXMPUtils_hpp__
2 #define __TXMPUtils_hpp__ 1
3 
4 #if ( ! __XMP_hpp__ )
5  #error "Do not directly include, use XMP.hpp"
6 #endif
7 
8 // =================================================================================================
9 // ADOBE SYSTEMS INCORPORATED
10 // Copyright 2002 Adobe Systems Incorporated
11 // All Rights Reserved
12 //
13 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
14 // of the Adobe license agreement accompanying it.
15 // =================================================================================================
16 
17 // =================================================================================================
24 // =================================================================================================
25 
26 // =================================================================================================
47 // =================================================================================================
48 
49 template <class tStringObj> class TXMPUtils {
50 
51 public:
52 
53  // =============================================================================================
54  // No constructors or destructor declared or needed
55  // ================================================
56 
57  // ============================================================================================
92 
93  // ---------------------------------------------------------------------------------------------
109 
110  static void ComposeArrayItemPath ( XMP_StringPtr schemaNS,
111  XMP_StringPtr arrayName,
112  XMP_Index itemIndex,
113  tStringObj * fullPath );
114 
115  // ---------------------------------------------------------------------------------------------
133 
134  static void ComposeStructFieldPath ( XMP_StringPtr schemaNS,
135  XMP_StringPtr structName,
136  XMP_StringPtr fieldNS,
137  XMP_StringPtr fieldName,
138  tStringObj * fullPath );
139 
140  // ---------------------------------------------------------------------------------------------
159 
160  static void ComposeQualifierPath ( XMP_StringPtr schemaNS,
161  XMP_StringPtr propName,
162  XMP_StringPtr qualNS,
163  XMP_StringPtr qualName,
164  tStringObj * fullPath );
165 
166  // ---------------------------------------------------------------------------------------------
190 
191  static void ComposeLangSelector ( XMP_StringPtr schemaNS,
192  XMP_StringPtr arrayName,
193  XMP_StringPtr langName,
194  tStringObj * fullPath );
195 
196  // ---------------------------------------------------------------------------------------------
220 
221  static void ComposeLangSelector ( XMP_StringPtr schemaNS,
222  XMP_StringPtr arrayName,
223  const tStringObj & langName,
224  tStringObj * fullPath );
225 
226  // ---------------------------------------------------------------------------------------------
260 
261  static void ComposeFieldSelector ( XMP_StringPtr schemaNS,
262  XMP_StringPtr arrayName,
263  XMP_StringPtr fieldNS,
264  XMP_StringPtr fieldName,
265  XMP_StringPtr fieldValue,
266  tStringObj * fullPath );
267 
268  // ---------------------------------------------------------------------------------------------
302 
303  static void ComposeFieldSelector ( XMP_StringPtr schemaNS,
304  XMP_StringPtr arrayName,
305  XMP_StringPtr fieldNS,
306  XMP_StringPtr fieldName,
307  const tStringObj & fieldValue,
308  tStringObj * fullPath );
309 
311 
312  // =============================================================================================
324 
325  // ---------------------------------------------------------------------------------------------
334 
335  static void ConvertFromBool ( bool binValue,
336  tStringObj * strValue );
337 
338  // ---------------------------------------------------------------------------------------------
346 
347  static void ConvertFromInt ( long binValue,
348  XMP_StringPtr format,
349  tStringObj * strValue );
350  // ---------------------------------------------------------------------------------------------
358 
359  static void ConvertFromInt64 ( long long binValue,
360  XMP_StringPtr format,
361  tStringObj * strValue );
362 
363  // ---------------------------------------------------------------------------------------------
371 
372  static void ConvertFromFloat ( double binValue,
373  XMP_StringPtr format,
374  tStringObj * strValue );
375 
376  // ---------------------------------------------------------------------------------------------
409 
410  static void ConvertFromDate ( const XMP_DateTime & binValue,
411  tStringObj * strValue );
412 
413  // ---------------------------------------------------------------------------------------------
423 
424  static bool ConvertToBool ( XMP_StringPtr strValue );
425 
426  // ---------------------------------------------------------------------------------------------
435 
436  static bool ConvertToBool ( const tStringObj & strValue );
437 
438  // ---------------------------------------------------------------------------------------------
444 
445  static long ConvertToInt ( XMP_StringPtr strValue );
446 
447  // ---------------------------------------------------------------------------------------------
456 
457  static long ConvertToInt ( const tStringObj & strValue );
458 
459  // ---------------------------------------------------------------------------------------------
465 
466  static long long ConvertToInt64 ( XMP_StringPtr strValue );
467 
468  // ---------------------------------------------------------------------------------------------
477 
478  static long long ConvertToInt64 ( const tStringObj & strValue );
479 
480  // ---------------------------------------------------------------------------------------------
486 
487  static double ConvertToFloat ( XMP_StringPtr strValue );
488 
489  // ---------------------------------------------------------------------------------------------
498 
499  static double ConvertToFloat ( const tStringObj & strValue );
500 
501  // ---------------------------------------------------------------------------------------------
536 
537  static void ConvertToDate ( XMP_StringPtr strValue,
538  XMP_DateTime * binValue );
539 
540  // ---------------------------------------------------------------------------------------------
552 
553  static void ConvertToDate ( const tStringObj & strValue,
554  XMP_DateTime * binValue );
555 
557 
558  // =============================================================================================
564 
565  // ---------------------------------------------------------------------------------------------
573 
574  static void CurrentDateTime ( XMP_DateTime * time );
575 
576  // ---------------------------------------------------------------------------------------------
582 
583  static void SetTimeZone ( XMP_DateTime * time );
584 
585  // ---------------------------------------------------------------------------------------------
592 
593  static void ConvertToUTCTime ( XMP_DateTime * time );
594 
595  // ---------------------------------------------------------------------------------------------
603 
604  static void ConvertToLocalTime ( XMP_DateTime * time );
605 
606  // ---------------------------------------------------------------------------------------------
619 
620  static int CompareDateTime ( const XMP_DateTime & left,
621  const XMP_DateTime & right );
622 
624 
625  // =============================================================================================
630 
631  // ---------------------------------------------------------------------------------------------
639 
640  static void EncodeToBase64 ( XMP_StringPtr rawStr,
641  XMP_StringLen rawLen,
642  tStringObj * encodedStr );
643 
644  // ---------------------------------------------------------------------------------------------
653 
654  static void EncodeToBase64 ( const tStringObj & rawStr,
655  tStringObj * encodedStr );
656 
657  // ---------------------------------------------------------------------------------------------
665 
666  static void DecodeFromBase64 ( XMP_StringPtr encodedStr,
667  XMP_StringLen encodedLen,
668  tStringObj * rawStr );
669 
670  // ---------------------------------------------------------------------------------------------
679 
680  static void DecodeFromBase64 ( const tStringObj & encodedStr,
681  tStringObj * rawStr );
682 
684 
685  // =============================================================================================
686  // =============================================================================================
694 
695  // ---------------------------------------------------------------------------------------------
714 
715  static void PackageForJPEG ( const TXMPMeta<tStringObj> & xmpObj,
716  tStringObj * standardXMP,
717  tStringObj * extendedXMP,
718  tStringObj * extendedDigest );
719 
720  // ---------------------------------------------------------------------------------------------
734 
735  static void MergeFromJPEG ( TXMPMeta<tStringObj> * fullXMP,
736  const TXMPMeta<tStringObj> & extendedXMP );
737 
739 
740  // =============================================================================================
747 
748  // ---------------------------------------------------------------------------------------------
772 
773  static void CatenateArrayItems ( const TXMPMeta<tStringObj> & xmpObj,
774  XMP_StringPtr schemaNS,
775  XMP_StringPtr arrayName,
776  XMP_StringPtr separator,
777  XMP_StringPtr quotes,
778  XMP_OptionBits options,
779  tStringObj * catedStr );
780 
781  // ---------------------------------------------------------------------------------------------
799 
800  static void SeparateArrayItems ( TXMPMeta<tStringObj> * xmpObj,
801  XMP_StringPtr schemaNS,
802  XMP_StringPtr arrayName,
803  XMP_OptionBits options,
804  XMP_StringPtr catedStr );
805 
806  // ---------------------------------------------------------------------------------------------
812 
813  static void SeparateArrayItems ( TXMPMeta<tStringObj> * xmpObj,
814  XMP_StringPtr schemaNS,
815  XMP_StringPtr arrayName,
816  XMP_OptionBits options,
817  const tStringObj & catedStr );
818 
868 
883 
884  static void ApplyTemplate ( TXMPMeta<tStringObj> * workingXMP,
885  const TXMPMeta<tStringObj> & templateXMP,
886  XMP_OptionBits actions );
887 
888  // ---------------------------------------------------------------------------------------------
919 
920  static void RemoveProperties ( TXMPMeta<tStringObj> * xmpObj,
921  XMP_StringPtr schemaNS = 0,
922  XMP_StringPtr propName = 0,
923  XMP_OptionBits options = 0 );
924 
925  // ---------------------------------------------------------------------------------------------
946 
947  static void DuplicateSubtree ( const TXMPMeta<tStringObj> & source,
948  TXMPMeta<tStringObj> * dest,
949  XMP_StringPtr sourceNS,
950  XMP_StringPtr sourceRoot,
951  XMP_StringPtr destNS = 0,
952  XMP_StringPtr destRoot = 0,
953  XMP_OptionBits options = 0 );
954 
956 
957  // =============================================================================================
958 
959 private:
960 
961  static void SetClientString ( void * clientPtr, XMP_StringPtr valuePtr, XMP_StringLen valueLen );
962 
963 }; // class TXMPUtils
964 
965 // =================================================================================================
966 
967 #endif // __TXMPUtils_hpp__
XMP_Uns32 XMP_StringLen
The type for string length parameters. A 32-bit unsigned integer, as big as will be practically neede...
Definition: XMP_Const.h:170
XMP_Int32 XMP_Index
The type for offsets and indices. A 32-bit signed integer. It is signed to allow -1 for loop terminat...
Definition: XMP_Const.h:171
static void ApplyTemplate(TXMPMeta< tStringObj > *workingXMP, const TXMPMeta< tStringObj > &templateXMP, XMP_OptionBits actions)
ApplyTemplate() modifies a working XMP object according to a template object.
const char * XMP_StringPtr
The type for input string parameters. A const char *, a null-terminated UTF-8 string.
Definition: XMP_Const.h:169
static void ComposeArrayItemPath(XMP_StringPtr schemaNS, XMP_StringPtr arrayName, XMP_Index itemIndex, tStringObj *fullPath)
ComposeArrayItemPath() composes the path expression for an item in an array.
static void RemoveProperties(TXMPMeta< tStringObj > *xmpObj, XMP_StringPtr schemaNS=0, XMP_StringPtr propName=0, XMP_OptionBits options=0)
RemoveProperties() removes multiple properties from an XMP object.
static void ConvertFromInt(long binValue, XMP_StringPtr format, tStringObj *strValue)
ConvertFromInt() converts a 32-bit integer value to a string.
static void PackageForJPEG(const TXMPMeta< tStringObj > &xmpObj, tStringObj *standardXMP, tStringObj *extendedXMP, tStringObj *extendedDigest)
PackageForJPEG() creates XMP serializations appropriate for a JPEG file.
static void SetClientString(void *clientPtr, XMP_StringPtr valuePtr, XMP_StringLen valueLen)
static void ConvertToDate(XMP_StringPtr strValue, XMP_DateTime *binValue)
ConvertToDate() converts a string to a date/time value.
static void EncodeToBase64(XMP_StringPtr rawStr, XMP_StringLen rawLen, tStringObj *encodedStr)
These functions convert between raw data values and Base64-encoded strings.
static double ConvertToFloat(XMP_StringPtr strValue)
ConvertToFloat() converts a string to a floating-point value.
static long long ConvertToInt64(XMP_StringPtr strValue)
ConvertToInt64() converts a string to a 64-bit integer value.
static void MergeFromJPEG(TXMPMeta< tStringObj > *fullXMP, const TXMPMeta< tStringObj > &extendedXMP)
MergeFromJPEG() merges standard and extended XMP retrieved from a JPEG file.
The expanded type for a date and time.
Definition: XMP_Const.h:223
XMP_Uns32 XMP_OptionBits
The type for a collection of 32 flag bits.
Definition: XMP_Const.h:172
static long ConvertToInt(XMP_StringPtr strValue)
ConvertToInt() converts a string to a 32-bit integer value.
static void SeparateArrayItems(TXMPMeta< tStringObj > *xmpObj, XMP_StringPtr schemaNS, XMP_StringPtr arrayName, XMP_OptionBits options, XMP_StringPtr catedStr)
SeparateArrayItems() updates an array from a concatenated edit string of values.
static void ComposeQualifierPath(XMP_StringPtr schemaNS, XMP_StringPtr propName, XMP_StringPtr qualNS, XMP_StringPtr qualName, tStringObj *fullPath)
ComposeQualifierPath() composes the path expression for a qualifier.
static void CatenateArrayItems(const TXMPMeta< tStringObj > &xmpObj, XMP_StringPtr schemaNS, XMP_StringPtr arrayName, XMP_StringPtr separator, XMP_StringPtr quotes, XMP_OptionBits options, tStringObj *catedStr)
CatenateArrayItems() creates a single edit string from a set of array item values.
static void ConvertFromBool(bool binValue, tStringObj *strValue)
ConvertFromBool() converts a Boolean value to a string.
static void ComposeStructFieldPath(XMP_StringPtr schemaNS, XMP_StringPtr structName, XMP_StringPtr fieldNS, XMP_StringPtr fieldName, tStringObj *fullPath)
ComposeStructFieldPath() composes the path expression for a field in a struct.
static void ConvertFromInt64(long long binValue, XMP_StringPtr format, tStringObj *strValue)
ConvertFromInt64() converts a 64-bit integer value to a string.
API for access to the XMP Toolkit utility services.
Definition: TXMPMeta.hpp:51
static void SetTimeZone(XMP_DateTime *time)
SetTimeZone() sets the time zone in a date/time value to the local time zone.
static void ComposeLangSelector(XMP_StringPtr schemaNS, XMP_StringPtr arrayName, XMP_StringPtr langName, tStringObj *fullPath)
ComposeLangSelector() composes the path expression to select an alternate item by language...
static void ConvertToLocalTime(XMP_DateTime *time)
ConvertToLocalTime() ensures that a time is local.
static void CurrentDateTime(XMP_DateTime *time)
CurrentDateTime() obtains the current date and time.
static bool ConvertToBool(XMP_StringPtr strValue)
ConvertToBool() converts a string to a Boolean value.
static void ConvertFromDate(const XMP_DateTime &binValue, tStringObj *strValue)
ConvertFromDate() converts a date/time value to a string.
static void DuplicateSubtree(const TXMPMeta< tStringObj > &source, TXMPMeta< tStringObj > *dest, XMP_StringPtr sourceNS, XMP_StringPtr sourceRoot, XMP_StringPtr destNS=0, XMP_StringPtr destRoot=0, XMP_OptionBits options=0)
DuplicateSubtree() replicates a subtree from one XMP object into another.
static void ConvertToUTCTime(XMP_DateTime *time)
ConvertToUTCTime() ensures that a time is UTC.
static void ComposeFieldSelector(XMP_StringPtr schemaNS, XMP_StringPtr arrayName, XMP_StringPtr fieldNS, XMP_StringPtr fieldName, XMP_StringPtr fieldValue, tStringObj *fullPath)
ComposeFieldSelector() composes a path expression to select an alternate item by a field&#39;s value...
static void DecodeFromBase64(XMP_StringPtr encodedStr, XMP_StringLen encodedLen, tStringObj *rawStr)
DecodeFromBase64() Decodes a Base64-encoded string to raw data.
static void ConvertFromFloat(double binValue, XMP_StringPtr format, tStringObj *strValue)
ConvertFromFloat() converts a floating-point value to a string.
static int CompareDateTime(const XMP_DateTime &left, const XMP_DateTime &right)
CompareDateTime() compares the order of two date/time values.
API for access to the XMP Toolkit core services.
Definition: TXMPMeta.hpp:55

XMPToolkit documentation generated by doxygen 1.8.11