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/log.h>
13 
14         #include <wx/log.h>
15         #include <wx/log.h>
16         #include <wx/log.h>
17 
18 
19 class sipwxLogStderr : public  ::wxLogStderr
20 {
21 public:
22     sipwxLogStderr();
23     virtual ~sipwxLogStderr();
24 
25     /*
26      * There is a public method for every protected method visible from
27      * this class.
28      */
29     void sipProtectVirt_DoLogRecord(bool, ::wxLogLevel,const  ::wxString&,const  ::wxLogRecordInfo&);
30     void sipProtectVirt_DoLogTextAtLevel(bool, ::wxLogLevel,const  ::wxString&);
31     void sipProtectVirt_DoLogText(bool,const  ::wxString&);
32 
33     /*
34      * There is a protected method for every virtual method visible from
35      * this class.
36      */
37 protected:
38     void Flush() SIP_OVERRIDE;
39     void DoLogRecord( ::wxLogLevel,const  ::wxString&,const  ::wxLogRecordInfo&) SIP_OVERRIDE;
40     void DoLogTextAtLevel( ::wxLogLevel,const  ::wxString&) SIP_OVERRIDE;
41     void DoLogText(const  ::wxString&) SIP_OVERRIDE;
42 
43 public:
44     sipSimpleWrapper *sipPySelf;
45 
46 private:
47     sipwxLogStderr(const sipwxLogStderr &);
48     sipwxLogStderr &operator = (const sipwxLogStderr &);
49 
50     char sipPyMethods[4];
51 };
52 
sipwxLogStderr()53 sipwxLogStderr::sipwxLogStderr():  ::wxLogStderr(), sipPySelf(SIP_NULLPTR)
54 {
55     memset(sipPyMethods, 0, sizeof (sipPyMethods));
56 }
57 
~sipwxLogStderr()58 sipwxLogStderr::~sipwxLogStderr()
59 {
60     sipInstanceDestroyedEx(&sipPySelf);
61 }
62 
Flush()63 void sipwxLogStderr::Flush()
64 {
65     sip_gilstate_t sipGILState;
66     PyObject *sipMeth;
67 
68     sipMeth = sipIsPyMethod(&sipGILState,&sipPyMethods[0],sipPySelf,SIP_NULLPTR,sipName_Flush);
69 
70     if (!sipMeth)
71     {
72          ::wxLogStderr::Flush();
73         return;
74     }
75 
76     extern void sipVH__core_45(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *);
77 
78     sipVH__core_45(sipGILState, 0, sipPySelf, sipMeth);
79 }
80 
DoLogRecord(::wxLogLevel level,const::wxString & msg,const::wxLogRecordInfo & info)81 void sipwxLogStderr::DoLogRecord( ::wxLogLevel level,const  ::wxString& msg,const  ::wxLogRecordInfo& info)
82 {
83     sip_gilstate_t sipGILState;
84     PyObject *sipMeth;
85 
86     sipMeth = sipIsPyMethod(&sipGILState,&sipPyMethods[1],sipPySelf,SIP_NULLPTR,sipName_DoLogRecord);
87 
88     if (!sipMeth)
89     {
90          ::wxLogStderr::DoLogRecord(level,msg,info);
91         return;
92     }
93 
94     extern void sipVH__core_46(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *,  ::wxLogLevel,const  ::wxString&,const  ::wxLogRecordInfo&);
95 
96     sipVH__core_46(sipGILState, 0, sipPySelf, sipMeth, level, msg, info);
97 }
98 
DoLogTextAtLevel(::wxLogLevel level,const::wxString & msg)99 void sipwxLogStderr::DoLogTextAtLevel( ::wxLogLevel level,const  ::wxString& msg)
100 {
101     sip_gilstate_t sipGILState;
102     PyObject *sipMeth;
103 
104     sipMeth = sipIsPyMethod(&sipGILState,&sipPyMethods[2],sipPySelf,SIP_NULLPTR,sipName_DoLogTextAtLevel);
105 
106     if (!sipMeth)
107     {
108          ::wxLogStderr::DoLogTextAtLevel(level,msg);
109         return;
110     }
111 
112     extern void sipVH__core_47(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *,  ::wxLogLevel,const  ::wxString&);
113 
114     sipVH__core_47(sipGILState, 0, sipPySelf, sipMeth, level, msg);
115 }
116 
DoLogText(const::wxString & msg)117 void sipwxLogStderr::DoLogText(const  ::wxString& msg)
118 {
119     sip_gilstate_t sipGILState;
120     PyObject *sipMeth;
121 
122     sipMeth = sipIsPyMethod(&sipGILState,&sipPyMethods[3],sipPySelf,SIP_NULLPTR,sipName_DoLogText);
123 
124     if (!sipMeth)
125     {
126          ::wxLogStderr::DoLogText(msg);
127         return;
128     }
129 
130     extern void sipVH__core_48(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, const  ::wxString&);
131 
132     sipVH__core_48(sipGILState, 0, sipPySelf, sipMeth, msg);
133 }
134 
sipProtectVirt_DoLogRecord(bool sipSelfWasArg,::wxLogLevel level,const::wxString & msg,const::wxLogRecordInfo & info)135 void sipwxLogStderr::sipProtectVirt_DoLogRecord(bool sipSelfWasArg, ::wxLogLevel level,const  ::wxString& msg,const  ::wxLogRecordInfo& info)
136 {
137     (sipSelfWasArg ?  ::wxLog::DoLogRecord(level,msg,info) : DoLogRecord(level,msg,info));
138 }
139 
sipProtectVirt_DoLogTextAtLevel(bool sipSelfWasArg,::wxLogLevel level,const::wxString & msg)140 void sipwxLogStderr::sipProtectVirt_DoLogTextAtLevel(bool sipSelfWasArg, ::wxLogLevel level,const  ::wxString& msg)
141 {
142     (sipSelfWasArg ?  ::wxLog::DoLogTextAtLevel(level,msg) : DoLogTextAtLevel(level,msg));
143 }
144 
sipProtectVirt_DoLogText(bool sipSelfWasArg,const::wxString & msg)145 void sipwxLogStderr::sipProtectVirt_DoLogText(bool sipSelfWasArg,const  ::wxString& msg)
146 {
147     (sipSelfWasArg ?  ::wxLog::DoLogText(msg) : DoLogText(msg));
148 }
149 
150 
151 PyDoc_STRVAR(doc_wxLogStderr_DoLogRecord, "DoLogRecord(level, msg, info)\n"
152 "\n"
153 "Called to log a new record.");
154 
155 extern "C" {static PyObject *meth_wxLogStderr_DoLogRecord(PyObject *, PyObject *, PyObject *);}
meth_wxLogStderr_DoLogRecord(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)156 static PyObject *meth_wxLogStderr_DoLogRecord(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
157 {
158     PyObject *sipParseErr = SIP_NULLPTR;
159     bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));
160 
161     {
162          ::wxLogLevel level;
163         const  ::wxString* msg;
164         int msgState = 0;
165         const  ::wxLogRecordInfo* info;
166         sipwxLogStderr *sipCpp;
167 
168         static const char *sipKwdList[] = {
169             sipName_level,
170             sipName_msg,
171             sipName_info,
172         };
173 
174         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BmJ1J9", &sipSelf, sipType_wxLogStderr, &sipCpp, &level, sipType_wxString,&msg, &msgState, sipType_wxLogRecordInfo, &info))
175         {
176             PyErr_Clear();
177 
178             Py_BEGIN_ALLOW_THREADS
179             sipCpp->sipProtectVirt_DoLogRecord(sipSelfWasArg,level,*msg,*info);
180             Py_END_ALLOW_THREADS
181             sipReleaseType(const_cast< ::wxString *>(msg),sipType_wxString,msgState);
182 
183             if (PyErr_Occurred())
184                 return 0;
185 
186             Py_INCREF(Py_None);
187             return Py_None;
188         }
189     }
190 
191     /* Raise an exception if the arguments couldn't be parsed. */
192     sipNoMethod(sipParseErr, sipName_LogStderr, sipName_DoLogRecord, SIP_NULLPTR);
193 
194     return SIP_NULLPTR;
195 }
196 
197 
198 PyDoc_STRVAR(doc_wxLogStderr_DoLogTextAtLevel, "DoLogTextAtLevel(level, msg)\n"
199 "\n"
200 "Called to log the specified string at given level.");
201 
202 extern "C" {static PyObject *meth_wxLogStderr_DoLogTextAtLevel(PyObject *, PyObject *, PyObject *);}
meth_wxLogStderr_DoLogTextAtLevel(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)203 static PyObject *meth_wxLogStderr_DoLogTextAtLevel(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
204 {
205     PyObject *sipParseErr = SIP_NULLPTR;
206     bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));
207 
208     {
209          ::wxLogLevel level;
210         const  ::wxString* msg;
211         int msgState = 0;
212         sipwxLogStderr *sipCpp;
213 
214         static const char *sipKwdList[] = {
215             sipName_level,
216             sipName_msg,
217         };
218 
219         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BmJ1", &sipSelf, sipType_wxLogStderr, &sipCpp, &level, sipType_wxString,&msg, &msgState))
220         {
221             PyErr_Clear();
222 
223             Py_BEGIN_ALLOW_THREADS
224             sipCpp->sipProtectVirt_DoLogTextAtLevel(sipSelfWasArg,level,*msg);
225             Py_END_ALLOW_THREADS
226             sipReleaseType(const_cast< ::wxString *>(msg),sipType_wxString,msgState);
227 
228             if (PyErr_Occurred())
229                 return 0;
230 
231             Py_INCREF(Py_None);
232             return Py_None;
233         }
234     }
235 
236     /* Raise an exception if the arguments couldn't be parsed. */
237     sipNoMethod(sipParseErr, sipName_LogStderr, sipName_DoLogTextAtLevel, SIP_NULLPTR);
238 
239     return SIP_NULLPTR;
240 }
241 
242 
243 PyDoc_STRVAR(doc_wxLogStderr_DoLogText, "DoLogText(msg)\n"
244 "\n"
245 "Called to log the specified string.");
246 
247 extern "C" {static PyObject *meth_wxLogStderr_DoLogText(PyObject *, PyObject *, PyObject *);}
meth_wxLogStderr_DoLogText(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)248 static PyObject *meth_wxLogStderr_DoLogText(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
249 {
250     PyObject *sipParseErr = SIP_NULLPTR;
251     bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));
252 
253     {
254         const  ::wxString* msg;
255         int msgState = 0;
256         sipwxLogStderr *sipCpp;
257 
258         static const char *sipKwdList[] = {
259             sipName_msg,
260         };
261 
262         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1", &sipSelf, sipType_wxLogStderr, &sipCpp, sipType_wxString,&msg, &msgState))
263         {
264             PyErr_Clear();
265 
266             Py_BEGIN_ALLOW_THREADS
267             sipCpp->sipProtectVirt_DoLogText(sipSelfWasArg,*msg);
268             Py_END_ALLOW_THREADS
269             sipReleaseType(const_cast< ::wxString *>(msg),sipType_wxString,msgState);
270 
271             if (PyErr_Occurred())
272                 return 0;
273 
274             Py_INCREF(Py_None);
275             return Py_None;
276         }
277     }
278 
279     /* Raise an exception if the arguments couldn't be parsed. */
280     sipNoMethod(sipParseErr, sipName_LogStderr, sipName_DoLogText, SIP_NULLPTR);
281 
282     return SIP_NULLPTR;
283 }
284 
285 
286 /* Cast a pointer to a type somewhere in its inheritance hierarchy. */
287 extern "C" {static void *cast_wxLogStderr(void *, const sipTypeDef *);}
cast_wxLogStderr(void * sipCppV,const sipTypeDef * targetType)288 static void *cast_wxLogStderr(void *sipCppV, const sipTypeDef *targetType)
289 {
290      ::wxLogStderr *sipCpp = reinterpret_cast< ::wxLogStderr *>(sipCppV);
291 
292     if (targetType == sipType_wxLog)
293         return static_cast< ::wxLog *>(sipCpp);
294 
295     return sipCppV;
296 }
297 
298 
299 /* Call the instance's destructor. */
300 extern "C" {static void release_wxLogStderr(void *, int);}
release_wxLogStderr(void * sipCppV,int sipState)301 static void release_wxLogStderr(void *sipCppV, int sipState)
302 {
303     Py_BEGIN_ALLOW_THREADS
304 
305     if (sipState & SIP_DERIVED_CLASS)
306         delete reinterpret_cast<sipwxLogStderr *>(sipCppV);
307     else
308         delete reinterpret_cast< ::wxLogStderr *>(sipCppV);
309 
310     Py_END_ALLOW_THREADS
311 }
312 
313 
314 extern "C" {static void dealloc_wxLogStderr(sipSimpleWrapper *);}
dealloc_wxLogStderr(sipSimpleWrapper * sipSelf)315 static void dealloc_wxLogStderr(sipSimpleWrapper *sipSelf)
316 {
317     if (sipIsDerivedClass(sipSelf))
318         reinterpret_cast<sipwxLogStderr *>(sipGetAddress(sipSelf))->sipPySelf = SIP_NULLPTR;
319 
320     if (sipIsOwnedByPython(sipSelf))
321     {
322         release_wxLogStderr(sipGetAddress(sipSelf), sipIsDerivedClass(sipSelf));
323     }
324 }
325 
326 
327 extern "C" {static void *init_type_wxLogStderr(sipSimpleWrapper *, PyObject *, PyObject *, PyObject **, PyObject **, PyObject **);}
init_type_wxLogStderr(sipSimpleWrapper * sipSelf,PyObject * sipArgs,PyObject * sipKwds,PyObject ** sipUnused,PyObject **,PyObject ** sipParseErr)328 static void *init_type_wxLogStderr(sipSimpleWrapper *sipSelf, PyObject *sipArgs, PyObject *sipKwds, PyObject **sipUnused, PyObject **, PyObject **sipParseErr)
329 {
330     sipwxLogStderr *sipCpp = SIP_NULLPTR;
331 
332     {
333         if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, ""))
334         {
335             PyErr_Clear();
336 
337             Py_BEGIN_ALLOW_THREADS
338             sipCpp = new sipwxLogStderr();
339             Py_END_ALLOW_THREADS
340 
341             if (PyErr_Occurred())
342             {
343                 delete sipCpp;
344                 return SIP_NULLPTR;
345             }
346 
347             sipCpp->sipPySelf = sipSelf;
348 
349             return sipCpp;
350         }
351     }
352 
353     return SIP_NULLPTR;
354 }
355 
356 
357 /* Define this type's super-types. */
358 static sipEncodedTypeDef supers_wxLogStderr[] = {{298, 255, 1}};
359 
360 
361 static PyMethodDef methods_wxLogStderr[] = {
362     {SIP_MLNAME_CAST(sipName_DoLogRecord), SIP_MLMETH_CAST(meth_wxLogStderr_DoLogRecord), METH_VARARGS|METH_KEYWORDS, SIP_NULLPTR},
363     {SIP_MLNAME_CAST(sipName_DoLogText), SIP_MLMETH_CAST(meth_wxLogStderr_DoLogText), METH_VARARGS|METH_KEYWORDS, SIP_NULLPTR},
364     {SIP_MLNAME_CAST(sipName_DoLogTextAtLevel), SIP_MLMETH_CAST(meth_wxLogStderr_DoLogTextAtLevel), METH_VARARGS|METH_KEYWORDS, SIP_NULLPTR}
365 };
366 
367 PyDoc_STRVAR(doc_wxLogStderr, "LogStderr()\n"
368 "\n"
369 "This class can be used to redirect the log messages to a C file stream\n"
370 "(not to be confused with C++ streams).");
371 
372 
373 sipClassTypeDef sipTypeDef__core_wxLogStderr = {
374     {
375         -1,
376         SIP_NULLPTR,
377         SIP_NULLPTR,
378         SIP_TYPE_CLASS,
379         sipNameNr_wxLogStderr,
380         {SIP_NULLPTR},
381         SIP_NULLPTR
382     },
383     {
384         sipNameNr_LogStderr,
385         {0, 0, 1},
386         3, methods_wxLogStderr,
387         0, SIP_NULLPTR,
388         0, SIP_NULLPTR,
389         {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
390     },
391     doc_wxLogStderr,
392     -1,
393     -1,
394     supers_wxLogStderr,
395     SIP_NULLPTR,
396     init_type_wxLogStderr,
397     SIP_NULLPTR,
398     SIP_NULLPTR,
399 #if PY_MAJOR_VERSION >= 3
400     SIP_NULLPTR,
401     SIP_NULLPTR,
402 #else
403     SIP_NULLPTR,
404     SIP_NULLPTR,
405     SIP_NULLPTR,
406     SIP_NULLPTR,
407 #endif
408     dealloc_wxLogStderr,
409     SIP_NULLPTR,
410     SIP_NULLPTR,
411     SIP_NULLPTR,
412     release_wxLogStderr,
413     cast_wxLogStderr,
414     SIP_NULLPTR,
415     SIP_NULLPTR,
416     SIP_NULLPTR,
417     SIP_NULLPTR,
418     SIP_NULLPTR,
419     SIP_NULLPTR
420 };
421