1 /*
2 * Interface wrapper code.
3 *
4 * Generated by SIP 4.19.16
5 *
6 * Copyright: (c) 2018 by Total Control Software
7 * License: wxWindows License
8 */
9
10 #include "sipAPI_core.h"
11
12 #include <wx/imagxpm.h>
13
14 #include <wx/stream.h>
15 #include <wx/image.h>
16 #include <wx/stream.h>
17 #include <wx/object.h>
18 #include <wx/object.h>
19 #include <wx/object.h>
20
21
22 class sipwxXPMHandler : public ::wxXPMHandler
23 {
24 public:
25 sipwxXPMHandler();
26 virtual ~sipwxXPMHandler();
27
28 /*
29 * There is a public method for every protected method visible from
30 * this class.
31 */
32 int sipProtectVirt_DoGetImageCount(bool, ::wxInputStream&);
33 bool sipProtectVirt_DoCanRead(bool, ::wxInputStream&);
34
35 /*
36 * There is a protected method for every virtual method visible from
37 * this class.
38 */
39 protected:
40 bool LoadFile( ::wxImage*, ::wxInputStream&,bool,int) SIP_OVERRIDE;
41 bool SaveFile( ::wxImage*, ::wxOutputStream&,bool) SIP_OVERRIDE;
42 int DoGetImageCount( ::wxInputStream&) SIP_OVERRIDE;
43 bool DoCanRead( ::wxInputStream&) SIP_OVERRIDE;
44
45 public:
46 sipSimpleWrapper *sipPySelf;
47
48 private:
49 sipwxXPMHandler(const sipwxXPMHandler &);
50 sipwxXPMHandler &operator = (const sipwxXPMHandler &);
51
52 char sipPyMethods[4];
53 };
54
sipwxXPMHandler()55 sipwxXPMHandler::sipwxXPMHandler(): ::wxXPMHandler(), sipPySelf(SIP_NULLPTR)
56 {
57 memset(sipPyMethods, 0, sizeof (sipPyMethods));
58 }
59
~sipwxXPMHandler()60 sipwxXPMHandler::~sipwxXPMHandler()
61 {
62 sipInstanceDestroyedEx(&sipPySelf);
63 }
64
LoadFile(::wxImage * image,::wxInputStream & stream,bool verbose,int index)65 bool sipwxXPMHandler::LoadFile( ::wxImage*image, ::wxInputStream& stream,bool verbose,int index)
66 {
67 sip_gilstate_t sipGILState;
68 PyObject *sipMeth;
69
70 sipMeth = sipIsPyMethod(&sipGILState,&sipPyMethods[0],sipPySelf,SIP_NULLPTR,sipName_LoadFile);
71
72 if (!sipMeth)
73 return ::wxXPMHandler::LoadFile(image,stream,verbose,index);
74
75 extern bool sipVH__core_21(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, ::wxImage*, ::wxInputStream&,bool,int);
76
77 return sipVH__core_21(sipGILState, 0, sipPySelf, sipMeth, image, stream, verbose, index);
78 }
79
SaveFile(::wxImage * image,::wxOutputStream & stream,bool verbose)80 bool sipwxXPMHandler::SaveFile( ::wxImage*image, ::wxOutputStream& stream,bool verbose)
81 {
82 sip_gilstate_t sipGILState;
83 PyObject *sipMeth;
84
85 sipMeth = sipIsPyMethod(&sipGILState,&sipPyMethods[1],sipPySelf,SIP_NULLPTR,sipName_SaveFile);
86
87 if (!sipMeth)
88 return ::wxXPMHandler::SaveFile(image,stream,verbose);
89
90 extern bool sipVH__core_22(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, ::wxImage*, ::wxOutputStream&,bool);
91
92 return sipVH__core_22(sipGILState, 0, sipPySelf, sipMeth, image, stream, verbose);
93 }
94
DoGetImageCount(::wxInputStream & stream)95 int sipwxXPMHandler::DoGetImageCount( ::wxInputStream& stream)
96 {
97 sip_gilstate_t sipGILState;
98 PyObject *sipMeth;
99
100 sipMeth = sipIsPyMethod(&sipGILState,&sipPyMethods[2],sipPySelf,SIP_NULLPTR,sipName_DoGetImageCount);
101
102 if (!sipMeth)
103 return ::wxXPMHandler::DoGetImageCount(stream);
104
105 extern int sipVH__core_23(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, ::wxInputStream&);
106
107 return sipVH__core_23(sipGILState, 0, sipPySelf, sipMeth, stream);
108 }
109
DoCanRead(::wxInputStream & stream)110 bool sipwxXPMHandler::DoCanRead( ::wxInputStream& stream)
111 {
112 sip_gilstate_t sipGILState;
113 PyObject *sipMeth;
114
115 sipMeth = sipIsPyMethod(&sipGILState,&sipPyMethods[3],sipPySelf,SIP_NULLPTR,sipName_DoCanRead);
116
117 if (!sipMeth)
118 return ::wxXPMHandler::DoCanRead(stream);
119
120 extern bool sipVH__core_24(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, ::wxInputStream&);
121
122 return sipVH__core_24(sipGILState, 0, sipPySelf, sipMeth, stream);
123 }
124
sipProtectVirt_DoGetImageCount(bool sipSelfWasArg,::wxInputStream & stream)125 int sipwxXPMHandler::sipProtectVirt_DoGetImageCount(bool sipSelfWasArg, ::wxInputStream& stream)
126 {
127 return (sipSelfWasArg ? ::wxImageHandler::DoGetImageCount(stream) : DoGetImageCount(stream));
128 }
129
sipProtectVirt_DoCanRead(bool sipSelfWasArg,::wxInputStream & stream)130 bool sipwxXPMHandler::sipProtectVirt_DoCanRead(bool sipSelfWasArg, ::wxInputStream& stream)
131 {
132 return (sipSelfWasArg ? ::wxXPMHandler::DoCanRead(stream) : DoCanRead(stream));
133 }
134
135
136 PyDoc_STRVAR(doc_wxXPMHandler_DoGetImageCount, "DoGetImageCount(stream) -> int\n"
137 "\n"
138 "Called to get the number of images available in a multi-image file\n"
139 "type, if supported.");
140
141 extern "C" {static PyObject *meth_wxXPMHandler_DoGetImageCount(PyObject *, PyObject *, PyObject *);}
meth_wxXPMHandler_DoGetImageCount(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)142 static PyObject *meth_wxXPMHandler_DoGetImageCount(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
143 {
144 PyObject *sipParseErr = SIP_NULLPTR;
145 bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));
146
147 {
148 ::wxInputStream* stream;
149 int streamState = 0;
150 sipwxXPMHandler *sipCpp;
151
152 static const char *sipKwdList[] = {
153 sipName_stream,
154 };
155
156 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1", &sipSelf, sipType_wxXPMHandler, &sipCpp, sipType_wxInputStream, &stream, &streamState))
157 {
158 int sipRes;
159
160 PyErr_Clear();
161
162 Py_BEGIN_ALLOW_THREADS
163 sipRes = sipCpp->sipProtectVirt_DoGetImageCount(sipSelfWasArg,*stream);
164 Py_END_ALLOW_THREADS
165 sipReleaseType(stream,sipType_wxInputStream,streamState);
166
167 if (PyErr_Occurred())
168 return 0;
169
170 return SIPLong_FromLong(sipRes);
171 }
172 }
173
174 /* Raise an exception if the arguments couldn't be parsed. */
175 sipNoMethod(sipParseErr, sipName_XPMHandler, sipName_DoGetImageCount, SIP_NULLPTR);
176
177 return SIP_NULLPTR;
178 }
179
180
181 PyDoc_STRVAR(doc_wxXPMHandler_LoadFile, "LoadFile(image, stream, verbose=True, index=-1) -> bool\n"
182 "\n"
183 "Loads a image from a stream, putting the resulting data into image.");
184
185 extern "C" {static PyObject *meth_wxXPMHandler_LoadFile(PyObject *, PyObject *, PyObject *);}
meth_wxXPMHandler_LoadFile(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)186 static PyObject *meth_wxXPMHandler_LoadFile(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
187 {
188 PyObject *sipParseErr = SIP_NULLPTR;
189 bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));
190
191 {
192 ::wxImage* image;
193 ::wxInputStream* stream;
194 int streamState = 0;
195 bool verbose = 1;
196 int index = -1;
197 ::wxXPMHandler *sipCpp;
198
199 static const char *sipKwdList[] = {
200 sipName_image,
201 sipName_stream,
202 sipName_verbose,
203 sipName_index,
204 };
205
206 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ8J1|bi", &sipSelf, sipType_wxXPMHandler, &sipCpp, sipType_wxImage, &image, sipType_wxInputStream, &stream, &streamState, &verbose, &index))
207 {
208 bool sipRes;
209
210 PyErr_Clear();
211
212 Py_BEGIN_ALLOW_THREADS
213 sipRes = (sipSelfWasArg ? sipCpp-> ::wxXPMHandler::LoadFile(image,*stream,verbose,index) : sipCpp->LoadFile(image,*stream,verbose,index));
214 Py_END_ALLOW_THREADS
215 sipReleaseType(stream,sipType_wxInputStream,streamState);
216
217 if (PyErr_Occurred())
218 return 0;
219
220 return PyBool_FromLong(sipRes);
221 }
222 }
223
224 /* Raise an exception if the arguments couldn't be parsed. */
225 sipNoMethod(sipParseErr, sipName_XPMHandler, sipName_LoadFile, SIP_NULLPTR);
226
227 return SIP_NULLPTR;
228 }
229
230
231 PyDoc_STRVAR(doc_wxXPMHandler_SaveFile, "SaveFile(image, stream, verbose=True) -> bool\n"
232 "\n"
233 "Saves a image in the output stream.");
234
235 extern "C" {static PyObject *meth_wxXPMHandler_SaveFile(PyObject *, PyObject *, PyObject *);}
meth_wxXPMHandler_SaveFile(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)236 static PyObject *meth_wxXPMHandler_SaveFile(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
237 {
238 PyObject *sipParseErr = SIP_NULLPTR;
239 bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));
240
241 {
242 ::wxImage* image;
243 ::wxOutputStream* stream;
244 int streamState = 0;
245 bool verbose = 1;
246 ::wxXPMHandler *sipCpp;
247
248 static const char *sipKwdList[] = {
249 sipName_image,
250 sipName_stream,
251 sipName_verbose,
252 };
253
254 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ8J1|b", &sipSelf, sipType_wxXPMHandler, &sipCpp, sipType_wxImage, &image, sipType_wxOutputStream, &stream, &streamState, &verbose))
255 {
256 bool sipRes;
257
258 PyErr_Clear();
259
260 Py_BEGIN_ALLOW_THREADS
261 sipRes = (sipSelfWasArg ? sipCpp-> ::wxXPMHandler::SaveFile(image,*stream,verbose) : sipCpp->SaveFile(image,*stream,verbose));
262 Py_END_ALLOW_THREADS
263 sipReleaseType(stream,sipType_wxOutputStream,streamState);
264
265 if (PyErr_Occurred())
266 return 0;
267
268 return PyBool_FromLong(sipRes);
269 }
270 }
271
272 /* Raise an exception if the arguments couldn't be parsed. */
273 sipNoMethod(sipParseErr, sipName_XPMHandler, sipName_SaveFile, SIP_NULLPTR);
274
275 return SIP_NULLPTR;
276 }
277
278
279 PyDoc_STRVAR(doc_wxXPMHandler_DoCanRead, "DoCanRead(stream) -> bool\n"
280 "\n"
281 "Called to test if this handler can read an image from the given\n"
282 "stream.");
283
284 extern "C" {static PyObject *meth_wxXPMHandler_DoCanRead(PyObject *, PyObject *, PyObject *);}
meth_wxXPMHandler_DoCanRead(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)285 static PyObject *meth_wxXPMHandler_DoCanRead(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
286 {
287 PyObject *sipParseErr = SIP_NULLPTR;
288 bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));
289
290 {
291 ::wxInputStream* stream;
292 int streamState = 0;
293 sipwxXPMHandler *sipCpp;
294
295 static const char *sipKwdList[] = {
296 sipName_stream,
297 };
298
299 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1", &sipSelf, sipType_wxXPMHandler, &sipCpp, sipType_wxInputStream, &stream, &streamState))
300 {
301 bool sipRes;
302
303 PyErr_Clear();
304
305 Py_BEGIN_ALLOW_THREADS
306 sipRes = sipCpp->sipProtectVirt_DoCanRead(sipSelfWasArg,*stream);
307 Py_END_ALLOW_THREADS
308 sipReleaseType(stream,sipType_wxInputStream,streamState);
309
310 if (PyErr_Occurred())
311 return 0;
312
313 return PyBool_FromLong(sipRes);
314 }
315 }
316
317 /* Raise an exception if the arguments couldn't be parsed. */
318 sipNoMethod(sipParseErr, sipName_XPMHandler, sipName_DoCanRead, SIP_NULLPTR);
319
320 return SIP_NULLPTR;
321 }
322
323
324 /* Cast a pointer to a type somewhere in its inheritance hierarchy. */
325 extern "C" {static void *cast_wxXPMHandler(void *, const sipTypeDef *);}
cast_wxXPMHandler(void * sipCppV,const sipTypeDef * targetType)326 static void *cast_wxXPMHandler(void *sipCppV, const sipTypeDef *targetType)
327 {
328 ::wxXPMHandler *sipCpp = reinterpret_cast< ::wxXPMHandler *>(sipCppV);
329
330 if (targetType == sipType_wxImageHandler)
331 return static_cast< ::wxImageHandler *>(sipCpp);
332
333 if (targetType == sipType_wxObject)
334 return static_cast< ::wxObject *>(sipCpp);
335
336 return sipCppV;
337 }
338
339
340 /* Call the instance's destructor. */
341 extern "C" {static void release_wxXPMHandler(void *, int);}
release_wxXPMHandler(void * sipCppV,int sipState)342 static void release_wxXPMHandler(void *sipCppV, int sipState)
343 {
344 Py_BEGIN_ALLOW_THREADS
345
346 if (sipState & SIP_DERIVED_CLASS)
347 delete reinterpret_cast<sipwxXPMHandler *>(sipCppV);
348 else
349 delete reinterpret_cast< ::wxXPMHandler *>(sipCppV);
350
351 Py_END_ALLOW_THREADS
352 }
353
354
355 extern "C" {static void dealloc_wxXPMHandler(sipSimpleWrapper *);}
dealloc_wxXPMHandler(sipSimpleWrapper * sipSelf)356 static void dealloc_wxXPMHandler(sipSimpleWrapper *sipSelf)
357 {
358 if (sipIsDerivedClass(sipSelf))
359 reinterpret_cast<sipwxXPMHandler *>(sipGetAddress(sipSelf))->sipPySelf = SIP_NULLPTR;
360
361 if (sipIsOwnedByPython(sipSelf))
362 {
363 release_wxXPMHandler(sipGetAddress(sipSelf), sipIsDerivedClass(sipSelf));
364 }
365 }
366
367
368 extern "C" {static void *init_type_wxXPMHandler(sipSimpleWrapper *, PyObject *, PyObject *, PyObject **, PyObject **, PyObject **);}
init_type_wxXPMHandler(sipSimpleWrapper * sipSelf,PyObject * sipArgs,PyObject * sipKwds,PyObject ** sipUnused,PyObject **,PyObject ** sipParseErr)369 static void *init_type_wxXPMHandler(sipSimpleWrapper *sipSelf, PyObject *sipArgs, PyObject *sipKwds, PyObject **sipUnused, PyObject **, PyObject **sipParseErr)
370 {
371 sipwxXPMHandler *sipCpp = SIP_NULLPTR;
372
373 {
374 if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, ""))
375 {
376 PyErr_Clear();
377
378 Py_BEGIN_ALLOW_THREADS
379 sipCpp = new sipwxXPMHandler();
380 Py_END_ALLOW_THREADS
381
382 if (PyErr_Occurred())
383 {
384 delete sipCpp;
385 return SIP_NULLPTR;
386 }
387
388 sipCpp->sipPySelf = sipSelf;
389
390 return sipCpp;
391 }
392 }
393
394 return SIP_NULLPTR;
395 }
396
397
398 /* Define this type's super-types. */
399 static sipEncodedTypeDef supers_wxXPMHandler[] = {{255, 255, 1}};
400
401
402 static PyMethodDef methods_wxXPMHandler[] = {
403 {SIP_MLNAME_CAST(sipName_DoCanRead), SIP_MLMETH_CAST(meth_wxXPMHandler_DoCanRead), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxXPMHandler_DoCanRead)},
404 {SIP_MLNAME_CAST(sipName_DoGetImageCount), SIP_MLMETH_CAST(meth_wxXPMHandler_DoGetImageCount), METH_VARARGS|METH_KEYWORDS, SIP_NULLPTR},
405 {SIP_MLNAME_CAST(sipName_LoadFile), SIP_MLMETH_CAST(meth_wxXPMHandler_LoadFile), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxXPMHandler_LoadFile)},
406 {SIP_MLNAME_CAST(sipName_SaveFile), SIP_MLMETH_CAST(meth_wxXPMHandler_SaveFile), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxXPMHandler_SaveFile)}
407 };
408
409 PyDoc_STRVAR(doc_wxXPMHandler, "XPMHandler()\n"
410 "\n"
411 "This is the image handler for the XPM format.");
412
413
414 sipClassTypeDef sipTypeDef__core_wxXPMHandler = {
415 {
416 -1,
417 SIP_NULLPTR,
418 SIP_NULLPTR,
419 SIP_TYPE_SCC|SIP_TYPE_CLASS,
420 sipNameNr_wxXPMHandler,
421 {SIP_NULLPTR},
422 SIP_NULLPTR
423 },
424 {
425 sipNameNr_XPMHandler,
426 {0, 0, 1},
427 4, methods_wxXPMHandler,
428 0, SIP_NULLPTR,
429 0, SIP_NULLPTR,
430 {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
431 },
432 doc_wxXPMHandler,
433 -1,
434 -1,
435 supers_wxXPMHandler,
436 SIP_NULLPTR,
437 init_type_wxXPMHandler,
438 SIP_NULLPTR,
439 SIP_NULLPTR,
440 #if PY_MAJOR_VERSION >= 3
441 SIP_NULLPTR,
442 SIP_NULLPTR,
443 #else
444 SIP_NULLPTR,
445 SIP_NULLPTR,
446 SIP_NULLPTR,
447 SIP_NULLPTR,
448 #endif
449 dealloc_wxXPMHandler,
450 SIP_NULLPTR,
451 SIP_NULLPTR,
452 SIP_NULLPTR,
453 release_wxXPMHandler,
454 cast_wxXPMHandler,
455 SIP_NULLPTR,
456 SIP_NULLPTR,
457 SIP_NULLPTR,
458 SIP_NULLPTR,
459 SIP_NULLPTR,
460 SIP_NULLPTR
461 };
462