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 // --------------------------------------------------------------------------------------------- 00379 00380 static bool GetFileModDate ( XMP_StringPtr filePath, XMP_DateTime * modDate, 00381 XMP_FileFormat * format = 0, XMP_OptionBits options = 0 ); 00382 00383 // --------------------------------------------------------------------------------------------- 00436 00437 00438 bool OpenFile ( XMP_StringPtr filePath, 00439 XMP_FileFormat format = kXMP_UnknownFile, 00440 XMP_OptionBits openFlags = 0 ); 00441 00442 // --------------------------------------------------------------------------------------------- 00447 00448 bool OpenFile ( const tStringObj & filePath, 00449 XMP_FileFormat format = kXMP_UnknownFile, 00450 XMP_OptionBits openFlags = 0 ); 00451 00452 #if XMP_StaticBuild // ! Client XMP_IO objects can only be used in static builds. 00453 // --------------------------------------------------------------------------------------------- 00459 00460 bool OpenFile ( XMP_IO * clientIO, 00461 XMP_FileFormat format = kXMP_UnknownFile, 00462 XMP_OptionBits openFlags = 0 ); 00463 #endif 00464 00465 // --------------------------------------------------------------------------------------------- 00486 00487 void CloseFile ( XMP_OptionBits closeFlags = 0 ); 00488 00489 // --------------------------------------------------------------------------------------------- 00506 00507 bool GetFileInfo ( tStringObj * filePath = 0, 00508 XMP_OptionBits * openFlags = 0, 00509 XMP_FileFormat * format = 0, 00510 XMP_OptionBits * handlerFlags = 0 ); 00511 00512 // --------------------------------------------------------------------------------------------- 00522 00523 void SetAbortProc ( XMP_AbortProc abortProc, 00524 void * abortArg ); 00525 00527 00528 // ============================================================================================= 00535 00536 // --------------------------------------------------------------------------------------------- 00563 00564 bool GetXMP ( SXMPMeta * xmpObj = 0, 00565 tStringObj * xmpPacket = 0, 00566 XMP_PacketInfo * packetInfo = 0 ); 00567 00568 // --------------------------------------------------------------------------------------------- 00576 00577 void PutXMP ( const SXMPMeta & xmpObj ); 00578 00579 // --------------------------------------------------------------------------------------------- 00587 00588 void PutXMP ( const tStringObj & xmpPacket ); 00589 00590 // --------------------------------------------------------------------------------------------- 00601 00602 void PutXMP ( XMP_StringPtr xmpPacket, 00603 XMP_StringLen xmpLength = kXMP_UseNullTermination ); 00604 00605 // --------------------------------------------------------------------------------------------- 00639 00640 bool CanPutXMP ( const SXMPMeta & xmpObj ); 00641 00642 // --------------------------------------------------------------------------------------------- 00650 00651 bool CanPutXMP ( const tStringObj & xmpPacket ); 00652 00653 // --------------------------------------------------------------------------------------------- 00664 00665 bool CanPutXMP ( XMP_StringPtr xmpPacket, 00666 XMP_StringLen xmpLength = kXMP_UseNullTermination ); 00667 00669 00670 // ============================================================================================= 00671 00672 private: 00673 00674 XMPFilesRef xmpFilesRef; 00675 00676 static void SetClientString ( void * clientPtr, XMP_StringPtr valuePtr, XMP_StringLen valueLen ); 00677 00678 }; // class TXMPFiles 00679 00680 // ================================================================================================= 00681 00682 #endif // __TXMPFiles_hpp__