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

Generated on Mon Jan 2 12:25:54 2006 for Adobe XMP Toolkit by doxygen 1.3.3