XMP Toolkit SDK  6.0.0
WXMPFiles.hpp
Go to the documentation of this file.
1 #ifndef __WXMPFiles_hpp__
2 #define __WXMPFiles_hpp__ 1
3 
4 // =================================================================================================
5 // Copyright Adobe
6 // Copyright 2002 Adobe
7 // All Rights Reserved
8 //
9 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
10 // of the Adobe license agreement accompanying it. If you have received this file from a source other
11 // than Adobe, then your use, modification, or distribution of it requires the prior written permission
12 // of Adobe.
13 // =================================================================================================
14 
16 
17 #if XMP_StaticBuild // ! Client XMP_IO objects can only be used in static builds.
18  #include "XMP_IO.hpp"
19 #endif
20 
21 #if __cplusplus
22 extern "C" {
23 #endif
24 
25 // =================================================================================================
31 // =================================================================================================
32 
33 // =================================================================================================
34 
35 #define WrapCheckXMPFilesRef(result,WCallProto) \
36  WXMP_Result wResult; \
37  WCallProto; \
38  PropagateException ( wResult ); \
39  XMPFilesRef result = XMPFilesRef(wResult.ptrResult)
40 
41 static XMP_Bool WrapProgressReport ( XMP_ProgressReportProc proc, void * context,
42  float elapsedTime, float fractionDone, float secondsToGo )
43 {
44  bool ok;
45  try {
46  ok = (*proc) ( context, elapsedTime, fractionDone, secondsToGo );
47  } catch ( ... ) {
48  ok = false;
49  }
50  return ConvertBoolToXMP_Bool( ok );
51 }
52 
53 // =================================================================================================
54 
56  XMP_StringPtr filePath, XMP_ErrorSeverity severity, XMP_Int32 cause, XMP_StringPtr message )
57 {
58  bool ok;
59  try {
60  ok = (*proc) ( context, filePath, severity, cause, message );
61  } catch ( ... ) {
62  ok = false;
63  }
64  return ConvertBoolToXMP_Bool( ok );
65 }
66 
67 // =================================================================================================
68 
69 #define zXMPFiles_GetVersionInfo_1(versionInfo) \
70  WXMPFiles_GetVersionInfo_1 ( versionInfo /* no wResult */ )
71 
72 #define zXMPFiles_Initialize_1(options) \
73  WXMPFiles_Initialize_1 ( options, &wResult )
74 
75 #define zXMPFiles_Initialize_2(options,pluginFolder,plugins) \
76  WXMPFiles_Initialize_2 ( options, pluginFolder, plugins, &wResult )
77 
78 #define zXMPFiles_Terminate_1() \
79  WXMPFiles_Terminate_1 ( /* no wResult */ )
80 
81 #define zXMPFiles_CTor_1() \
82  WXMPFiles_CTor_1 ( &wResult )
83 
84 #define zXMPFiles_GetFormatInfo_1(format,flags) \
85  WXMPFiles_GetFormatInfo_1 ( format, flags, &wResult )
86 
87 #define zXMPFiles_CheckFileFormat_1(filePath) \
88  WXMPFiles_CheckFileFormat_1 ( filePath, &wResult )
89 
90 #define zXMPFiles_CheckPackageFormat_1(folderPath) \
91  WXMPFiles_CheckPackageFormat_1 ( folderPath, &wResult )
92 
93 #define zXMPFiles_GetFileModDate_1(filePath,modDate,format,options) \
94  WXMPFiles_GetFileModDate_1 ( filePath, modDate, format, options, &wResult )
95 
96 #define zXMPFiles_GetAssociatedResources_1( filePath, resourceList, format, options, SetClientStringVector ) \
97  WXMPFiles_GetAssociatedResources_1 ( filePath, resourceList, format, options, SetClientStringVector, &wResult )
98 
99 #define zXMPFiles_IsMetadataWritable_1( filePath, writable, format, options ) \
100  WXMPFiles_IsMetadataWritable_1 ( filePath, writable, format, options, &wResult )
101 
102 #define zXMPFiles_OpenFile_1(filePath,format,openFlags) \
103  WXMPFiles_OpenFile_1 ( this->xmpFilesRef, filePath, format, openFlags, &wResult )
104 
105 #if XMP_StaticBuild // ! Client XMP_IO objects can only be used in static builds.
106 #define zXMPFiles_OpenFile_2(clientIO,format,openFlags) \
107  WXMPFiles_OpenFile_2 ( this->xmpFilesRef, clientIO, format, openFlags, &wResult )
108 #endif
109 
110 #define zXMPFiles_CloseFile_1(closeFlags) \
111  WXMPFiles_CloseFile_1 ( this->xmpFilesRef, closeFlags, &wResult )
112 
113 #define zXMPFiles_GetFileInfo_1(clientPath,openFlags,format,handlerFlags,SetClientString) \
114  WXMPFiles_GetFileInfo_1 ( this->xmpFilesRef, clientPath, openFlags, format, handlerFlags, SetClientString, &wResult )
115 
116 #define zXMPFiles_SetAbortProc_1(abortProc,abortArg) \
117  WXMPFiles_SetAbortProc_1 ( this->xmpFilesRef, abortProc, abortArg, &wResult )
118 
119 #define zXMPFiles_GetXMP_1(xmpRef,clientPacket,packetInfo,SetClientString) \
120  WXMPFiles_GetXMP_1 ( this->xmpFilesRef, xmpRef, clientPacket, packetInfo, SetClientString, &wResult )
121 
122 #define zXMPFiles_PutXMP_1(xmpRef,xmpPacket,xmpPacketLen) \
123  WXMPFiles_PutXMP_1 ( this->xmpFilesRef, xmpRef, xmpPacket, xmpPacketLen, &wResult )
124 
125 #define zXMPFiles_CanPutXMP_1(xmpRef,xmpPacket,xmpPacketLen) \
126  WXMPFiles_CanPutXMP_1 ( this->xmpFilesRef, xmpRef, xmpPacket, xmpPacketLen, &wResult )
127 
128 #define zXMPFiles_SetDefaultProgressCallback_1(proc,context,interval,sendStartStop) \
129  WXMPFiles_SetDefaultProgressCallback_1 ( WrapProgressReport, proc, context, interval, sendStartStop, &wResult )
130 
131 #define zXMPFiles_SetProgressCallback_1(proc,context,interval,sendStartStop) \
132  WXMPFiles_SetProgressCallback_1 ( this->xmpFilesRef, WrapProgressReport, proc, context, interval, sendStartStop, &wResult )
133 
134 #define zXMPFiles_SetDefaultErrorCallback_1(proc,context,limit) \
135  WXMPFiles_SetDefaultErrorCallback_1 ( WrapFilesErrorNotify, proc, context, limit, &wResult )
136 
137 #define zXMPFiles_SetErrorCallback_1(proc,context,limit) \
138  WXMPFiles_SetErrorCallback_1 ( this->xmpFilesRef, WrapFilesErrorNotify, proc, context, limit, &wResult )
139 
140 #define zXMPFiles_ResetErrorCallbackLimit_1(limit) \
141  WXMPFiles_ResetErrorCallbackLimit_1 ( this->xmpFilesRef, limit, &wResult )
142 
143 // =================================================================================================
144 
145 extern void WXMPFiles_GetVersionInfo_1 ( XMP_VersionInfo * versionInfo );
146 
147 extern void WXMPFiles_Initialize_1 ( XMP_OptionBits options,
148  WXMP_Result * result );
149 
150 extern void WXMPFiles_Initialize_2 ( XMP_OptionBits options,
151  const char* pluginFolder,
152  const char* plugins,
153  WXMP_Result * result );
154 
155 extern void WXMPFiles_Terminate_1();
156 
157 extern void WXMPFiles_CTor_1 ( WXMP_Result * result );
158 
159 extern void WXMPFiles_IncrementRefCount_1 ( XMPFilesRef xmpFilesRef );
160 
161 extern void WXMPFiles_DecrementRefCount_1 ( XMPFilesRef xmpFilesRef );
162 
163 extern void WXMPFiles_GetFormatInfo_1 ( XMP_FileFormat format,
164  XMP_OptionBits * flags, // ! Can be null.
165  WXMP_Result * result );
166 
167 extern void WXMPFiles_CheckFileFormat_1 ( XMP_StringPtr filePath,
168  WXMP_Result * result );
169 
170 extern void WXMPFiles_CheckPackageFormat_1 ( XMP_StringPtr folderPath,
171  WXMP_Result * result );
172 
173 extern void WXMPFiles_GetFileModDate_1 ( XMP_StringPtr filePath,
174  XMP_DateTime * modDate,
175  XMP_FileFormat * format, // ! Can be null.
176  XMP_OptionBits options,
177  WXMP_Result * result );
178 
179 
181  void * resourceList,
182  XMP_FileFormat format,
183  XMP_OptionBits options,
184  SetClientStringVectorProc SetClientStringVector,
185  WXMP_Result * result );
186 
187 extern void WXMPFiles_IsMetadataWritable_1 ( XMP_StringPtr filePath,
188  XMP_Bool * writable,
189  XMP_FileFormat format,
190  XMP_OptionBits options,
191  WXMP_Result * result );
192 
193 extern void WXMPFiles_OpenFile_1 ( XMPFilesRef xmpFilesRef,
194  XMP_StringPtr filePath,
195  XMP_FileFormat format,
196  XMP_OptionBits openFlags,
197  WXMP_Result * result );
198 
199 #if XMP_StaticBuild // ! Client XMP_IO objects can only be used in static builds.
200 extern void WXMPFiles_OpenFile_2 ( XMPFilesRef xmpFilesRef,
201  XMP_IO * clientIO,
202  XMP_FileFormat format,
203  XMP_OptionBits openFlags,
204  WXMP_Result * result );
205 #endif
206 
207 extern void WXMPFiles_CloseFile_1 ( XMPFilesRef xmpFilesRef,
208  XMP_OptionBits closeFlags,
209  WXMP_Result * result );
210 
211 extern void WXMPFiles_GetFileInfo_1 ( XMPFilesRef xmpFilesRef,
212  void * clientPath,
213  XMP_OptionBits * openFlags, // ! Can be null.
214  XMP_FileFormat * format, // ! Can be null.
215  XMP_OptionBits * handlerFlags, // ! Can be null.
216  SetClientStringProc SetClientString,
217  WXMP_Result * result );
218 
219 extern void WXMPFiles_SetAbortProc_1 ( XMPFilesRef xmpFilesRef,
220  XMP_AbortProc abortProc,
221  void * abortArg,
222  WXMP_Result * result );
223 
224 extern void WXMPFiles_GetXMP_1 ( XMPFilesRef xmpFilesRef,
225  XMPMetaRef xmpRef, // ! Can be null.
226  void * clientPacket,
227  XMP_PacketInfo * packetInfo, // ! Can be null.
228  SetClientStringProc SetClientString,
229  WXMP_Result * result );
230 
231 extern void WXMPFiles_PutXMP_1 ( XMPFilesRef xmpFilesRef,
232  XMPMetaRef xmpRef, // ! Only one of the XMP object or packet are passed.
233  XMP_StringPtr xmpPacket,
234  XMP_StringLen xmpPacketLen,
235  WXMP_Result * result );
236 
237 extern void WXMPFiles_CanPutXMP_1 ( XMPFilesRef xmpFilesRef,
238  XMPMetaRef xmpRef, // ! Only one of the XMP object or packet are passed.
239  XMP_StringPtr xmpPacket,
240  XMP_StringLen xmpPacketLen,
241  WXMP_Result * result );
242 
244  XMP_ProgressReportProc clientProc,
245  void * context,
246  float interval,
247  XMP_Bool sendStartStop,
248  WXMP_Result * result );
249 
250 extern void WXMPFiles_SetProgressCallback_1 ( XMPFilesRef xmpFilesRef,
251  XMP_ProgressReportWrapper wrapperproc,
252  XMP_ProgressReportProc clientProc,
253  void * context,
254  float interval,
255  XMP_Bool sendStartStop,
256  WXMP_Result * result );
257 
258 // -------------------------------------------------------------------------------------------------
259 
261  XMPFiles_ErrorCallbackProc clientProc,
262  void * context,
263  XMP_Uns32 limit,
264  WXMP_Result * wResult );
265 
266 extern void WXMPFiles_SetErrorCallback_1 ( XMPFilesRef xmpRef,
267  XMPFiles_ErrorCallbackWrapper wrapperProc,
268  XMPFiles_ErrorCallbackProc clientProc,
269  void * context,
270  XMP_Uns32 limit,
271  WXMP_Result * wResult );
272 
274  XMP_Uns32 limit,
275  WXMP_Result * wResult );
276 
277 // =================================================================================================
278 
279 #if __cplusplus
280 }
281 #endif
282 
283 #endif // __WXMPFiles_hpp__
WXMPFiles_GetFormatInfo_1
void WXMPFiles_GetFormatInfo_1(XMP_FileFormat format, XMP_OptionBits *flags, WXMP_Result *result)
WXMPFiles_CloseFile_1
void WXMPFiles_CloseFile_1(XMPFilesRef xmpFilesRef, XMP_OptionBits closeFlags, WXMP_Result *result)
SetClientStringProc
void(* SetClientStringProc)(void *clientPtr, XMP_StringPtr valuePtr, XMP_StringLen valueLen)
Definition: WXMP_Common.hpp:25
WXMPFiles_OpenFile_1
void WXMPFiles_OpenFile_1(XMPFilesRef xmpFilesRef, XMP_StringPtr filePath, XMP_FileFormat format, XMP_OptionBits openFlags, WXMP_Result *result)
XMP_VersionInfo
XMP Toolkit version information.
Definition: XMP_Const.h:1565
XMPFiles_ErrorCallbackProc
bool(* XMPFiles_ErrorCallbackProc)(void *context, XMP_StringPtr filePath, XMP_ErrorSeverity severity, XMP_Int32 cause, XMP_StringPtr message)
The signature of a client-defined callback for TXMPFiles error notifications.
Definition: XMP_Const.h:1317
WXMPFiles_GetAssociatedResources_1
void WXMPFiles_GetAssociatedResources_1(XMP_StringPtr filePath, void *resourceList, XMP_FileFormat format, XMP_OptionBits options, SetClientStringVectorProc SetClientStringVector, WXMP_Result *result)
WXMPFiles_SetDefaultErrorCallback_1
void WXMPFiles_SetDefaultErrorCallback_1(XMPFiles_ErrorCallbackWrapper wrapperProc, XMPFiles_ErrorCallbackProc clientProc, void *context, XMP_Uns32 limit, WXMP_Result *wResult)
XMP_AbortProc
bool(* XMP_AbortProc)(void *arg)
The signature of a client-defined callback to check for a user request to abort a time-consuming oper...
Definition: XMP_Const.h:1527
ConvertBoolToXMP_Bool
#define ConvertBoolToXMP_Bool(a)
Definition: XMP_Const.h:116
WXMPFiles_SetProgressCallback_1
void WXMPFiles_SetProgressCallback_1(XMPFilesRef xmpFilesRef, XMP_ProgressReportWrapper wrapperproc, XMP_ProgressReportProc clientProc, void *context, float interval, XMP_Bool sendStartStop, WXMP_Result *result)
WXMPFiles_ResetErrorCallbackLimit_1
void WXMPFiles_ResetErrorCallbackLimit_1(XMPFilesRef xmpRef, XMP_Uns32 limit, WXMP_Result *wResult)
XMPFilesRef
struct __XMPFiles__ * XMPFilesRef
An "ABI safe" pointer to the internal part of an XMP file-handling object. Use to pass an XMP file-ha...
Definition: XMP_Const.h:151
XMP_PacketInfo
XMP packet description.
Definition: XMP_Const.h:1081
WXMPFiles_GetFileModDate_1
void WXMPFiles_GetFileModDate_1(XMP_StringPtr filePath, XMP_DateTime *modDate, XMP_FileFormat *format, XMP_OptionBits options, WXMP_Result *result)
WrapFilesErrorNotify
static XMP_Bool WrapFilesErrorNotify(XMPFiles_ErrorCallbackProc proc, void *context, XMP_StringPtr filePath, XMP_ErrorSeverity severity, XMP_Int32 cause, XMP_StringPtr message)
Definition: WXMPFiles.hpp:55
WXMPFiles_CTor_1
void WXMPFiles_CTor_1(WXMP_Result *result)
WXMPFiles_SetAbortProc_1
void WXMPFiles_SetAbortProc_1(XMPFilesRef xmpFilesRef, XMP_AbortProc abortProc, void *abortArg, WXMP_Result *result)
WXMPFiles_CanPutXMP_1
void WXMPFiles_CanPutXMP_1(XMPFilesRef xmpFilesRef, XMPMetaRef xmpRef, XMP_StringPtr xmpPacket, XMP_StringLen xmpPacketLen, WXMP_Result *result)
XMP_IO.hpp
WXMPFiles_IncrementRefCount_1
void WXMPFiles_IncrementRefCount_1(XMPFilesRef xmpFilesRef)
XMPFiles_ErrorCallbackWrapper
XMP_Bool(* XMPFiles_ErrorCallbackWrapper)(XMPFiles_ErrorCallbackProc clientProc, void *context, XMP_StringPtr filePath, XMP_ErrorSeverity severity, XMP_Int32 cause, XMP_StringPtr message)
Definition: XMP_Const.h:1325
WrapProgressReport
static XMP_Bool WrapProgressReport(XMP_ProgressReportProc proc, void *context, float elapsedTime, float fractionDone, float secondsToGo)
Definition: WXMPFiles.hpp:41
WXMPFiles_CheckFileFormat_1
void WXMPFiles_CheckFileFormat_1(XMP_StringPtr filePath, WXMP_Result *result)
XMP_IO
Abstract base class for client-managed I/O with TXMPFiles.
Definition: XMP_IO.hpp:44
WXMPFiles_GetFileInfo_1
void WXMPFiles_GetFileInfo_1(XMPFilesRef xmpFilesRef, void *clientPath, XMP_OptionBits *openFlags, XMP_FileFormat *format, XMP_OptionBits *handlerFlags, SetClientStringProc SetClientString, WXMP_Result *result)
SetClientStringVectorProc
void(* SetClientStringVectorProc)(void *clientPtr, XMP_StringPtr *arrayPtr, XMP_Uns32 stringCount)
Definition: WXMP_Common.hpp:26
WXMPFiles_SetDefaultProgressCallback_1
void WXMPFiles_SetDefaultProgressCallback_1(XMP_ProgressReportWrapper wrapperproc, XMP_ProgressReportProc clientProc, void *context, float interval, XMP_Bool sendStartStop, WXMP_Result *result)
XMP_StringPtr
const typedef char * XMP_StringPtr
The type for input string parameters. A const char *, a null-terminated UTF-8 string.
Definition: XMP_Const.h:178
WXMPFiles_DecrementRefCount_1
void WXMPFiles_DecrementRefCount_1(XMPFilesRef xmpFilesRef)
WXMP_Result
Definition: WXMP_Common.hpp:28
WXMPFiles_Initialize_1
void WXMPFiles_Initialize_1(XMP_OptionBits options, WXMP_Result *result)
XMPMetaRef
struct __XMPMeta__ * XMPMetaRef
An "ABI safe" pointer to the internal part of an XMP object. Use to pass an XMP object across client ...
Definition: XMP_Const.h:139
XMP_ProgressReportProc
bool(* XMP_ProgressReportProc)(void *context, float elapsedTime, float fractionDone, float secondsToGo)
The signature of a client-defined callback for progress report notifications.
Definition: XMP_Const.h:1550
XMP_StringLen
XMP_Uns32 XMP_StringLen
The type for string length parameters. A 32-bit unsigned integer, as big as will be practically neede...
Definition: XMP_Const.h:179
XMP_ErrorSeverity
XMP_Uns8 XMP_ErrorSeverity
Definition: XMP_Const.h:1242
WXMPFiles_GetXMP_1
void WXMPFiles_GetXMP_1(XMPFilesRef xmpFilesRef, XMPMetaRef xmpRef, void *clientPacket, XMP_PacketInfo *packetInfo, SetClientStringProc SetClientString, WXMP_Result *result)
WXMPFiles_PutXMP_1
void WXMPFiles_PutXMP_1(XMPFilesRef xmpFilesRef, XMPMetaRef xmpRef, XMP_StringPtr xmpPacket, XMP_StringLen xmpPacketLen, WXMP_Result *result)
WXMPFiles_Terminate_1
void WXMPFiles_Terminate_1()
XMP_Bool
XMP_Uns8 XMP_Bool
Definition: XMP_Const.h:111
WXMPFiles_CheckPackageFormat_1
void WXMPFiles_CheckPackageFormat_1(XMP_StringPtr folderPath, WXMP_Result *result)
XMP_ProgressReportWrapper
XMP_Bool(* XMP_ProgressReportWrapper)(XMP_ProgressReportProc proc, void *context, float elapsedTime, float fractionDone, float secondsToGo)
Internal: The signature of a client-side wrapper for the progress report callback.
Definition: XMP_Const.h:1555
WXMPFiles_SetErrorCallback_1
void WXMPFiles_SetErrorCallback_1(XMPFilesRef xmpRef, XMPFiles_ErrorCallbackWrapper wrapperProc, XMPFiles_ErrorCallbackProc clientProc, void *context, XMP_Uns32 limit, WXMP_Result *wResult)
WXMPFiles_IsMetadataWritable_1
void WXMPFiles_IsMetadataWritable_1(XMP_StringPtr filePath, XMP_Bool *writable, XMP_FileFormat format, XMP_OptionBits options, WXMP_Result *result)
WXMP_Common.hpp
WXMPFiles_Initialize_2
void WXMPFiles_Initialize_2(XMP_OptionBits options, const char *pluginFolder, const char *plugins, WXMP_Result *result)
XMP_OptionBits
XMP_Uns32 XMP_OptionBits
The type for a collection of 32 flag bits.
Definition: XMP_Const.h:181
XMP_DateTime
The expanded type for a date and time.
Definition: XMP_Const.h:232
WXMPFiles_GetVersionInfo_1
void WXMPFiles_GetVersionInfo_1(XMP_VersionInfo *versionInfo)
XMP_FileFormat
XMP_Uns32 XMP_FileFormat
Type for file format identification constants. See kXMP_PDFFile and following.
Definition: XMP_Const.h:1004