00001 #ifndef __XMP_Const_h__ 00002 #define __XMP_Const_h__ 1 00003 00004 // ================================================================================================= 00005 // Copyright 2002 Adobe Systems Incorporated 00006 // All Rights Reserved. 00007 // 00008 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms 00009 // of the Adobe license agreement accompanying it. 00010 // ================================================================================================= 00011 00012 #include "XMP_Environment.h" 00013 00014 #include <stddef.h> 00015 00016 #if XMP_MacBuild // ! No stdint.h on Windows and some UNIXes. 00017 #include <stdint.h> 00018 #endif 00019 #if XMP_UNIXBuild // hopefully an inttypes.h on all UNIXes... 00020 #include <inttypes.h> 00021 #endif 00022 00023 00024 #if __cplusplus 00025 extern "C" { 00026 #endif 00027 00028 // ================================================================================================= 00031 // ================================================================================================= 00032 00033 // ================================================================================================= 00034 // Basic types and constants 00035 // ========================= 00036 00037 // The XMP_... types are used on the off chance that the ..._t types present a problem. In that 00038 // case only the declarations of the XMP_... types needs to change, not all of the uses. These 00039 // types are used where fixed sizes are required in order to have a known ABI for a DLL build. 00040 00041 #if XMP_MacBuild 00042 00043 typedef int8_t XMP_Int8; 00044 typedef int16_t XMP_Int16; 00045 typedef int32_t XMP_Int32; 00046 typedef int64_t XMP_Int64; 00047 00048 typedef uint8_t XMP_Uns8; 00049 typedef uint16_t XMP_Uns16; 00050 typedef uint32_t XMP_Uns32; 00051 typedef uint64_t XMP_Uns64; 00052 00053 #elif XMP_WinBuild 00054 00055 typedef signed char XMP_Int8; 00056 typedef signed short XMP_Int16; 00057 typedef signed long XMP_Int32; 00058 typedef signed long long XMP_Int64; 00059 00060 typedef unsigned char XMP_Uns8; 00061 typedef unsigned short XMP_Uns16; 00062 typedef unsigned long XMP_Uns32; 00063 typedef unsigned long long XMP_Uns64; 00064 00065 #elif XMP_UNIXBuild 00066 00067 #if ! XMP_64 00068 00069 typedef signed char XMP_Int8; 00070 typedef signed short XMP_Int16; 00071 typedef signed long XMP_Int32; 00072 typedef signed long long XMP_Int64; 00073 00074 typedef unsigned char XMP_Uns8; 00075 typedef unsigned short XMP_Uns16; 00076 typedef unsigned long XMP_Uns32; 00077 typedef unsigned long long XMP_Uns64; 00078 00079 #else 00080 00081 typedef signed char XMP_Int8; 00082 typedef signed short XMP_Int16; 00083 typedef signed int XMP_Int32; 00084 typedef signed long long XMP_Int64; 00085 00086 typedef unsigned char XMP_Uns8; 00087 typedef unsigned short XMP_Uns16; 00088 typedef unsigned int XMP_Uns32; 00089 typedef unsigned long long XMP_Uns64; 00090 00091 #endif 00092 00093 #else 00094 00095 #error "XMP environment error - must define one of XMP_MacBuild, XMP_WinBuild, or XMP_UNIXBuild" 00096 00097 #endif 00098 00099 typedef XMP_Uns8 XMP_Bool; 00100 00103 typedef struct __XMPMeta__ * XMPMetaRef; 00104 00107 typedef struct __XMPIterator__ * XMPIteratorRef; 00108 00111 typedef struct __XMPDocOps__ * XMPDocOpsRef; 00112 00115 typedef struct __XMPFiles__ * XMPFilesRef; 00116 00117 // ================================================================================================= 00118 00121 00125 00129 00133 00140 00141 typedef const char * XMP_StringPtr; // Points to a null terminated UTF-8 string. 00142 typedef XMP_Uns32 XMP_StringLen; 00143 typedef XMP_Int32 XMP_Index; // Signed, sometimes -1 is handy. 00144 typedef XMP_Uns32 XMP_OptionBits; // Used as 32 individual bits. 00145 00150 00155 00156 #define kXMP_TrueStr "True" // Serialized XMP spellings, not for the type bool. 00157 #define kXMP_FalseStr "False" 00158 00161 enum { 00163 kXMPTS_Yes = 1, 00165 kXMPTS_No = 0, 00167 kXMPTS_Maybe = -1 00168 }; 00169 typedef XMP_Int8 XMP_TriState; 00170 00172 00173 // ================================================================================================= 00174 00194 00195 struct XMP_DateTime { 00196 00198 XMP_Int32 year; 00199 00201 XMP_Int32 month; 00202 00204 XMP_Int32 day; 00205 00207 XMP_Int32 hour; 00208 00210 XMP_Int32 minute; 00211 00213 XMP_Int32 second; 00214 00216 XMP_Bool hasDate; 00217 00219 XMP_Bool hasTime; 00220 00222 XMP_Bool hasTimeZone; 00223 00226 XMP_Int8 tzSign; 00227 00229 XMP_Int32 tzHour; 00230 00232 XMP_Int32 tzMinute; 00233 00235 XMP_Int32 nanoSecond; 00236 00237 #if __cplusplus 00238 XMP_DateTime() : year(0), month(0), day(0), hour(0), minute(0), second(0), nanoSecond(0), 00239 tzSign(0), tzHour(0), tzMinute(0), hasDate(false), hasTime(false), hasTimeZone(false) {}; 00240 #endif 00241 00242 }; 00243 00245 enum { 00247 kXMP_TimeWestOfUTC = -1, 00249 kXMP_TimeIsUTC = 0, 00251 kXMP_TimeEastOfUTC = +1 00252 }; 00253 00254 #define XMPDateTime_IsDateOnly(dt) ((dt).hasDate & (! (dt).hasTime)) 00255 #define XMPDateTime_IsTimeOnly(dt) ((dt).hasTime & (! (dt).hasDate)) 00256 00257 #define XMPDateTime_ClearTimeZone(dt) { (dt).hasTimeZone = (dt).tzSign = (dt).tzHour = (dt).tzMinute = 0; } 00258 00259 // ================================================================================================= 00260 // Standard namespace URI constants 00261 // ================================ 00262 00297 00298 #define kXMP_NS_XMP "http://ns.adobe.com/xap/1.0/" 00299 00300 #define kXMP_NS_XMP_Rights "http://ns.adobe.com/xap/1.0/rights/" 00301 #define kXMP_NS_XMP_MM "http://ns.adobe.com/xap/1.0/mm/" 00302 #define kXMP_NS_XMP_BJ "http://ns.adobe.com/xap/1.0/bj/" 00303 00304 #define kXMP_NS_PDF "http://ns.adobe.com/pdf/1.3/" 00305 #define kXMP_NS_Photoshop "http://ns.adobe.com/photoshop/1.0/" 00306 #define kXMP_NS_PSAlbum "http://ns.adobe.com/album/1.0/" 00307 #define kXMP_NS_EXIF "http://ns.adobe.com/exif/1.0/" 00308 #define kXMP_NS_EXIF_Aux "http://ns.adobe.com/exif/1.0/aux/" 00309 #define kXMP_NS_TIFF "http://ns.adobe.com/tiff/1.0/" 00310 #define kXMP_NS_PNG "http://ns.adobe.com/png/1.0/" 00311 #define kXMP_NS_SWF "http://ns.adobe.com/swf/1.0/" 00312 #define kXMP_NS_JPEG "http://ns.adobe.com/jpeg/1.0/" 00313 #define kXMP_NS_JP2K "http://ns.adobe.com/jp2k/1.0/" 00314 #define kXMP_NS_CameraRaw "http://ns.adobe.com/camera-raw-settings/1.0/" 00315 #define kXMP_NS_DM "http://ns.adobe.com/xmp/1.0/DynamicMedia/" 00316 #define kXMP_NS_Script "http://ns.adobe.com/xmp/1.0/Script/" 00317 #define kXMP_NS_ASF "http://ns.adobe.com/asf/1.0/" 00318 #define kXMP_NS_WAV "http://ns.adobe.com/xmp/wav/1.0/" 00319 #define kXMP_NS_BWF "http://ns.adobe.com/bwf/bext/1.0/" 00320 #define kXMP_NS_AEScart "http://ns.adobe.com/aes/cart/" 00321 #define kXMP_NS_RIFFINFO "http://ns.adobe.com/riff/info/" 00322 00323 #define kXMP_NS_XMP_Note "http://ns.adobe.com/xmp/note/" 00324 00325 #define kXMP_NS_AdobeStockPhoto "http://ns.adobe.com/StockPhoto/1.0/" 00326 #define kXMP_NS_CreatorAtom "http://ns.adobe.com/creatorAtom/1.0/" 00327 00328 #define kXMP_NS_ExifEX "http://cipa.jp/exif/1.0/" 00329 00355 00356 #define kXMP_NS_XMP_IdentifierQual "http://ns.adobe.com/xmp/Identifier/qual/1.0/" 00357 #define kXMP_NS_XMP_Dimensions "http://ns.adobe.com/xap/1.0/sType/Dimensions#" 00358 #define kXMP_NS_XMP_Text "http://ns.adobe.com/xap/1.0/t/" 00359 #define kXMP_NS_XMP_PagedFile "http://ns.adobe.com/xap/1.0/t/pg/" 00360 #define kXMP_NS_XMP_Graphics "http://ns.adobe.com/xap/1.0/g/" 00361 #define kXMP_NS_XMP_Image "http://ns.adobe.com/xap/1.0/g/img/" 00362 #define kXMP_NS_XMP_Font "http://ns.adobe.com/xap/1.0/sType/Font#" 00363 #define kXMP_NS_XMP_ResourceEvent "http://ns.adobe.com/xap/1.0/sType/ResourceEvent#" 00364 #define kXMP_NS_XMP_ResourceRef "http://ns.adobe.com/xap/1.0/sType/ResourceRef#" 00365 #define kXMP_NS_XMP_ST_Version "http://ns.adobe.com/xap/1.0/sType/Version#" 00366 #define kXMP_NS_XMP_ST_Job "http://ns.adobe.com/xap/1.0/sType/Job#" 00367 #define kXMP_NS_XMP_ManifestItem "http://ns.adobe.com/xap/1.0/sType/ManifestItem#" 00368 00369 // Deprecated XML namespace constants 00370 #define kXMP_NS_XMP_T "http://ns.adobe.com/xap/1.0/t/" 00371 #define kXMP_NS_XMP_T_PG "http://ns.adobe.com/xap/1.0/t/pg/" 00372 #define kXMP_NS_XMP_G_IMG "http://ns.adobe.com/xap/1.0/g/img/" 00373 00393 00394 #define kXMP_NS_DC "http://purl.org/dc/elements/1.1/" 00395 00396 #define kXMP_NS_IPTCCore "http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/" 00397 #define kXMP_NS_IPTCExt "http://iptc.org/std/Iptc4xmpExt/2008-02-29/" 00398 00399 #define kXMP_NS_DICOM "http://ns.adobe.com/DICOM/" 00400 00401 #define kXMP_NS_PLUS "http://ns.useplus.org/ldf/xmp/1.0/" 00402 00403 #define kXMP_NS_PDFA_Schema "http://www.aiim.org/pdfa/ns/schema#" 00404 #define kXMP_NS_PDFA_Property "http://www.aiim.org/pdfa/ns/property#" 00405 #define kXMP_NS_PDFA_Type "http://www.aiim.org/pdfa/ns/type#" 00406 #define kXMP_NS_PDFA_Field "http://www.aiim.org/pdfa/ns/field#" 00407 #define kXMP_NS_PDFA_ID "http://www.aiim.org/pdfa/ns/id/" 00408 #define kXMP_NS_PDFA_Extension "http://www.aiim.org/pdfa/ns/extension/" 00409 00410 #define kXMP_NS_PDFX "http://ns.adobe.com/pdfx/1.3/" 00411 #define kXMP_NS_PDFX_ID "http://www.npes.org/pdfx/ns/id/" 00412 00413 #define kXMP_NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#" 00414 #define kXMP_NS_XML "http://www.w3.org/XML/1998/namespace" 00415 00416 // ================================================================================================= 00417 // Enums and macros used for option bits 00418 // ===================================== 00419 00433 00434 #define kXMP_ArrayLastItem ((XMP_Index)(-1L)) 00435 #define kXMP_UseNullTermination ((XMP_StringLen)(~0UL)) 00436 #define kXMP_NoOptions ((XMP_OptionBits)0UL) 00437 00470 00471 #define XMP_SetOption(var,opt) var |= (opt) 00472 #define XMP_ClearOption(var,opt) var &= ~(opt) 00473 #define XMP_TestOption(var,opt) (((var) & (opt)) != 0) 00474 #define XMP_OptionIsSet(var,opt) (((var) & (opt)) != 0) 00475 #define XMP_OptionIsClear(var,opt) (((var) & (opt)) == 0) 00476 00529 00530 #define XMP_PropIsSimple(opt) (((opt) & kXMP_PropCompositeMask) == 0) 00531 #define XMP_PropIsStruct(opt) (((opt) & kXMP_PropValueIsStruct) != 0) 00532 #define XMP_PropIsArray(opt) (((opt) & kXMP_PropValueIsArray) != 0) 00533 00534 #define XMP_ArrayIsUnordered(opt) (((opt) & kXMP_PropArrayIsOrdered) == 0) 00535 #define XMP_ArrayIsOrdered(opt) (((opt) & kXMP_PropArrayIsOrdered) != 0) 00536 #define XMP_ArrayIsAlternate(opt) (((opt) & kXMP_PropArrayIsAlternate) != 0) 00537 #define XMP_ArrayIsAltText(opt) (((opt) & kXMP_PropArrayIsAltText) != 0) 00538 00539 #define XMP_PropHasQualifiers(opt) (((opt) & kXMP_PropHasQualifiers) != 0) 00540 #define XMP_PropIsQualifier(opt) (((opt) & kXMP_PropIsQualifier) != 0) 00541 #define XMP_PropHasLang(opt) (((opt) & kXMP_PropHasLang) != 0) 00542 00543 #define XMP_NodeIsSchema(opt) (((opt) & kXMP_SchemaNode) != 0) 00544 #define XMP_PropIsAlias(opt) (((opt) & kXMP_PropIsAlias) != 0) 00545 00546 // ------------------------------------------------------------------------------------------------- 00547 00549 enum { 00550 00552 kXMP_PropValueIsURI = 0x00000002UL, 00553 00554 // ------------------------------------------------------ 00555 // Options relating to qualifiers attached to a property. 00556 00558 kXMP_PropHasQualifiers = 0x00000010UL, 00559 00564 kXMP_PropIsQualifier = 0x00000020UL, 00565 00567 kXMP_PropHasLang = 0x00000040UL, 00568 00570 kXMP_PropHasType = 0x00000080UL, 00571 00572 // -------------------------------------------- 00573 // Options relating to the data structure form. 00574 00576 kXMP_PropValueIsStruct = 0x00000100UL, 00577 00580 kXMP_PropValueIsArray = 0x00000200UL, 00581 00583 kXMP_PropArrayIsUnordered = kXMP_PropValueIsArray, 00584 00586 kXMP_PropArrayIsOrdered = 0x00000400UL, 00587 00589 kXMP_PropArrayIsAlternate = 0x00000800UL, 00590 00591 // ------------------------------------ 00592 // Additional struct and array options. 00593 00596 kXMP_PropArrayIsAltText = 0x00001000UL, 00597 00598 // kXMP_InsertBeforeItem = 0x00004000UL, ! Used by SetXyz functions. 00599 // kXMP_InsertAfterItem = 0x00008000UL, ! Used by SetXyz functions. 00600 00601 // ---------------------------- 00602 // Other miscellaneous options. 00603 00606 kXMP_PropIsAlias = 0x00010000UL, 00607 00610 kXMP_PropHasAliases = 0x00020000UL, 00611 00613 kXMP_PropIsInternal = 0x00040000UL, 00614 00616 kXMP_PropIsStable = 0x00100000UL, 00617 00619 kXMP_PropIsDerived = 0x00200000UL, 00620 00621 // kXMPUtil_AllowCommas = 0x10000000UL, ! Used by TXMPUtils::CatenateArrayItems and ::SeparateArrayItems. 00622 // kXMP_DeleteExisting = 0x20000000UL, ! Used by TXMPMeta::SetXyz functions to delete any pre-existing property. 00623 // kXMP_SchemaNode = 0x80000000UL, ! Returned by iterators - #define to avoid warnings 00624 00625 // ------------------------------ 00626 // Masks that are multiple flags. 00627 00629 kXMP_PropArrayFormMask = kXMP_PropValueIsArray | kXMP_PropArrayIsOrdered | kXMP_PropArrayIsAlternate | kXMP_PropArrayIsAltText, 00630 00632 kXMP_PropCompositeMask = kXMP_PropValueIsStruct | kXMP_PropArrayFormMask, 00633 00635 kXMP_ImplReservedMask = 0x70000000L 00636 00637 }; 00638 00639 #define kXMP_SchemaNode ((XMP_OptionBits)0x80000000UL) 00640 00649 enum { 00650 00652 kXMP_InsertBeforeItem = 0x00004000UL, 00653 00655 kXMP_InsertAfterItem = 0x00008000UL, 00656 00658 kXMP_DeleteExisting = 0x20000000UL, 00659 00661 kXMP_PropValueOptionsMask = kXMP_PropValueIsURI, 00662 00664 kXMP_PropArrayLocationMask = kXMP_InsertBeforeItem | kXMP_InsertAfterItem 00665 00666 }; 00667 00668 // ------------------------------------------------------------------------------------------------- 00669 00671 enum { 00672 00674 kXMP_RequireXMPMeta = 0x0001UL, 00675 00677 kXMP_ParseMoreBuffers = 0x0002UL, 00678 00680 kXMP_StrictAliasing = 0x0004UL 00681 00682 }; 00683 00685 enum { 00686 00687 // *** Option to remove empty struct/array, or leaf with empty value? 00688 00690 kXMP_OmitPacketWrapper = 0x0010UL, 00691 00693 kXMP_ReadOnlyPacket = 0x0020UL, 00694 00696 kXMP_UseCompactFormat = 0x0040UL, 00697 00699 kXMP_UseCanonicalFormat = 0x0080UL, 00700 00702 kXMP_IncludeThumbnailPad = 0x0100UL, 00703 00705 kXMP_ExactPacketLength = 0x0200UL, 00706 00708 kXMP_OmitAllFormatting = 0x0800UL, 00709 00711 kXMP_OmitXMPMetaElement = 0x1000UL, 00712 00713 _XMP_LittleEndian_Bit = 0x0001UL, // ! Don't use directly, see the combined values below! 00714 _XMP_UTF16_Bit = 0x0002UL, 00715 _XMP_UTF32_Bit = 0x0004UL, 00716 00718 kXMP_EncodingMask = 0x0007UL, 00719 00721 kXMP_EncodeUTF8 = 0UL, 00722 00724 kXMP_EncodeUTF16Big = _XMP_UTF16_Bit, 00725 00727 kXMP_EncodeUTF16Little = _XMP_UTF16_Bit | _XMP_LittleEndian_Bit, 00728 00730 kXMP_EncodeUTF32Big = _XMP_UTF32_Bit, 00731 00733 kXMP_EncodeUTF32Little = _XMP_UTF32_Bit | _XMP_LittleEndian_Bit 00734 00735 }; 00736 00737 // ------------------------------------------------------------------------------------------------- 00738 00740 enum { 00741 00743 kXMP_IterClassMask = 0x00FFUL, 00744 00746 kXMP_IterProperties = 0x0000UL, 00747 00749 kXMP_IterAliases = 0x0001UL, 00750 00752 kXMP_IterNamespaces = 0x0002UL, 00753 00755 kXMP_IterJustChildren = 0x0100UL, 00756 00758 kXMP_IterJustLeafNodes = 0x0200UL, 00759 00761 kXMP_IterJustLeafName = 0x0400UL, 00762 00764 kXMP_IterOmitQualifiers = 0x1000UL 00765 00766 }; 00767 00769 enum { 00770 00772 kXMP_IterSkipSubtree = 0x0001UL, 00773 00775 kXMP_IterSkipSiblings = 0x0002UL 00776 00777 }; 00778 00779 // ------------------------------------------------------------------------------------------------- 00780 00787 enum { 00788 00790 kXMPUtil_AllowCommas = 0x10000000UL 00791 00792 }; 00793 00795 enum { 00796 00798 kXMPTemplate_IncludeInternalProperties = 0x0001UL, 00799 00801 kXMPTemplate_ReplaceExistingProperties = 0x0002UL, 00802 00804 kXMPTemplate_ReplaceWithDeleteEmpty = 0x0004UL, 00805 00807 kXMPTemplate_AddNewProperties = 0x0008UL, 00808 00810 kXMPTemplate_ClearUnnamedProperties = 0x0010UL 00811 00812 }; 00813 00815 enum { 00816 00818 kXMPUtil_DoAllProperties = 0x0001UL, 00819 00821 kXMPUtil_ReplaceOldValues = 0x0002UL, 00822 00824 kXMPUtil_DeleteEmptyValues = 0x0004UL, 00825 00827 kXMPUtil_IncludeAliases = 0x0800UL 00828 00829 }; 00830 00831 // ================================================================================================= 00832 // Types and Constants for XMPFiles 00833 // ================================ 00834 00836 enum SeekMode { kXMP_SeekFromStart, kXMP_SeekFromCurrent, kXMP_SeekFromEnd }; 00837 00839 enum { 00840 00841 // ! Hex used to avoid gcc warnings. Leave the constants so the text reads big endian. There 00842 // ! seems to be no decent way on UNIX to determine the target endianness at compile time. 00843 // ! Forcing it on the client isn't acceptable. 00844 00845 // -------------------- 00846 // Public file formats. 00847 00849 kXMP_PDFFile = 0x50444620UL, 00851 kXMP_PostScriptFile = 0x50532020UL, 00853 kXMP_EPSFile = 0x45505320UL, 00854 00856 kXMP_JPEGFile = 0x4A504547UL, 00858 kXMP_JPEG2KFile = 0x4A505820UL, 00860 kXMP_TIFFFile = 0x54494646UL, 00862 kXMP_GIFFile = 0x47494620UL, 00864 kXMP_PNGFile = 0x504E4720UL, 00865 00867 kXMP_SWFFile = 0x53574620UL, 00869 kXMP_FLAFile = 0x464C4120UL, 00871 kXMP_FLVFile = 0x464C5620UL, 00872 00874 kXMP_MOVFile = 0x4D4F5620UL, 00876 kXMP_AVIFile = 0x41564920UL, 00878 kXMP_CINFile = 0x43494E20UL, 00880 kXMP_WAVFile = 0x57415620UL, 00882 kXMP_MP3File = 0x4D503320UL, 00884 kXMP_SESFile = 0x53455320UL, 00886 kXMP_CELFile = 0x43454C20UL, 00888 kXMP_MPEGFile = 0x4D504547UL, 00890 kXMP_MPEG2File = 0x4D503220UL, 00892 kXMP_MPEG4File = 0x4D503420UL, 00894 kXMP_MXFFile = 0x4D584620UL, 00896 kXMP_WMAVFile = 0x574D4156UL, 00898 kXMP_AIFFFile = 0x41494646UL, 00900 kXMP_P2File = 0x50322020UL, 00902 kXMP_XDCAM_FAMFile = 0x58444346UL, 00904 kXMP_XDCAM_SAMFile = 0x58444353UL, 00906 kXMP_XDCAM_EXFile = 0x58444358UL, 00908 kXMP_AVCHDFile = 0x41564844UL, 00910 kXMP_SonyHDVFile = 0x53484456UL, 00912 kXMP_CanonXFFile = 0x434E5846UL, 00913 00915 kXMP_HTMLFile = 0x48544D4CUL, 00917 kXMP_XMLFile = 0x584D4C20UL, 00919 kXMP_TextFile = 0x74657874UL, 00920 00921 // ------------------------------- 00922 // Adobe application file formats. 00923 00925 kXMP_PhotoshopFile = 0x50534420UL, 00927 kXMP_IllustratorFile = 0x41492020UL, 00929 kXMP_InDesignFile = 0x494E4444UL, 00931 kXMP_AEProjectFile = 0x41455020UL, 00933 kXMP_AEProjTemplateFile = 0x41455420UL, 00935 kXMP_AEFilterPresetFile = 0x46465820UL, 00937 kXMP_EncoreProjectFile = 0x4E434F52UL, 00939 kXMP_PremiereProjectFile = 0x5052504AUL, 00941 kXMP_PremiereTitleFile = 0x5052544CUL, 00943 kXMP_UCFFile = 0x55434620UL, 00944 00945 // ------- 00946 // Others. 00947 00949 kXMP_UnknownFile = 0x20202020UL 00950 00951 }; 00952 00954 typedef XMP_Uns32 XMP_FileFormat; 00955 00956 // ------------------------------------------------------------------------------------------------- 00957 00959 enum { 00960 kXMP_CharLittleEndianMask = 1, 00961 kXMP_Char16BitMask = 2, 00962 kXMP_Char32BitMask = 4 00963 }; 00964 00966 enum { 00968 kXMP_Char8Bit = 0, 00970 kXMP_Char16BitBig = kXMP_Char16BitMask, 00972 kXMP_Char16BitLittle = kXMP_Char16BitMask | kXMP_CharLittleEndianMask, 00974 kXMP_Char32BitBig = kXMP_Char32BitMask, 00976 kXMP_Char32BitLittle = kXMP_Char32BitMask | kXMP_CharLittleEndianMask, 00978 kXMP_CharUnknown = 1 00979 }; 00980 01013 01014 #define XMP_CharFormIs16Bit(f) ( ((int)(f) & kXMP_Char16BitMask) != 0 ) 01015 #define XMP_CharFormIs32Bit(f) ( ((int)(f) & kXMP_Char32BitMask) != 0 ) 01016 #define XMP_CharFormIsBigEndian(f) ( ((int)(f) & kXMP_CharLittleEndianMask) == 0 ) 01017 #define XMP_CharFormIsLittleEndian(f) ( ((int)(f) & kXMP_CharLittleEndianMask) != 0 ) 01018 #define XMP_GetCharSize(f) ( ((int)(f)&6) == 0 ? 1 : (int)(f)&6 ) 01019 #define XMP_CharToSerializeForm(cf) ( (XMP_OptionBits)(cf) ) 01020 #define XMP_CharFromSerializeForm(sf) ( (XMP_Uns8)(sf) ) 01021 01024 #define kXMPFiles_UnknownOffset ((XMP_Int64)-1) 01025 01028 #define kXMPFiles_UnknownLength ((XMP_Int32)-1) 01029 01031 struct XMP_PacketInfo { 01032 01034 XMP_Int64 offset; 01036 XMP_Int32 length; 01038 XMP_Int32 padSize; // Zero if unknown. 01039 01041 XMP_Uns8 charForm; 01043 XMP_Bool writeable; 01045 XMP_Bool hasWrapper; 01046 01048 XMP_Uns8 pad; 01049 01051 XMP_PacketInfo() : offset(kXMPFiles_UnknownOffset), length(kXMPFiles_UnknownLength), 01052 padSize(0), charForm(0), writeable(0), hasWrapper(0), pad(0) {}; 01053 01054 }; 01055 01057 enum { 01059 kXMP_PacketInfoVersion = 3 01060 }; 01061 01062 // ------------------------------------------------------------------------------------------------- 01063 01065 enum { 01067 kXMPFiles_IgnoreLocalText = 0x0002, 01069 kXMPFiles_ServerMode = kXMPFiles_IgnoreLocalText 01070 }; 01071 01073 enum { 01074 01076 kXMPFiles_CanInjectXMP = 0x00000001, 01077 01079 kXMPFiles_CanExpand = 0x00000002, 01080 01082 kXMPFiles_CanRewrite = 0x00000004, 01083 01085 kXMPFiles_PrefersInPlace = 0x00000008, 01086 01088 kXMPFiles_CanReconcile = 0x00000010, 01089 01091 kXMPFiles_AllowsOnlyXMP = 0x00000020, 01092 01094 kXMPFiles_ReturnsRawPacket = 0x00000040, 01095 01097 kXMPFiles_HandlerOwnsFile = 0x00000100, 01098 01100 kXMPFiles_AllowsSafeUpdate = 0x00000200, 01101 01103 kXMPFiles_NeedsReadOnlyPacket = 0x00000400, 01104 01106 kXMPFiles_UsesSidecarXMP = 0x00000800, 01107 01109 kXMPFiles_FolderBasedFormat = 0x00001000 01110 01111 }; 01112 01114 enum { 01115 01117 kXMPFiles_OpenForRead = 0x00000001, 01118 01120 kXMPFiles_OpenForUpdate = 0x00000002, 01121 01123 kXMPFiles_OpenOnlyXMP = 0x00000004, 01124 01126 kXMPFiles_ForceGivenHandler = 0x00000008, 01127 01129 kXMPFiles_OpenStrictly = 0x00000010, 01130 01132 kXMPFiles_OpenUseSmartHandler = 0x00000020, 01133 01135 kXMPFiles_OpenUsePacketScanning = 0x00000040, 01136 01138 kXMPFiles_OpenLimitedScanning = 0x00000080, 01139 01141 kXMPFiles_OpenRepairFile = 0x00000100 01142 01143 }; 01144 01146 enum { 01148 kXMPFiles_UpdateSafely = 0x0001 01149 }; 01150 01151 // ================================================================================================= 01152 // Exception codes 01153 // =============== 01154 01168 01170 class XMP_Error { 01171 public: 01172 01179 XMP_Error ( XMP_Int32 _id, XMP_StringPtr _errMsg ) : id(_id), errMsg(_errMsg) {}; 01180 01182 inline XMP_Int32 GetID() const { return id; }; 01183 01185 inline XMP_StringPtr GetErrMsg() const { return errMsg; }; 01186 01187 private: 01189 XMP_Int32 id; 01192 XMP_StringPtr errMsg; 01193 }; 01194 01196 enum { 01197 01198 // -------------------- 01199 // Generic error codes. 01200 01202 kXMPErr_NoError = -1, 01203 01205 kXMPErr_Unknown = 0, 01207 kXMPErr_TBD = 1, 01209 kXMPErr_Unavailable = 2, 01211 kXMPErr_BadObject = 3, 01213 kXMPErr_BadParam = 4, 01215 kXMPErr_BadValue = 5, 01217 kXMPErr_AssertFailure = 6, 01219 kXMPErr_EnforceFailure = 7, 01221 kXMPErr_Unimplemented = 8, 01223 kXMPErr_InternalFailure = 9, 01225 kXMPErr_Deprecated = 10, 01227 kXMPErr_ExternalFailure = 11, 01229 kXMPErr_UserAbort = 12, 01231 kXMPErr_StdException = 13, 01233 kXMPErr_UnknownException = 14, 01235 kXMPErr_NoMemory = 15, 01236 01237 // ------------------------------------ 01238 // More specific parameter error codes. 01239 01241 kXMPErr_BadSchema = 101, 01243 kXMPErr_BadXPath = 102, 01245 kXMPErr_BadOptions = 103, 01247 kXMPErr_BadIndex = 104, 01249 kXMPErr_BadIterPosition = 105, 01251 kXMPErr_BadParse = 106, 01253 kXMPErr_BadSerialize = 107, 01255 kXMPErr_BadFileFormat = 108, 01257 kXMPErr_NoFileHandler = 109, 01259 kXMPErr_TooLargeForJPEG = 110, 01260 01261 // ----------------------------------------------- 01262 // File format and internal structure error codes. 01263 01265 kXMPErr_BadXML = 201, 01267 kXMPErr_BadRDF = 202, 01269 kXMPErr_BadXMP = 203, 01271 kXMPErr_EmptyIterator = 204, 01273 kXMPErr_BadUnicode = 205, 01275 kXMPErr_BadTIFF = 206, 01277 kXMPErr_BadJPEG = 207, 01279 kXMPErr_BadPSD = 208, 01281 kXMPErr_BadPSIR = 209, 01283 kXMPErr_BadIPTC = 210, 01285 kXMPErr_BadMPEG = 211 01286 01287 }; 01288 01290 01291 // ================================================================================================= 01292 // Client callbacks 01293 // ================ 01294 01295 // ------------------------------------------------------------------------------------------------- 01298 01303 01304 typedef XMP_Int32 XMP_Status; 01305 01306 // ------------------------------------------------------------------------------------------------- 01321 01322 typedef XMP_Status (* XMP_TextOutputProc) ( void * refCon, 01323 XMP_StringPtr buffer, 01324 XMP_StringLen bufferSize ); 01325 01326 // ------------------------------------------------------------------------------------------------- 01335 01336 typedef bool (* XMP_AbortProc) ( void * arg ); // Used by . 01337 01339 01340 // ================================================================================================= 01341 // Stuff with no better place to be 01342 // ================================ 01343 01345 typedef struct XMP_VersionInfo { 01347 XMP_Uns8 major; 01349 XMP_Uns8 minor; 01351 XMP_Uns8 micro; 01353 XMP_Bool isDebug; 01355 XMP_Uns32 build; 01357 XMP_Uns32 flags; 01359 XMP_StringPtr message; 01360 } XMP_VersionInfo; 01361 01362 // ================================================================================================= 01363 01364 #if __cplusplus 01365 } // extern "C" 01366 #endif 01367 01368 #endif // __XMP_Const_h__