00001 #ifndef __TXMPMeta_hpp__ 00002 #define __TXMPMeta_hpp__ 1 00003 00004 #if ( ! __XMP_hpp__ ) 00005 #error "Do not directly include, use XMP.hpp" 00006 #endif 00007 00008 // ================================================================================================= 00009 // ADOBE SYSTEMS INCORPORATED 00010 // Copyright 2002 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 // ================================================================================================= 00028 // ================================================================================================= 00029 00030 // ================================================================================================= 00043 // ================================================================================================= 00044 00045 template <class tStringObj> class TXMPIterator; 00046 template <class tStringObj> class TXMPUtils; 00047 00048 // ------------------------------------------------------------------------------------------------- 00049 00050 template <class tStringObj> class TXMPMeta { 00051 00052 public: 00053 00054 // ============================================================================================= 00055 // Initialization and termination 00056 // ============================== 00057 00058 // --------------------------------------------------------------------------------------------- 00062 00063 // --------------------------------------------------------------------------------------------- 00075 00076 static void GetVersionInfo ( XMP_VersionInfo * info ); 00077 00078 // --------------------------------------------------------------------------------------------- 00080 00089 static bool Initialize(); 00090 // --------------------------------------------------------------------------------------------- 00096 00097 static void Terminate(); 00098 00100 00101 // ============================================================================================= 00102 // Constuctors and destructor 00103 // ========================== 00104 00105 // --------------------------------------------------------------------------------------------- 00108 00109 // --------------------------------------------------------------------------------------------- 00115 TXMPMeta(); 00116 00117 // --------------------------------------------------------------------------------------------- 00126 00127 TXMPMeta ( const TXMPMeta<tStringObj> & original ); 00128 00129 // --------------------------------------------------------------------------------------------- 00134 00135 void operator= ( const TXMPMeta<tStringObj> & rhs ); 00136 00137 // --------------------------------------------------------------------------------------------- 00147 00148 TXMPMeta ( XMPMetaRef xmpRef ); 00149 00150 // --------------------------------------------------------------------------------------------- 00167 00168 TXMPMeta ( XMP_StringPtr buffer, 00169 XMP_StringLen xmpSize ); 00170 00171 // --------------------------------------------------------------------------------------------- 00173 virtual ~TXMPMeta() throw(); 00174 00176 00177 // ============================================================================================= 00178 // Global state functions 00179 // ====================== 00180 00181 // --------------------------------------------------------------------------------------------- 00186 00187 // --------------------------------------------------------------------------------------------- 00194 00195 static XMP_OptionBits GetGlobalOptions(); 00196 00197 // --------------------------------------------------------------------------------------------- 00208 00209 static void SetGlobalOptions ( XMP_OptionBits options ); 00210 00212 00213 // --------------------------------------------------------------------------------------------- 00221 00222 // --------------------------------------------------------------------------------------------- 00235 00236 static XMP_Status DumpNamespaces ( XMP_TextOutputProc outProc, 00237 void * clientData ); 00238 00240 00241 // --------------------------------------------------------------------------------------------- 00252 00253 // --------------------------------------------------------------------------------------------- 00274 00275 static bool RegisterNamespace ( XMP_StringPtr namespaceURI, 00276 XMP_StringPtr suggestedPrefix, 00277 tStringObj * registeredPrefix ); 00278 00279 // --------------------------------------------------------------------------------------------- 00293 00294 static bool GetNamespacePrefix ( XMP_StringPtr namespaceURI, 00295 tStringObj * namespacePrefix ); 00296 00297 // --------------------------------------------------------------------------------------------- 00310 00311 static bool GetNamespaceURI ( XMP_StringPtr namespacePrefix, 00312 tStringObj * namespaceURI ); 00313 00314 // --------------------------------------------------------------------------------------------- 00323 00324 static void DeleteNamespace ( XMP_StringPtr namespaceURI ); 00325 00327 00328 // ============================================================================================= 00329 // Basic property manipulation functions 00330 // ===================================== 00331 00332 // *** Should add discussion of schemaNS and propName prefix usage. 00333 00334 // --------------------------------------------------------------------------------------------- 00349 00350 // --------------------------------------------------------------------------------------------- 00380 00381 bool GetProperty ( XMP_StringPtr schemaNS, 00382 XMP_StringPtr propName, 00383 tStringObj * propValue, 00384 XMP_OptionBits * options ) const; 00385 00386 // --------------------------------------------------------------------------------------------- 00408 00409 bool GetArrayItem ( XMP_StringPtr schemaNS, 00410 XMP_StringPtr arrayName, 00411 XMP_Index itemIndex, 00412 tStringObj * itemValue, 00413 XMP_OptionBits * options ) const; 00414 00415 // --------------------------------------------------------------------------------------------- 00440 00441 bool GetStructField ( XMP_StringPtr schemaNS, 00442 XMP_StringPtr structName, 00443 XMP_StringPtr fieldNS, 00444 XMP_StringPtr fieldName, 00445 tStringObj * fieldValue, 00446 XMP_OptionBits * options ) const; 00447 00448 // --------------------------------------------------------------------------------------------- 00473 00474 bool GetQualifier ( XMP_StringPtr schemaNS, 00475 XMP_StringPtr propName, 00476 XMP_StringPtr qualNS, 00477 XMP_StringPtr qualName, 00478 tStringObj * qualValue, 00479 XMP_OptionBits * options ) const; 00480 00482 00483 // ============================================================================================= 00484 00485 // --------------------------------------------------------------------------------------------- 00497 00511 00512 // --------------------------------------------------------------------------------------------- 00529 00530 void SetProperty ( XMP_StringPtr schemaNS, 00531 XMP_StringPtr propName, 00532 XMP_StringPtr propValue, 00533 XMP_OptionBits options = 0 ); 00534 00535 // --------------------------------------------------------------------------------------------- 00540 00541 void SetProperty ( XMP_StringPtr schemaNS, 00542 XMP_StringPtr propName, 00543 const tStringObj & propValue, 00544 XMP_OptionBits options = 0 ); 00545 00546 // --------------------------------------------------------------------------------------------- 00574 00575 void SetArrayItem ( XMP_StringPtr schemaNS, 00576 XMP_StringPtr arrayName, 00577 XMP_Index itemIndex, 00578 XMP_StringPtr itemValue, 00579 XMP_OptionBits options = 0 ); 00580 00581 // --------------------------------------------------------------------------------------------- 00586 00587 void SetArrayItem ( XMP_StringPtr schemaNS, 00588 XMP_StringPtr arrayName, 00589 XMP_Index itemIndex, 00590 const tStringObj & itemValue, 00591 XMP_OptionBits options = 0 ); 00592 00593 // --------------------------------------------------------------------------------------------- 00619 00620 void AppendArrayItem ( XMP_StringPtr schemaNS, 00621 XMP_StringPtr arrayName, 00622 XMP_OptionBits arrayOptions, 00623 XMP_StringPtr itemValue, 00624 XMP_OptionBits itemOptions = 0 ); 00625 00626 // --------------------------------------------------------------------------------------------- 00632 00633 void AppendArrayItem ( XMP_StringPtr schemaNS, 00634 XMP_StringPtr arrayName, 00635 XMP_OptionBits arrayOptions, 00636 const tStringObj & itemValue, 00637 XMP_OptionBits itemOptions = 0 ); 00638 00639 // --------------------------------------------------------------------------------------------- 00664 00665 void SetStructField ( XMP_StringPtr schemaNS, 00666 XMP_StringPtr structName, 00667 XMP_StringPtr fieldNS, 00668 XMP_StringPtr fieldName, 00669 XMP_StringPtr fieldValue, 00670 XMP_OptionBits options = 0 ); 00671 00672 // --------------------------------------------------------------------------------------------- 00678 00679 void SetStructField ( XMP_StringPtr schemaNS, 00680 XMP_StringPtr structName, 00681 XMP_StringPtr fieldNS, 00682 XMP_StringPtr fieldName, 00683 const tStringObj & fieldValue, 00684 XMP_OptionBits options = 0 ); 00685 00686 // --------------------------------------------------------------------------------------------- 00711 00712 void SetQualifier ( XMP_StringPtr schemaNS, 00713 XMP_StringPtr propName, 00714 XMP_StringPtr qualNS, 00715 XMP_StringPtr qualName, 00716 XMP_StringPtr qualValue, 00717 XMP_OptionBits options = 0 ); 00718 00719 // --------------------------------------------------------------------------------------------- 00724 00725 void SetQualifier ( XMP_StringPtr schemaNS, 00726 XMP_StringPtr propName, 00727 XMP_StringPtr qualNS, 00728 XMP_StringPtr qualName, 00729 const tStringObj & qualValue, 00730 XMP_OptionBits options = 0 ); 00731 00733 00734 // ============================================================================================= 00735 00736 // --------------------------------------------------------------------------------------------- 00742 00743 // --------------------------------------------------------------------------------------------- 00751 00752 void DeleteProperty ( XMP_StringPtr schemaNS, 00753 XMP_StringPtr propName ); 00754 00755 // --------------------------------------------------------------------------------------------- 00768 00769 void DeleteArrayItem ( XMP_StringPtr schemaNS, 00770 XMP_StringPtr arrayName, 00771 XMP_Index itemIndex ); 00772 00773 // --------------------------------------------------------------------------------------------- 00788 00789 void DeleteStructField ( XMP_StringPtr schemaNS, 00790 XMP_StringPtr structName, 00791 XMP_StringPtr fieldNS, 00792 XMP_StringPtr fieldName ); 00793 00794 // --------------------------------------------------------------------------------------------- 00810 00811 void DeleteQualifier ( XMP_StringPtr schemaNS, 00812 XMP_StringPtr propName, 00813 XMP_StringPtr qualNS, 00814 XMP_StringPtr qualName ); 00815 00816 // --------------------------------------------------------------------------------------------- 00824 00825 bool DoesPropertyExist ( XMP_StringPtr schemaNS, 00826 XMP_StringPtr propName ) const; 00827 00828 // --------------------------------------------------------------------------------------------- 00842 00843 bool DoesArrayItemExist ( XMP_StringPtr schemaNS, 00844 XMP_StringPtr arrayName, 00845 XMP_Index itemIndex ) const; 00846 00847 // --------------------------------------------------------------------------------------------- 00864 00865 bool DoesStructFieldExist ( XMP_StringPtr schemaNS, 00866 XMP_StringPtr structName, 00867 XMP_StringPtr fieldNS, 00868 XMP_StringPtr fieldName ) const; 00869 00870 // --------------------------------------------------------------------------------------------- 00886 00887 bool DoesQualifierExist ( XMP_StringPtr schemaNS, 00888 XMP_StringPtr propName, 00889 XMP_StringPtr qualNS, 00890 XMP_StringPtr qualName ) const; 00891 00893 00894 // ============================================================================================= 00895 // Specialized Get and Set functions 00896 // ============================================================================================= 00897 00898 // --------------------------------------------------------------------------------------------- 00907 00908 // --------------------------------------------------------------------------------------------- 00927 00928 bool GetProperty_Bool ( XMP_StringPtr schemaNS, 00929 XMP_StringPtr propName, 00930 bool * propValue, 00931 XMP_OptionBits * options ) const; 00932 00933 // --------------------------------------------------------------------------------------------- 00952 00953 bool GetProperty_Int ( XMP_StringPtr schemaNS, 00954 XMP_StringPtr propName, 00955 XMP_Int32 * propValue, 00956 XMP_OptionBits * options ) const; 00957 00958 // --------------------------------------------------------------------------------------------- 00977 00978 bool GetProperty_Int64 ( XMP_StringPtr schemaNS, 00979 XMP_StringPtr propName, 00980 XMP_Int64 * propValue, 00981 XMP_OptionBits * options ) const; 00982 00983 // --------------------------------------------------------------------------------------------- 01002 01003 bool GetProperty_Float ( XMP_StringPtr schemaNS, 01004 XMP_StringPtr propName, 01005 double * propValue, 01006 XMP_OptionBits * options ) const; 01007 01008 // --------------------------------------------------------------------------------------------- 01027 01028 bool GetProperty_Date ( XMP_StringPtr schemaNS, 01029 XMP_StringPtr propName, 01030 XMP_DateTime * propValue, 01031 XMP_OptionBits * options ) const; 01032 01033 // --------------------------------------------------------------------------------------------- 01049 01050 void SetProperty_Bool ( XMP_StringPtr schemaNS, 01051 XMP_StringPtr propName, 01052 bool propValue, 01053 XMP_OptionBits options = 0 ); 01054 01055 // --------------------------------------------------------------------------------------------- 01071 01072 void SetProperty_Int ( XMP_StringPtr schemaNS, 01073 XMP_StringPtr propName, 01074 XMP_Int32 propValue, 01075 XMP_OptionBits options = 0 ); 01076 01077 // --------------------------------------------------------------------------------------------- 01093 01094 void SetProperty_Int64 ( XMP_StringPtr schemaNS, 01095 XMP_StringPtr propName, 01096 XMP_Int64 propValue, 01097 XMP_OptionBits options = 0 ); 01098 01099 // --------------------------------------------------------------------------------------------- 01115 01116 void SetProperty_Float ( XMP_StringPtr schemaNS, 01117 XMP_StringPtr propName, 01118 double propValue, 01119 XMP_OptionBits options = 0 ); 01120 01121 // --------------------------------------------------------------------------------------------- 01137 01138 void SetProperty_Date ( XMP_StringPtr schemaNS, 01139 XMP_StringPtr propName, 01140 const XMP_DateTime & propValue, 01141 XMP_OptionBits options = 0 ); 01142 01144 // ============================================================================================= 01183 01184 // --------------------------------------------------------------------------------------------- 01225 01226 bool GetLocalizedText ( XMP_StringPtr schemaNS, 01227 XMP_StringPtr altTextName, 01228 XMP_StringPtr genericLang, 01229 XMP_StringPtr specificLang, 01230 tStringObj * actualLang, 01231 tStringObj * itemValue, 01232 XMP_OptionBits * options ) const; 01233 01234 // --------------------------------------------------------------------------------------------- 01292 01293 void SetLocalizedText ( XMP_StringPtr schemaNS, 01294 XMP_StringPtr altTextName, 01295 XMP_StringPtr genericLang, 01296 XMP_StringPtr specificLang, 01297 XMP_StringPtr itemValue, 01298 XMP_OptionBits options = 0 ); 01299 01300 // --------------------------------------------------------------------------------------------- 01357 01358 void SetLocalizedText ( XMP_StringPtr schemaNS, 01359 XMP_StringPtr altTextName, 01360 XMP_StringPtr genericLang, 01361 XMP_StringPtr specificLang, 01362 const tStringObj & itemValue, 01363 XMP_OptionBits options = 0 ); 01364 01365 // --------------------------------------------------------------------------------------------- 01381 void 01382 DeleteLocalizedText ( XMP_StringPtr schemaNS, 01383 XMP_StringPtr altTextName, 01384 XMP_StringPtr genericLang, 01385 XMP_StringPtr specificLang ); 01386 01388 01389 // ============================================================================================= 01401 01402 // --------------------------------------------------------------------------------------------- 01426 01427 void ParseFromBuffer ( XMP_StringPtr buffer, 01428 XMP_StringLen bufferSize, 01429 XMP_OptionBits options = 0 ); 01430 01431 // --------------------------------------------------------------------------------------------- 01473 01474 void SerializeToBuffer ( tStringObj * rdfString, 01475 XMP_OptionBits options, 01476 XMP_StringLen padding, 01477 XMP_StringPtr newline, 01478 XMP_StringPtr indent = "", 01479 XMP_Index baseIndent = 0 ) const; 01480 01481 // --------------------------------------------------------------------------------------------- 01515 01516 void SerializeToBuffer ( tStringObj * rdfString, 01517 XMP_OptionBits options = 0, 01518 XMP_StringLen padding = 0 ) const; 01519 01521 // ============================================================================================= 01522 // Miscellaneous Member Functions 01523 // ============================== 01524 01525 // --------------------------------------------------------------------------------------------- 01528 01529 // --------------------------------------------------------------------------------------------- 01561 01562 XMPMetaRef GetInternalRef() const; 01563 01564 // --------------------------------------------------------------------------------------------- 01570 01571 void GetObjectName ( tStringObj * name ) const; 01572 01573 // --------------------------------------------------------------------------------------------- 01579 01580 void SetObjectName ( XMP_StringPtr name ); 01581 01582 // --------------------------------------------------------------------------------------------- 01588 01589 void SetObjectName ( tStringObj name ); 01590 01591 // --------------------------------------------------------------------------------------------- 01602 01603 void Sort(); 01604 01605 // --------------------------------------------------------------------------------------------- 01607 01608 void Erase(); 01609 01610 // --------------------------------------------------------------------------------------------- 01634 01635 TXMPMeta Clone ( XMP_OptionBits options = 0 ) const; 01636 01637 // --------------------------------------------------------------------------------------------- 01646 01647 XMP_Index CountArrayItems ( XMP_StringPtr schemaNS, 01648 XMP_StringPtr arrayName ) const; 01649 01650 // --------------------------------------------------------------------------------------------- 01663 01664 XMP_Status DumpObject ( XMP_TextOutputProc outProc, 01665 void * clientData ) const; 01666 01667 // --------------------------------------------------------------------------------------------- 01669 XMP_OptionBits GetObjectOptions() const; 01670 01671 // --------------------------------------------------------------------------------------------- 01673 void SetObjectOptions ( XMP_OptionBits options ); 01674 01676 01677 // ============================================================================================= 01678 // Error notifications 01679 // =================== 01680 01681 // --------------------------------------------------------------------------------------------- 01703 01704 // -------------------------------------------------------------------------------------------- 01712 01713 static void SetDefaultErrorCallback ( XMPMeta_ErrorCallbackProc proc, void* context = 0, XMP_Uns32 limit = 1 ); 01714 01715 // -------------------------------------------------------------------------------------------- 01723 01724 void SetErrorCallback ( XMPMeta_ErrorCallbackProc proc, void* context = 0, XMP_Uns32 limit = 1 ); 01725 01726 // -------------------------------------------------------------------------------------------- 01731 01732 void ResetErrorCallbackLimit ( XMP_Uns32 limit = 1 ); 01733 01735 01736 // ============================================================================================= 01737 01738 XMPMetaRef xmpRef; // *** Should be private, see below. 01739 01740 private: 01741 01742 #if 0 // *** VS.Net and gcc seem to not handle the friend declarations properly. 01743 friend class TXMPIterator <class tStringObj>; 01744 friend class TXMPUtils <class tStringObj>; 01745 #endif 01746 01747 static void SetClientString ( void * clientPtr, XMP_StringPtr valuePtr, XMP_StringLen valueLen ); 01748 01749 }; // class TXMPMeta 01750 01751 #endif // __TXMPMeta_hpp__