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