XMP Toolkit SDK  6.0.0
WXMP_Common.hpp
Go to the documentation of this file.
1 #if ! __WXMP_Common_hpp__
2 #define __WXMP_Common_hpp__ 1
3 
4 // =================================================================================================
5 // Copyright 2002 Adobe
6 // All Rights Reserved.
7 //
8 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
9 // of the Adobe license agreement accompanying it. If you have received this file from a source other
10 // than Adobe, then your use, modification, or distribution of it requires the prior written permission
11 // of Adobe.
12 // =================================================================================================
13 
14 #ifndef XMP_Inline
15  #if TXMP_EXPAND_INLINE
16  #define XMP_Inline inline
17  #else
18  #define XMP_Inline /* not inline */
19  #endif
20 #endif
21 
22 #define XMP_CTorDTorIntro(Class) template <class tStringObj> XMP_Inline Class<tStringObj>
23 #define XMP_MethodIntro(Class,ResultType) template <class tStringObj> XMP_Inline ResultType Class<tStringObj>
24 
25 typedef void (* SetClientStringProc) ( void * clientPtr, XMP_StringPtr valuePtr, XMP_StringLen valueLen );
26 typedef void (* SetClientStringVectorProc) ( void * clientPtr, XMP_StringPtr * arrayPtr, XMP_Uns32 stringCount );
27 
28 struct WXMP_Result {
30  void * ptrResult;
31  double floatResult;
32  XMP_Uns64 int64Result;
33  XMP_Uns32 int32Result;
35 };
36 
37 #if __cplusplus
38 extern "C" {
39 #endif
40 
41 #define PropagateException(res) \
42  if ( res.errMessage != 0 ) throw XMP_Error ( res.int32Result, res.errMessage );
43 
44 #ifndef XMP_TraceClientCalls
45  #define XMP_TraceClientCalls 0
46  #define XMP_TraceClientCallsToFile 0
47 #endif
48 
49 #if ! XMP_TraceClientCalls
50  #define InvokeCheck(WCallProto) \
51  WXMP_Result wResult; \
52  WCallProto; \
53  PropagateException ( wResult )
54 #else
55  extern FILE * xmpClientLog;
56  #define InvokeCheck(WCallProto) \
57  WXMP_Result wResult; \
58  fprintf ( xmpClientLog, "WXMP calling: %s\n", #WCallProto ); fflush ( xmpClientLog ); \
59  WCallProto; \
60  if ( wResult.errMessage == 0 ) { \
61  fprintf ( xmpClientLog, "WXMP back, no error\n" ); fflush ( xmpClientLog ); \
62  } else { \
63  fprintf ( xmpClientLog, "WXMP back, error: %s\n", wResult.errMessage ); fflush ( xmpClientLog ); \
64  } \
65  PropagateException ( wResult )
66 #endif
67 
68 // =================================================================================================
69 
70 #define WrapNoCheckVoid(WCallProto) \
71  WCallProto;
72 
73 #define WrapCheckVoid(WCallProto) \
74  InvokeCheck(WCallProto);
75 
76 #define WrapCheckMetaRef(result,WCallProto) \
77  InvokeCheck(WCallProto); \
78  XMPMetaRef result = XMPMetaRef(wResult.ptrResult)
79 
80 #define WrapCheckIterRef(result,WCallProto) \
81  InvokeCheck(WCallProto); \
82  XMPIteratorRef result = XMPIteratorRef(wResult.ptrResult)
83 
84 #define WrapCheckDocOpsRef(result,WCallProto) \
85  InvokeCheck(WCallProto); \
86  XMPDocOpsRef result = XMPDocOpsRef(wResult.ptrResult)
87 
88 #define WrapCheckNewMetadata(result,WCallProto) \
89  InvokeCheck(WCallProto); \
90  void * result = wResult.ptrResult
91 
92 #define WrapCheckBool(result,WCallProto) \
93  InvokeCheck(WCallProto); \
94  bool result = bool(wResult.int32Result)
95 
96 #define WrapCheckTriState(result,WCallProto) \
97  InvokeCheck(WCallProto); \
98  XMP_TriState result = XMP_TriState(wResult.int32Result)
99 
100 #define WrapCheckOptions(result,WCallProto) \
101  InvokeCheck(WCallProto); \
102  XMP_OptionBits result = XMP_OptionBits(wResult.int32Result)
103 
104 #define WrapCheckStatus(result,WCallProto) \
105  InvokeCheck(WCallProto); \
106  XMP_Status result = XMP_Status(wResult.int32Result)
107 
108 #define WrapCheckIndex(result,WCallProto) \
109  InvokeCheck(WCallProto); \
110  XMP_Index result = XMP_Index(wResult.int32Result)
111 
112 #define WrapCheckInt32(result,WCallProto) \
113  InvokeCheck(WCallProto); \
114  XMP_Int32 result = wResult.int32Result
115 
116 #define WrapCheckInt64(result,WCallProto) \
117  InvokeCheck(WCallProto); \
118  XMP_Int64 result = wResult.int64Result
119 
120 #define WrapCheckFloat(result,WCallProto) \
121  InvokeCheck(WCallProto); \
122  double result = wResult.floatResult
123 
124 #define WrapCheckFormat(result,WCallProto) \
125  InvokeCheck(WCallProto); \
126  XMP_FileFormat result = wResult.int32Result
127 
128 // =================================================================================================
129 
130 #if __cplusplus
131 } // extern "C"
132 #endif
133 
134 #endif // __WXMP_Common_hpp__
SetClientStringProc
void(* SetClientStringProc)(void *clientPtr, XMP_StringPtr valuePtr, XMP_StringLen valueLen)
Definition: WXMP_Common.hpp:25
WXMP_Result::WXMP_Result
WXMP_Result()
Definition: WXMP_Common.hpp:34
WXMP_Result::ptrResult
void * ptrResult
Definition: WXMP_Common.hpp:30
WXMP_Result::floatResult
double floatResult
Definition: WXMP_Common.hpp:31
WXMP_Result::errMessage
XMP_StringPtr errMessage
Definition: WXMP_Common.hpp:29
WXMP_Result::int32Result
XMP_Uns32 int32Result
Definition: WXMP_Common.hpp:33
SetClientStringVectorProc
void(* SetClientStringVectorProc)(void *clientPtr, XMP_StringPtr *arrayPtr, XMP_Uns32 stringCount)
Definition: WXMP_Common.hpp:26
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
WXMP_Result
Definition: WXMP_Common.hpp:28
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
WXMP_Result::int64Result
XMP_Uns64 int64Result
Definition: WXMP_Common.hpp:32