Main Page | Modules | Compound List | File List | Compound Members | File Members

XMP_Const.h

Go to the documentation of this file.
00001 #ifndef __XMP_Const_h__
00002 #define __XMP_Const_h__ 1
00003 
00004 /* --------------------------------------------------------------------------------------------- */
00005 /* ** IMPORTANT ** This file must be usable by strict ANSI C compilers. No "//" comments, etc.   */
00006 /* --------------------------------------------------------------------------------------------- */
00007 
00008 /*
00009 // =================================================================================================
00010 // Copyright 2002-2005 Adobe Systems Incorporated
00011 // All Rights Reserved.
00012 //
00013 // NOTICE:  Adobe permits you to use, modify, and distribute this file in accordance with the terms
00014 // of the Adobe license agreement accompanying it.
00015 // =================================================================================================
00016 */
00017 
00018 #include "XMP_Environment.h"
00019 
00020 #if XMP_MacBuild    // ! No stdint.h on Windows and some UNIXes.
00021     #include <stdint.h>
00022 #endif
00023 
00024 #if __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 
00035 /* ============================================================================================== */
00036 /* Basic types and constants */
00037 /* ========================= */
00038 
00039 /* The XMP_... types are used on the off chance that the ..._t types present a problem. In that */
00040 /* case only the declarations of the XMP_... types needs to change, not all of the uses. These  */
00041 /* types are used where fixed sizes are required in order to have a known ABI for a DLL build.  */
00042 
00043 #if XMP_MacBuild
00044 
00045     typedef int8_t   XMP_Int8;
00046     typedef int16_t  XMP_Int16;
00047     typedef int32_t  XMP_Int32;
00048     typedef int64_t  XMP_Int64;
00049 
00050     typedef uint8_t  XMP_Uns8;
00051     typedef uint16_t XMP_Uns16;
00052     typedef uint32_t XMP_Uns32;
00053     typedef uint64_t XMP_Uns64;
00054 
00055 #else
00056 
00057     typedef signed char XMP_Int8;
00058     typedef signed short XMP_Int16;
00059     typedef signed long XMP_Int32;
00060     typedef signed long long XMP_Int64;
00061 
00062     typedef unsigned char XMP_Uns8;
00063     typedef unsigned short XMP_Uns16;
00064     typedef unsigned long XMP_Uns32;
00065     typedef unsigned long long XMP_Uns64;
00066 
00067 #endif
00068 
00069 typedef XMP_Uns8 XMP_Bool;
00070 
00071 /* Typedefs to preserve old, unfortunate spellings: */
00072 
00073 #if 0 // *** Enable after internal compiles work.
00074 typedef XMP_Int8  XMPInt8;
00075 typedef XMP_Int16 XMPInt16;
00076 typedef XMP_Int32 XMPInt32;
00077 typedef XMP_Int64 XMPInt64;
00078 typedef XMP_Uns8  XMPUns8;
00079 typedef XMP_Uns16 XMPUns16;
00080 typedef XMP_Uns32 XMPUns32;
00081 typedef XMP_Uns64 XMPUns64;
00082 typedef XMP_Bool  XMPBool;
00083 #endif
00084 
00093 typedef struct __XMPMeta__ *        XMPMetaRef;
00094 typedef struct __XMPIterator__ *    XMPIteratorRef;
00095 
00096 /* ============================================================================================== */
00097 
00129 typedef const char * XMP_StringPtr;  /* Points to a null terminated UTF-8 string. */
00130 typedef XMP_Uns32    XMP_StringLen;
00131 typedef XMP_Int32    XMP_Index;      /* Signed, sometimes -1 is handy. */
00132 typedef XMP_Uns32    XMP_OptionBits; /* Used as 32 individual bits. */
00133 
00146 #define kXMP_TrueStr  "True"  /* Serialized XMP spellings, not for the type bool. */
00147 #define kXMP_FalseStr "False"
00148 
00153 /* ============================================================================================== */
00154 
00187 struct XMP_DateTime {
00188     XMP_Int32 year;
00189     XMP_Int32 month;      /* 1..12 */
00190     XMP_Int32 day;        /* 1..31 */
00191     XMP_Int32 hour;       /* 0..23 */
00192     XMP_Int32 minute;     /* 0..59 */
00193     XMP_Int32 second;     /* 0..59 */
00194     XMP_Int32 tzSign;     /* -1..+1, 0 means UTC, -1 is west, +1 is east. */
00195     XMP_Int32 tzHour;     /* 0..23 */
00196     XMP_Int32 tzMinute;   /* 0..59 */
00197     XMP_Int32 nanoSecond;
00198 };
00199 
00200 enum {  /* Values used for tzSign field. */
00201     kXMP_TimeWestOfUTC = -1,
00202     kXMP_TimeIsUTC     =  0,
00203     kXMP_TimeEastOfUTC = +1
00204 };
00205 
00206 
00207 /* ============================================================================================== */
00208 /* Standard namespace URI constants */
00209 /* ================================ */
00210 
00270 #define kXMP_NS_XMP         "http://ns.adobe.com/xap/1.0/"
00271 
00272 #define kXMP_NS_XMP_Rights "http://ns.adobe.com/xap/1.0/rights/"
00273 #define kXMP_NS_XMP_MM     "http://ns.adobe.com/xap/1.0/mm/"
00274 #define kXMP_NS_XMP_BJ     "http://ns.adobe.com/xap/1.0/bj/"
00275 
00276 #define kXMP_NS_PDF        "http://ns.adobe.com/pdf/1.3/"
00277 #define kXMP_NS_Photoshop  "http://ns.adobe.com/photoshop/1.0/"
00278 #define kXMP_NS_PSAlbum    "http://ns.adobe.com/album/1.0/"
00279 #define kXMP_NS_EXIF       "http://ns.adobe.com/exif/1.0/"
00280 #define kXMP_NS_EXIF_Aux   "http://ns.adobe.com/exif/1.0/aux/"
00281 #define kXMP_NS_TIFF       "http://ns.adobe.com/tiff/1.0/"
00282 #define kXMP_NS_PNG        "http://ns.adobe.com/png/1.0/"
00283 #define kXMP_NS_JPEG       "http://ns.adobe.com/jpeg/1.0/"
00284 #define kXMP_NS_JP2K       "http://ns.adobe.com/jp2k/1.0/"
00285 #define kXMP_NS_CameraRaw  "http://ns.adobe.com/camera-raw-settings/1.0/"
00286 
00287 #define kXMP_NS_AdobeStockPhoto "http://ns.adobe.com/StockPhoto/1.0/"
00288 
00333 #define kXMP_NS_XMP_IdentifierQual "http://ns.adobe.com/xmp/Identifier/qual/1.0/"
00334 #define kXMP_NS_XMP_Dimensions     "http://ns.adobe.com/xap/1.0/sType/Dimensions#"
00335 #define kXMP_NS_XMP_Text           "http://ns.adobe.com/xap/1.0/t/"
00336 #define kXMP_NS_XMP_PagedFile      "http://ns.adobe.com/xap/1.0/t/pg/"
00337 #define kXMP_NS_XMP_Graphics       "http://ns.adobe.com/xap/1.0/g/"
00338 #define kXMP_NS_XMP_Image          "http://ns.adobe.com/xap/1.0/g/img/"
00339 #define kXMP_NS_XMP_Font           "http://ns.adobe.com/xap/1.0/sType/Font#"
00340 #define kXMP_NS_XMP_ResourceEvent  "http://ns.adobe.com/xap/1.0/sType/ResourceEvent#"
00341 #define kXMP_NS_XMP_ResourceRef    "http://ns.adobe.com/xap/1.0/sType/ResourceRef#"
00342 #define kXMP_NS_XMP_ST_Version     "http://ns.adobe.com/xap/1.0/sType/Version#"
00343 #define kXMP_NS_XMP_ST_Job         "http://ns.adobe.com/xap/1.0/sType/Job#"
00344 #define kXMP_NS_XMP_ManifestItem   "http://ns.adobe.com/xap/1.0/sType/ManifestItem#"
00345 
00346 /* Deprecated constant names */
00347 #define kXMP_NS_XMP_T     "http://ns.adobe.com/xap/1.0/t/"
00348 #define kXMP_NS_XMP_T_PG  "http://ns.adobe.com/xap/1.0/t/pg/"
00349 #define kXMP_NS_XMP_G_IMG "http://ns.adobe.com/xap/1.0/g/img/"
00350 
00380 #define kXMP_NS_DC       "http://purl.org/dc/elements/1.1/"
00381 #define kXMP_NS_IPTCCore "http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/"
00382 #define kXMP_NS_RDF      "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
00383 #define kXMP_NS_XML      "http://www.w3.org/XML/1998/namespace"
00384 
00385 
00386 /* ============================================================================================== */
00387 /* Enums and macros used for option bits */
00388 /* ===================================== */
00389 
00390 #define kXMP_ArrayLastItem      ((XMP_Index)(-1L))
00391 #define kXMP_UseNullTermination ((XMP_StringLen)(~0UL))
00392 
00393 #define kXMP_NoOptions          ((XMP_OptionBits)0UL)
00394 
00395 #define XMP_SetOption(var,opt)      var |= (opt)
00396 #define XMP_ClearOption(var,opt)    var &= ~(opt)
00397 #define XMP_TestOption(var,opt)     (((var) & (opt)) != 0)
00398 #define XMP_OptionIsSet(var,opt)    (((var) & (opt)) != 0)
00399 #define XMP_OptionIsClear(var,opt)  (((var) & (opt)) == 0)
00400 
00401 #define XMP_PropIsSimple(opt)       (((opt) & kXMP_PropCompositeMask) == 0)
00402 #define XMP_PropIsStruct(opt)       (((opt) & kXMP_PropValueIsStruct) != 0)
00403 #define XMP_PropIsArray(opt)        (((opt) & kXMP_PropValueIsArray) != 0)
00404 #define XMP_ArrayIsUnordered(opt)   (((opt) & kXMP_PropArrayIsOrdered) == 0)
00405 #define XMP_ArrayIsOrdered(opt)     (((opt) & kXMP_PropArrayIsOrdered) != 0)
00406 #define XMP_ArrayIsAlternate(opt)   (((opt) & kXMP_PropArrayIsAlternate) != 0)
00407 #define XMP_ArrayIsAltText(opt)     (((opt) & kXMP_PropArrayIsAltText) != 0)
00408 
00409 #define XMP_PropHasQualifiers(opt)  (((opt) & kXMP_PropHasQualifiers) != 0)
00410 #define XMP_PropIsQualifier(opt)    (((opt) & kXMP_PropIsQualifier) != 0)
00411 #define XMP_PropHasLang(opt)        (((opt) & kXMP_PropHasLang) != 0)
00412 
00413 #define XMP_NodeIsSchema(opt)       (((opt) & kXMP_SchemaNode) != 0)
00414 #define XMP_PropIsAlias(opt)        (((opt) & kXMP_PropIsAlias) != 0)
00415 
00416 /* ---------------------------------------------------------------------------------------------- */
00417 
00418 enum {  /* Options for TXMPMeta::MarkStaleProperties. */
00419     kXMP_DeleteUnknownProperties = 0x0001UL,  /* Default is to record unknown properties. */
00420     kXMP_RecordDerivedProperties = 0x0002UL   /* Default is to delete derived properties. */
00421 };
00422 
00423 /* ---------------------------------------------------------------------------------------------- */
00424 
00425 enum {  /* Option bits returned from the TXMPMeta::GetXyz functions. */
00426 
00427     /* Options relating to the XML string form of the property value. */
00428     kXMP_PropValueIsURI       = 0x00000002UL,  /* The value is a URI, use rdf:resource attribute. DISCOURAGED */
00429 
00430     /* Options relating to qualifiers attached to a property. */
00431     kXMP_PropHasQualifiers    = 0x00000010UL,  /* The property has qualifiers, includes rdf:type and xml:lang. */
00432     kXMP_PropIsQualifier      = 0x00000020UL,  /* This is a qualifier, includes rdf:type and xml:lang. */
00433     kXMP_PropHasLang          = 0x00000040UL,  /* Implies kXMP_PropHasQualifiers, property has xml:lang. */
00434     kXMP_PropHasType          = 0x00000080UL,  /* Implies kXMP_PropHasQualifiers, property has rdf:type. */
00435 
00436     /* Options relating to the data structure form. */
00437     kXMP_PropValueIsStruct    = 0x00000100UL,  /* The value is a structure with nested fields. */
00438     kXMP_PropValueIsArray     = 0x00000200UL,  /* The value is an array (RDF alt/bag/seq). */
00439     kXMP_PropArrayIsOrdered   = 0x00000400UL,  /* Implies kXMP_PropValueIsArray, item order matters. */
00440     kXMP_PropArrayIsAlternate = 0x00000800UL,  /* Implies kXMP_PropArrayIsOrdered, items are alternates. */
00441 
00442     /* Additional struct and array options. */
00443     kXMP_PropArrayIsAltText   = 0x00001000UL,  /* Implies kXMP_PropArrayIsAlternate, items are localized text. */
00444     /* kXMP_InsertBeforeItem  = 0x00004000UL,  ! Used by SetXyz functions. */
00445     /* kXMP_InsertAfterItem   = 0x00008000UL,  ! Used by SetXyz functions. */
00446 
00447     /* Other miscellaneous options. */
00448     kXMP_PropIsAlias          = 0x00010000UL,  /* This property is an alias name for another property. */
00449     kXMP_PropHasAliases       = 0x00020000UL,  /* This property is the base value for a set of aliases. */
00450     kXMP_PropIsInternal       = 0x00040000UL,  /* This property is an "internal" property, owned by applications. */
00451     kXMP_PropIsStable         = 0x00100000UL,  /* This property is not derived from the document content. */
00452     kXMP_PropIsDerived        = 0x00200000UL,  /* This property is derived from the document content. */
00453     kXMP_PropIsStale          = 0x00400000UL,  /* This property is in the stale properties list. */
00454 
00455     /* kXMPUI_AllowCommas     = 0x10000000UL,  ! Used by TXMPUtils::CatenateArrayItems and ::SeparateArrayItems. */
00456     /* kXMP_DeleteExisting    = 0x20000000UL,  ! Used by TXMPMeta::SetXyz functions to delete any pre-existing property. */
00457     /* kXMP_SchemaNode        = 0x80000000UL,  ! Returned by iterators - #define to avoid warnings */
00458 
00459     /* Masks that are multiple flags. */
00460     kXMP_PropArrayFormMask    = kXMP_PropValueIsArray | kXMP_PropArrayIsOrdered | kXMP_PropArrayIsAlternate | kXMP_PropArrayIsAltText,
00461     kXMP_PropCompositeMask    = kXMP_PropValueIsStruct | kXMP_PropArrayFormMask,  /* Is it simple or composite (array or struct)? */
00462     kXMP_ImplReservedMask     = 0x70000000L   /* Reserved for transient use by the implementation. */
00463 };
00464 
00465 #define kXMP_SchemaNode ((XMP_OptionBits)0x80000000UL)
00466 
00467 enum {  /* Option bits for the TXMPMeta::SetXyz functions. */
00468 
00469     /* Options shared with GetXyz functions. */
00470     /*
00471     kXMP_PropValueIsURI        = 0x00000002UL, DISCOURAGED
00472     kXMP_PropValueIsStruct     = 0x00000100UL,
00473     kXMP_PropValueIsArray      = 0x00000200UL,
00474     kXMP_PropArrayIsOrdered    = 0x00000400UL,
00475     kXMP_PropArrayIsAlternate  = 0x00000800UL,
00476     kXMP_PropArrayIsAltText    = 0x00001000UL,
00477     kXMP_PropValueIsCompact    = 0x00002000UL, RESERVED
00478     */
00479 
00480     /* Options for array item location. */
00481     kXMP_InsertBeforeItem      = 0x00004000UL,  /* Insert a new item before the given index. */
00482     kXMP_InsertAfterItem       = 0x00008000UL,  /* Insert a new item after the given index. */
00483 
00484     /* Miscellaneous options */
00485     kXMP_DeleteExisting        = 0x20000000UL,  /* Delete any pre-existing property. */
00486 
00487     /* Masks that are multiple flags. */
00488     kXMP_PropValueOptionsMask  = kXMP_PropValueIsURI,
00489     kXMP_PropArrayLocationMask = kXMP_InsertBeforeItem | kXMP_InsertAfterItem
00490 
00491 };
00492 
00493 /* ---------------------------------------------------------------------------------------------- */
00494 
00495 enum {  /* Options for TXMPMeta::ParseFromBuffer. */
00496     kXMP_RequireXMPMeta   = 0x0001UL,  /* Require a surrounding x:xmpmeta element. */
00497     kXMP_ParseMoreBuffers = 0x0002UL,  /* This is the not last input buffer for this parse stream. */
00498     kXMP_StrictAliasing   = 0x0004UL   /* Do not reconcile alias differences, throw an exception. */
00499 };
00500 
00501 enum {  /* Options for TXMPMeta::SerializeToBuffer. */
00502 
00503     /* *** Option to remove empty struct/array, or leaf with empty value? */
00504 
00505     kXMP_OmitPacketWrapper   = 0x0010UL,  /* Omit the XML packet wrapper. */
00506     kXMP_ReadOnlyPacket      = 0x0020UL,  /* Default is a writeable packet. */
00507     kXMP_UseCompactFormat    = 0x0040UL,  /* Use a compact form of RDF. */
00508     kXMP_UsePlainXMP         = 0x0080UL,  /* Serialize as "Plain XMP", not RDF. */
00509 
00510     kXMP_IncludeThumbnailPad = 0x0100UL,  /* Include a padding allowance for a thumbnail image. */
00511     kXMP_ExactPacketLength   = 0x0200UL,  /* The padding parameter is the overall packet length. */
00512     kXMP_WriteAliasComments  = 0x0400UL,  /* Show aliases as XML comments. */
00513 
00514     _XMP_LittleEndian_Bit    = 0x0001UL,  /* ! Don't use directly, see the combined values below! */
00515     _XMP_UTF16_Bit           = 0x0002UL,
00516     _XMP_UTF32_Bit           = 0x0004UL,
00517 
00518     kXMP_EncodingMask        = 0x0007UL,
00519     kXMP_EncodeUTF8          = 0UL,
00520     kXMP_EncodeUTF16Big      = _XMP_UTF16_Bit,
00521     kXMP_EncodeUTF16Little   = _XMP_UTF16_Bit | _XMP_LittleEndian_Bit,
00522     kXMP_EncodeUTF32Big      = _XMP_UTF32_Bit,
00523     kXMP_EncodeUTF32Little   = _XMP_UTF32_Bit | _XMP_LittleEndian_Bit
00524 
00525 };
00526 
00527 /* ---------------------------------------------------------------------------------------------- */
00528 
00529 enum {  /* Options for TXMPIterator construction. */
00530 
00531     kXMP_IterClassMask      = 0x00FFUL,  /* The low 8 bits are an enum of what data structure to iterate. */
00532     kXMP_IterProperties     = 0x0000UL,  /* Iterate the property tree of a TXMPMeta object. */
00533     kXMP_IterAliases        = 0x0001UL,  /* Iterate the global alias table. */
00534     kXMP_IterNamespaces     = 0x0002UL,  /* Iterate the global namespace table. */
00535     kXMP_IterPropTraits     = 0x0003UL,  /* Iterate the global property traits table. */
00536 
00537     kXMP_IterJustChildren   = 0x0100UL,  /* Just do the immediate children of the root, default is subtree. */
00538     kXMP_IterJustLeafNodes  = 0x0200UL,  /* Just do the leaf nodes, default is all nodes in the subtree. */
00539     kXMP_IterJustLeafName   = 0x0400UL,  /* Return just the leaf part of the path, default is the full path. */
00540     kXMP_IterIncludeAliases = 0x0800UL,  /* Include aliases, default is just actual properties. */
00541 
00542     kXMP_IterOmitQualifiers = 0x1000UL   /* Omit all qualifiers. */
00543 
00544 };
00545 
00546 enum {  /* Options for TXMPIterator::Skip. */
00547     kXMP_IterSkipSubtree    = 0x0001UL,  /* Skip the subtree below the current node. */
00548     kXMP_IterSkipSiblings   = 0x0002UL   /* Skip the subtree below and remaining siblings of the current node. */
00549 };
00550 
00551 /* ---------------------------------------------------------------------------------------------- */
00552 
00553 /* ============================================================================================== */
00554 /* Exception codes */
00555 /* =============== */
00556 
00570 #if ! __cplusplus
00571 
00572     typedef struct XMP_Error {
00573         XMP_Int32     id;
00574         XMP_StringPtr errMsg;
00575     } XMP_Error;
00576 
00577 #else
00578 
00579     class XMP_Error {
00580     public:
00581         XMP_Error ( XMP_Int32 _id, XMP_StringPtr _errMsg ) : id(_id), errMsg(_errMsg) {};
00582         inline XMP_Int32     GetID() const     { return id; };
00583         inline XMP_StringPtr GetErrMsg() const { return errMsg; };
00584     private:
00585         XMP_Int32     id;
00586         XMP_StringPtr errMsg;
00587     };
00588 
00589 #endif
00590 
00591 enum {
00592 
00593     /* More or less generic error codes. */
00594     kXMPErr_Unknown          =  0,
00595     kXMPErr_TBD              =  1,
00596     kXMPErr_Unavailable      =  2,
00597     kXMPErr_BadObject        =  3,
00598     kXMPErr_BadParam         =  4,
00599     kXMPErr_BadValue         =  5,
00600     kXMPErr_AssertFailure    =  6,
00601     kXMPErr_EnforceFailure   =  7,
00602     kXMPErr_Unimplemented    =  8,
00603     kXMPErr_InternalFailure  =  9,
00604     kXMPErr_Deprecated       = 10,
00605     kXMPErr_ExternalFailure  = 11,
00606     kXMPErr_UserAbort        = 12,
00607     kXMPErr_StdException     = 13,
00608     kXMPErr_UnknownException = 14,
00609 
00610     /* More specific parameter error codes.  */
00611     kXMPErr_BadSchema        = 101,
00612     kXMPErr_BadXPath         = 102,
00613     kXMPErr_BadOptions       = 103,
00614     kXMPErr_BadIndex         = 104,
00615     kXMPErr_BadIterPosition  = 105,
00616     kXMPErr_BadParse         = 106,
00617     kXMPErr_BadSerialize     = 107,
00618     kXMPErr_BadFileFormat    = 108,
00619     kXMPErr_NoFileHandler    = 109,
00620 
00621     /* XML, RDF, and internal structure error codes. */
00622     kXMPErr_BadXML           = 201,
00623     kXMPErr_BadRDF           = 202,
00624     kXMPErr_BadXMP           = 203,
00625     kXMPErr_EmptyIterator    = 204,
00626     kXMPErr_BadUnicode       = 205
00627 
00628 };
00629 
00635 /* ============================================================================================== */
00636 /* Client callbacks */
00637 /* ================ */
00638 
00639 
00663 typedef void (* XMP_AssertNotifyProc)   ( void * refCon, XMP_StringPtr message );
00664 
00683 typedef XMP_Int32 XMP_Status;
00684 
00685 typedef XMP_Status (* XMP_TextOutputProc) ( void *        refCon,
00686                                             XMP_StringPtr buffer,
00687                                             XMP_StringLen bufferSize );
00688 
00689 
00698 typedef void * (* XMP_AllocateProc) ( XMP_Uns32 size );
00699 typedef void   (* XMP_DeleteProc)   ( void * ptr );
00700 
00706 /* ============================================================================================== */
00707 /* Stuff with no better place to be */
00708 /* ================================ */
00709 
00710 typedef struct XMP_VersionInfo {
00711     XMP_Uns8      major;    /* The primary release number, the "1" in version "1.2.3". */
00712     XMP_Uns8      minor;    /* The secondary release number, the "2" in version "1.2.3". */
00713     XMP_Uns8      micro;    /* The tertiary release number, the "3" in version "1.2.3". */
00714     XMP_Bool      isDebug;  /* Really a 0/1 bool value. True if this is a debug build. */
00715     XMP_Uns32     build;    /* A rolling build number, monotonically increasing in a release. */
00716     XMP_Uns32     flags;    /* Individual feature implementation flags. */
00717     XMP_StringPtr message;  /* A comprehensive version information string. */
00718 } XMP_VersionInfo;
00719 
00720 
00721 /* ============================================================================================== */
00722 
00723 #if __cplusplus
00724 } /* extern "C" */
00725 #endif
00726 
00727 #endif  /* __XMP_Const_h__ */

Generated on Tue Jul 5 10:06:21 2005 for Adobe XMP Toolkit by doxygen 1.3.3