1 // =================================================================================================
2 // Copyright 2002-2007 Adobe Systems Incorporated
3 // All Rights Reserved.
4 //
5 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
6 // of the Adobe license agreement accompanying it.
7 // =================================================================================================
8
9 #include "XMP_Environment.h" // ! This must be the first include!
10 #include "XMPCore_Impl.hpp"
11
12 #include "XMPIterator.hpp"
13 #include "client-glue/WXMPIterator.hpp"
14
15 #if XMP_WinBuild
16 #pragma warning ( disable : 4101 ) // unreferenced local variable
17 #pragma warning ( disable : 4189 ) // local variable is initialized but not referenced
18 #pragma warning ( disable : 4800 ) // forcing value to bool 'true' or 'false' (performance warning)
19 #if XMP_DebugBuild
20 #pragma warning ( disable : 4297 ) // function assumed not to throw an exception but does
21 #endif
22 #endif
23
24 #if __cplusplus
25 extern "C" {
26 #endif
27
28 // =================================================================================================
29 // CTor/DTor Wrappers
30 // ==================
31
32 void
WXMPIterator_PropCTor_1(XMPMetaRef xmpRef,XMP_StringPtr schemaNS,XMP_StringPtr propName,XMP_OptionBits options,WXMP_Result * wResult)33 WXMPIterator_PropCTor_1 ( XMPMetaRef xmpRef,
34 XMP_StringPtr schemaNS,
35 XMP_StringPtr propName,
36 XMP_OptionBits options,
37 WXMP_Result * wResult )
38 {
39 XMP_ENTER_WRAPPER ( "WXMPIterator_PropCTor_1" )
40
41 if ( schemaNS == 0 ) schemaNS = "";
42 if ( propName == 0 ) propName = "";
43
44 const XMPMeta & xmpObj = WtoXMPMeta_Ref ( xmpRef );
45 XMPIterator * iter = new XMPIterator ( xmpObj, schemaNS, propName, options );
46 ++iter->clientRefs;
47 XMP_Assert ( iter->clientRefs == 1 );
48 wResult->ptrResult = XMPIteratorRef ( iter );
49
50 XMP_EXIT_WRAPPER
51 }
52
53 // -------------------------------------------------------------------------------------------------
54
55 void
WXMPIterator_TableCTor_1(XMP_StringPtr schemaNS,XMP_StringPtr propName,XMP_OptionBits options,WXMP_Result * wResult)56 WXMPIterator_TableCTor_1 ( XMP_StringPtr schemaNS,
57 XMP_StringPtr propName,
58 XMP_OptionBits options,
59 WXMP_Result * wResult )
60 {
61 XMP_ENTER_WRAPPER ( "WXMPIterator_TableCTor_1" )
62
63 if ( schemaNS == 0 ) schemaNS = "";
64 if ( propName == 0 ) propName = "";
65
66 XMPIterator * iter = new XMPIterator ( schemaNS, propName, options );
67 ++iter->clientRefs;
68 XMP_Assert ( iter->clientRefs == 1 );
69 wResult->ptrResult = XMPIteratorRef ( iter );
70
71 XMP_EXIT_WRAPPER
72 }
73
74 // -------------------------------------------------------------------------------------------------
75
76 void
WXMPIterator_IncrementRefCount_1(XMPIteratorRef iterRef)77 WXMPIterator_IncrementRefCount_1 ( XMPIteratorRef iterRef )
78 {
79 WXMP_Result * wResult = &void_wResult; // ! Needed to "fool" the EnterWrapper macro.
80 XMP_ENTER_WRAPPER ( "WXMPIterator_IncrementRefCount_1" )
81
82 XMPIterator * thiz = (XMPIterator*)iterRef;
83
84 ++thiz->clientRefs;
85 XMP_Assert ( thiz->clientRefs > 1 );
86
87 XMP_EXIT_WRAPPER_NO_THROW
88 }
89
90 // -------------------------------------------------------------------------------------------------
91
92 void
WXMPIterator_DecrementRefCount_1(XMPIteratorRef iterRef)93 WXMPIterator_DecrementRefCount_1 ( XMPIteratorRef iterRef )
94 {
95 WXMP_Result * wResult = &void_wResult; // ! Needed to "fool" the EnterWrapper macro.
96 XMP_ENTER_WRAPPER ( "WXMPIterator_DecrementRefCount_1" )
97
98 XMPIterator * thiz = (XMPIterator*)iterRef;
99
100 XMP_Assert ( thiz->clientRefs > 0 );
101 --thiz->clientRefs;
102 if ( thiz->clientRefs <= 0 ) delete ( thiz );
103
104 XMP_EXIT_WRAPPER_NO_THROW
105 }
106
107 // -------------------------------------------------------------------------------------------------
108
109 void
WXMPIterator_Unlock_1(XMP_OptionBits options)110 WXMPIterator_Unlock_1 ( XMP_OptionBits options )
111 {
112 WXMP_Result * wResult = &void_wResult; // ! Needed to "fool" the EnterWrapper macro.
113 XMP_ENTER_WRAPPER_NO_LOCK ( "WXMPIterator_Unlock_1" )
114
115 XMPIterator::Unlock ( options );
116
117 XMP_EXIT_WRAPPER_NO_THROW
118 }
119
120 // =================================================================================================
121 // Class Method Wrappers
122 // =====================
123
124 void
WXMPIterator_Next_1(XMPIteratorRef iterRef,XMP_StringPtr * schemaNS,XMP_StringLen * nsSize,XMP_StringPtr * propPath,XMP_StringLen * pathSize,XMP_StringPtr * propValue,XMP_StringLen * valueSize,XMP_OptionBits * propOptions,WXMP_Result * wResult)125 WXMPIterator_Next_1 ( XMPIteratorRef iterRef,
126 XMP_StringPtr * schemaNS,
127 XMP_StringLen * nsSize,
128 XMP_StringPtr * propPath,
129 XMP_StringLen * pathSize,
130 XMP_StringPtr * propValue,
131 XMP_StringLen * valueSize,
132 XMP_OptionBits * propOptions,
133 WXMP_Result * wResult )
134 {
135 XMP_ENTER_WRAPPER ( "WXMPIterator_Next_1" )
136
137 if ( schemaNS == 0 ) schemaNS = &voidStringPtr;
138 if ( nsSize == 0 ) nsSize = &voidStringLen;
139 if ( propPath == 0 ) propPath = &voidStringPtr;
140 if ( pathSize == 0 ) pathSize = &voidStringLen;
141 if ( propValue == 0 ) propValue = &voidStringPtr;
142 if ( valueSize == 0 ) valueSize = &voidStringLen;
143 if ( propOptions == 0 ) propOptions = &voidOptionBits;
144
145 XMPIterator * iter = WtoXMPIterator_Ptr ( iterRef );
146 XMP_Bool found = iter->Next ( schemaNS, nsSize, propPath, pathSize, propValue, valueSize, propOptions );
147 wResult->int32Result = found;
148
149 XMP_EXIT_WRAPPER_KEEP_LOCK ( found )
150 }
151
152 // -------------------------------------------------------------------------------------------------
153
154 void
WXMPIterator_Skip_1(XMPIteratorRef iterRef,XMP_OptionBits options,WXMP_Result * wResult)155 WXMPIterator_Skip_1 ( XMPIteratorRef iterRef,
156 XMP_OptionBits options,
157 WXMP_Result * wResult )
158 {
159 XMP_ENTER_WRAPPER ( "WXMPIterator_Skip_1" )
160
161 XMPIterator * iter = WtoXMPIterator_Ptr ( iterRef );
162 iter->Skip ( options );
163
164 XMP_EXIT_WRAPPER
165 }
166
167 // -------------------------------------------------------------------------------------------------
168
169 void
WXMPUtils_UnlockIter_1(XMPIteratorRef iterRef,XMP_OptionBits options)170 WXMPUtils_UnlockIter_1 ( XMPIteratorRef iterRef,
171 XMP_OptionBits options )
172 {
173 WXMP_Result * wResult = &void_wResult; // ! Needed to "fool" the EnterWrapper macro.
174 XMP_ENTER_WRAPPER_NO_LOCK ( "WXMPUtils_UnlockIter_1" )
175
176 XMPIterator * iter = WtoXMPIterator_Ptr ( iterRef );
177 iter->UnlockIter ( options );
178
179 XMP_EXIT_WRAPPER_NO_THROW
180 }
181
182 // =================================================================================================
183
184 #if __cplusplus
185 } /* extern "C" */
186 #endif
187