00001 #ifndef __TXMPFiles_hpp__ 00002 #define __TXMPFiles_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 // ================================================================================================= 00033 // ================================================================================================= 00034 00035 00036 // ================================================================================================= 00058 // ================================================================================================= 00059 00060 00061 #if XMP_StaticBuild // ! Client XMP_IO objects can only be used in static builds. 00062 #include "XMP_IO.hpp" 00063 #endif 00064 00065 00066 template <class tStringObj> 00067 class TXMPFiles { 00068 00069 public: 00070 00071 // ============================================================================================= 00076 00077 // --------------------------------------------------------------------------------------------- 00084 00085 static void GetVersionInfo ( XMP_VersionInfo * versionInfo ); 00086 00087 // --------------------------------------------------------------------------------------------- 00096 00097 static bool Initialize(); 00098 00099 // --------------------------------------------------------------------------------------------- 00113 00114 static bool Initialize ( XMP_OptionBits options ); 00115 00116 // --------------------------------------------------------------------------------------------- 00133 00134 static bool Initialize ( const char* pluginFolder, const char* plugins = NULL ); 00135 00136 // --------------------------------------------------------------------------------------------- 00154 00155 static bool Initialize ( XMP_OptionBits options, const char* pluginFolder, const char* plugins = NULL ); 00156 00157 // --------------------------------------------------------------------------------------------- 00164 00165 static void Terminate(); 00166 00168 00169 // ============================================================================================= 00175 00176 // --------------------------------------------------------------------------------------------- 00178 00179 TXMPFiles(); 00180 00181 // --------------------------------------------------------------------------------------------- 00187 00188 virtual ~TXMPFiles() throw(); 00189 00190 // --------------------------------------------------------------------------------------------- 00211 00212 TXMPFiles ( XMP_StringPtr filePath, 00213 XMP_FileFormat format = kXMP_UnknownFile, 00214 XMP_OptionBits openFlags = 0 ); 00215 00216 // --------------------------------------------------------------------------------------------- 00222 00223 TXMPFiles ( const tStringObj & filePath, 00224 XMP_FileFormat format = kXMP_UnknownFile, 00225 XMP_OptionBits openFlags = 0 ); 00226 00227 // --------------------------------------------------------------------------------------------- 00235 00236 TXMPFiles ( const TXMPFiles<tStringObj> & original ); 00237 00238 // --------------------------------------------------------------------------------------------- 00244 00245 void operator= ( const TXMPFiles<tStringObj> & rhs ); 00246 00247 // --------------------------------------------------------------------------------------------- 00258 00259 TXMPFiles ( XMPFilesRef xmpFilesObj ); 00260 00261 // --------------------------------------------------------------------------------------------- 00272 00273 XMPFilesRef GetInternalRef(); 00274 00276 00277 // ============================================================================================= 00283 00284 // --------------------------------------------------------------------------------------------- 00314 00315 00316 static bool GetFormatInfo ( XMP_FileFormat format, 00317 XMP_OptionBits * handlerFlags = 0 ); 00318 00320 00321 // ============================================================================================= 00326 00327 // --------------------------------------------------------------------------------------------- 00338 00339 static XMP_FileFormat CheckFileFormat ( XMP_StringPtr filePath ); 00340 00341 // --------------------------------------------------------------------------------------------- 00355 00356 static XMP_FileFormat CheckPackageFormat ( XMP_StringPtr folderPath ); 00357 00358 // --------------------------------------------------------------------------------------------- 00378 00379 static bool GetFileModDate ( XMP_StringPtr filePath, 00380 XMP_DateTime * modDate, 00381 XMP_FileFormat * format = 0, 00382 XMP_OptionBits options = 0 ); 00383 00384 00385 // --------------------------------------------------------------------------------------------- 00414 00415 static bool GetAssociatedResources ( XMP_StringPtr filePath, 00416 std::vector<tStringObj>* resourceList, 00417 XMP_FileFormat format = kXMP_UnknownFile, 00418 XMP_OptionBits options = 0); 00419 00420 // --------------------------------------------------------------------------------------------- 00440 00441 static bool IsMetadataWritable (XMP_StringPtr filePath, 00442 bool * writable, 00443 XMP_FileFormat format = kXMP_UnknownFile, 00444 XMP_OptionBits options = 0 ); 00445 00446 // --------------------------------------------------------------------------------------------- 00499 00500 bool OpenFile ( XMP_StringPtr filePath, 00501 XMP_FileFormat format = kXMP_UnknownFile, 00502 XMP_OptionBits openFlags = 0 ); 00503 00504 // --------------------------------------------------------------------------------------------- 00509 00510 bool OpenFile ( const tStringObj & filePath, 00511 XMP_FileFormat format = kXMP_UnknownFile, 00512 XMP_OptionBits openFlags = 0 ); 00513 00514 #if XMP_StaticBuild // ! Client XMP_IO objects can only be used in static builds. 00515 // --------------------------------------------------------------------------------------------- 00521 00522 bool OpenFile ( XMP_IO * clientIO, 00523 XMP_FileFormat format = kXMP_UnknownFile, 00524 XMP_OptionBits openFlags = 0 ); 00525 #endif 00526 00527 // --------------------------------------------------------------------------------------------- 00548 00549 void CloseFile ( XMP_OptionBits closeFlags = 0 ); 00550 00551 // --------------------------------------------------------------------------------------------- 00568 00569 bool GetFileInfo ( tStringObj * filePath = 0, 00570 XMP_OptionBits * openFlags = 0, 00571 XMP_FileFormat * format = 0, 00572 XMP_OptionBits * handlerFlags = 0 ); 00573 00574 // --------------------------------------------------------------------------------------------- 00584 00585 void SetAbortProc ( XMP_AbortProc abortProc, 00586 void * abortArg ); 00587 00589 00590 // ============================================================================================= 00597 00598 // --------------------------------------------------------------------------------------------- 00625 00626 bool GetXMP ( SXMPMeta * xmpObj = 0, 00627 tStringObj * xmpPacket = 0, 00628 XMP_PacketInfo * packetInfo = 0 ); 00629 00630 // --------------------------------------------------------------------------------------------- 00638 00639 void PutXMP ( const SXMPMeta & xmpObj ); 00640 00641 // --------------------------------------------------------------------------------------------- 00649 00650 void PutXMP ( const tStringObj & xmpPacket ); 00651 00652 // --------------------------------------------------------------------------------------------- 00663 00664 void PutXMP ( XMP_StringPtr xmpPacket, 00665 XMP_StringLen xmpLength = kXMP_UseNullTermination ); 00666 00667 // --------------------------------------------------------------------------------------------- 00701 00702 bool CanPutXMP ( const SXMPMeta & xmpObj ); 00703 00704 // --------------------------------------------------------------------------------------------- 00712 00713 bool CanPutXMP ( const tStringObj & xmpPacket ); 00714 00715 // --------------------------------------------------------------------------------------------- 00726 00727 bool CanPutXMP ( XMP_StringPtr xmpPacket, 00728 XMP_StringLen xmpLength = kXMP_UseNullTermination ); 00729 00731 00732 // ============================================================================================= 00741 00742 // --------------------------------------------------------------------------------------------- 00756 00757 static void SetDefaultProgressCallback ( XMP_ProgressReportProc proc, void * context = 0, 00758 float interval = 1.0, bool sendStartStop = false ); 00759 00760 // --------------------------------------------------------------------------------------------- 00773 00774 void SetProgressCallback ( XMP_ProgressReportProc proc, void * context = 0, 00775 float interval = 1.0, bool sendStartStop = false ); 00776 00778 00779 // ============================================================================================= 00780 // Error notifications 00781 // =================== 00782 00783 // --------------------------------------------------------------------------------------------- 00805 00806 // -------------------------------------------------------------------------------------------- 00814 00815 static void SetDefaultErrorCallback ( XMPFiles_ErrorCallbackProc proc, void* context = 0, XMP_Uns32 limit = 1 ); 00816 00817 // -------------------------------------------------------------------------------------------- 00825 00826 void SetErrorCallback ( XMPFiles_ErrorCallbackProc proc, void* context = 0, XMP_Uns32 limit = 1 ); 00827 00828 // -------------------------------------------------------------------------------------------- 00833 00834 void ResetErrorCallbackLimit ( XMP_Uns32 limit = 1 ); 00835 00837 00838 // ============================================================================================= 00839 00840 private: 00841 00842 XMPFilesRef xmpFilesRef; 00843 00844 // These are used as callbacks from the library code to the client when returning values that 00845 // involve heap allocations. This ensures the allocations occur within the client. 00846 static void SetClientString ( void * clientPtr, XMP_StringPtr valuePtr, XMP_StringLen valueLen ); 00847 static void SetClientStringVector ( void * clientPtr, XMP_StringPtr* arrayPtr, XMP_Uns32 stringCount ); 00848 00849 }; // class TXMPFiles 00850 00851 // ================================================================================================= 00852 00853 #endif // __TXMPFiles_hpp__