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
16
17 class sipwxLogFormatter : public ::wxLogFormatter
18 {
19 public:
20 sipwxLogFormatter();
21 sipwxLogFormatter(const ::wxLogFormatter&);
22 virtual ~sipwxLogFormatter();
23
24 /*
25 * There is a public method for every protected method visible from
26 * this class.
27 */
28 ::wxString sipProtectVirt_FormatTime(bool, ::time_t) const;
29
30 /*
31 * There is a protected method for every virtual method visible from
32 * this class.
33 */
34 protected:
35 ::wxString FormatTime( ::time_t) const SIP_OVERRIDE;
36 ::wxString Format( ::wxLogLevel,const ::wxString&,const ::wxLogRecordInfo&) const SIP_OVERRIDE;
37
38 public:
39 sipSimpleWrapper *sipPySelf;
40
41 private:
42 sipwxLogFormatter(const sipwxLogFormatter &);
43 sipwxLogFormatter &operator = (const sipwxLogFormatter &);
44
45 char sipPyMethods[2];
46 };
47
sipwxLogFormatter()48 sipwxLogFormatter::sipwxLogFormatter(): ::wxLogFormatter(), sipPySelf(SIP_NULLPTR)
49 {
50 memset(sipPyMethods, 0, sizeof (sipPyMethods));
51 }
52
sipwxLogFormatter(const::wxLogFormatter & a0)53 sipwxLogFormatter::sipwxLogFormatter(const ::wxLogFormatter& a0): ::wxLogFormatter(a0), sipPySelf(SIP_NULLPTR)
54 {
55 memset(sipPyMethods, 0, sizeof (sipPyMethods));
56 }
57
~sipwxLogFormatter()58 sipwxLogFormatter::~sipwxLogFormatter()
59 {
60 sipInstanceDestroyedEx(&sipPySelf);
61 }
62
FormatTime(::time_t time) const63 ::wxString sipwxLogFormatter::FormatTime( ::time_t time) const
64 {
65 sip_gilstate_t sipGILState;
66 PyObject *sipMeth;
67
68 sipMeth = sipIsPyMethod(&sipGILState,const_cast<char *>(&sipPyMethods[0]),sipPySelf,SIP_NULLPTR,sipName_FormatTime);
69
70 if (!sipMeth)
71 return ::wxLogFormatter::FormatTime(time);
72
73 extern ::wxString sipVH__core_52(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, ::time_t);
74
75 return sipVH__core_52(sipGILState, 0, sipPySelf, sipMeth, time);
76 }
77
Format(::wxLogLevel level,const::wxString & msg,const::wxLogRecordInfo & info) const78 ::wxString sipwxLogFormatter::Format( ::wxLogLevel level,const ::wxString& msg,const ::wxLogRecordInfo& info) const
79 {
80 sip_gilstate_t sipGILState;
81 PyObject *sipMeth;
82
83 sipMeth = sipIsPyMethod(&sipGILState,const_cast<char *>(&sipPyMethods[1]),sipPySelf,SIP_NULLPTR,sipName_Format);
84
85 if (!sipMeth)
86 return ::wxLogFormatter::Format(level,msg,info);
87
88 extern ::wxString sipVH__core_51(sip_gilstate_t, sipVirtErrorHandlerFunc, sipSimpleWrapper *, PyObject *, ::wxLogLevel,const ::wxString&,const ::wxLogRecordInfo&);
89
90 return sipVH__core_51(sipGILState, 0, sipPySelf, sipMeth, level, msg, info);
91 }
92
sipProtectVirt_FormatTime(bool sipSelfWasArg,::time_t time) const93 ::wxString sipwxLogFormatter::sipProtectVirt_FormatTime(bool sipSelfWasArg, ::time_t time) const
94 {
95 return (sipSelfWasArg ? ::wxLogFormatter::FormatTime(time) : FormatTime(time));
96 }
97
98
99 PyDoc_STRVAR(doc_wxLogFormatter_Format, "Format(level, msg, info) -> String\n"
100 "\n"
101 "This function creates the full log message string.");
102
103 extern "C" {static PyObject *meth_wxLogFormatter_Format(PyObject *, PyObject *, PyObject *);}
meth_wxLogFormatter_Format(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)104 static PyObject *meth_wxLogFormatter_Format(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
105 {
106 PyObject *sipParseErr = SIP_NULLPTR;
107 bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));
108
109 {
110 ::wxLogLevel level;
111 const ::wxString* msg;
112 int msgState = 0;
113 const ::wxLogRecordInfo* info;
114 const ::wxLogFormatter *sipCpp;
115
116 static const char *sipKwdList[] = {
117 sipName_level,
118 sipName_msg,
119 sipName_info,
120 };
121
122 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BmJ1J9", &sipSelf, sipType_wxLogFormatter, &sipCpp, &level, sipType_wxString,&msg, &msgState, sipType_wxLogRecordInfo, &info))
123 {
124 ::wxString*sipRes;
125
126 PyErr_Clear();
127
128 Py_BEGIN_ALLOW_THREADS
129 sipRes = new ::wxString((sipSelfWasArg ? sipCpp-> ::wxLogFormatter::Format(level,*msg,*info) : sipCpp->Format(level,*msg,*info)));
130 Py_END_ALLOW_THREADS
131 sipReleaseType(const_cast< ::wxString *>(msg),sipType_wxString,msgState);
132
133 if (PyErr_Occurred())
134 return 0;
135
136 return sipConvertFromNewType(sipRes,sipType_wxString,SIP_NULLPTR);
137 }
138 }
139
140 /* Raise an exception if the arguments couldn't be parsed. */
141 sipNoMethod(sipParseErr, sipName_LogFormatter, sipName_Format, SIP_NULLPTR);
142
143 return SIP_NULLPTR;
144 }
145
146
147 PyDoc_STRVAR(doc_wxLogFormatter_FormatTime, "FormatTime(time) -> String\n"
148 "\n"
149 "This function formats the time stamp part of the log message.");
150
151 extern "C" {static PyObject *meth_wxLogFormatter_FormatTime(PyObject *, PyObject *, PyObject *);}
meth_wxLogFormatter_FormatTime(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)152 static PyObject *meth_wxLogFormatter_FormatTime(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
153 {
154 PyObject *sipParseErr = SIP_NULLPTR;
155 bool sipSelfWasArg = (!sipSelf || sipIsDerivedClass((sipSimpleWrapper *)sipSelf));
156
157 {
158 ::time_t time;
159 const sipwxLogFormatter *sipCpp;
160
161 static const char *sipKwdList[] = {
162 sipName_time,
163 };
164
165 if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "Bl", &sipSelf, sipType_wxLogFormatter, &sipCpp, &time))
166 {
167 ::wxString*sipRes;
168
169 PyErr_Clear();
170
171 Py_BEGIN_ALLOW_THREADS
172 sipRes = new ::wxString(sipCpp->sipProtectVirt_FormatTime(sipSelfWasArg,time));
173 Py_END_ALLOW_THREADS
174
175 if (PyErr_Occurred())
176 return 0;
177
178 return sipConvertFromNewType(sipRes,sipType_wxString,SIP_NULLPTR);
179 }
180 }
181
182 /* Raise an exception if the arguments couldn't be parsed. */
183 sipNoMethod(sipParseErr, sipName_LogFormatter, sipName_FormatTime, SIP_NULLPTR);
184
185 return SIP_NULLPTR;
186 }
187
188
189 /* Call the instance's destructor. */
190 extern "C" {static void release_wxLogFormatter(void *, int);}
release_wxLogFormatter(void * sipCppV,int sipState)191 static void release_wxLogFormatter(void *sipCppV, int sipState)
192 {
193 Py_BEGIN_ALLOW_THREADS
194
195 if (sipState & SIP_DERIVED_CLASS)
196 delete reinterpret_cast<sipwxLogFormatter *>(sipCppV);
197 else
198 delete reinterpret_cast< ::wxLogFormatter *>(sipCppV);
199
200 Py_END_ALLOW_THREADS
201 }
202
203
204 extern "C" {static void assign_wxLogFormatter(void *, SIP_SSIZE_T, void *);}
assign_wxLogFormatter(void * sipDst,SIP_SSIZE_T sipDstIdx,void * sipSrc)205 static void assign_wxLogFormatter(void *sipDst, SIP_SSIZE_T sipDstIdx, void *sipSrc)
206 {
207 reinterpret_cast< ::wxLogFormatter *>(sipDst)[sipDstIdx] = *reinterpret_cast< ::wxLogFormatter *>(sipSrc);
208 }
209
210
211 extern "C" {static void *array_wxLogFormatter(SIP_SSIZE_T);}
array_wxLogFormatter(SIP_SSIZE_T sipNrElem)212 static void *array_wxLogFormatter(SIP_SSIZE_T sipNrElem)
213 {
214 return new ::wxLogFormatter[sipNrElem];
215 }
216
217
218 extern "C" {static void *copy_wxLogFormatter(const void *, SIP_SSIZE_T);}
copy_wxLogFormatter(const void * sipSrc,SIP_SSIZE_T sipSrcIdx)219 static void *copy_wxLogFormatter(const void *sipSrc, SIP_SSIZE_T sipSrcIdx)
220 {
221 return new ::wxLogFormatter(reinterpret_cast<const ::wxLogFormatter *>(sipSrc)[sipSrcIdx]);
222 }
223
224
225 extern "C" {static void dealloc_wxLogFormatter(sipSimpleWrapper *);}
dealloc_wxLogFormatter(sipSimpleWrapper * sipSelf)226 static void dealloc_wxLogFormatter(sipSimpleWrapper *sipSelf)
227 {
228 if (sipIsDerivedClass(sipSelf))
229 reinterpret_cast<sipwxLogFormatter *>(sipGetAddress(sipSelf))->sipPySelf = SIP_NULLPTR;
230
231 if (sipIsOwnedByPython(sipSelf))
232 {
233 release_wxLogFormatter(sipGetAddress(sipSelf), sipIsDerivedClass(sipSelf));
234 }
235 }
236
237
238 extern "C" {static void *init_type_wxLogFormatter(sipSimpleWrapper *, PyObject *, PyObject *, PyObject **, PyObject **, PyObject **);}
init_type_wxLogFormatter(sipSimpleWrapper * sipSelf,PyObject * sipArgs,PyObject * sipKwds,PyObject ** sipUnused,PyObject **,PyObject ** sipParseErr)239 static void *init_type_wxLogFormatter(sipSimpleWrapper *sipSelf, PyObject *sipArgs, PyObject *sipKwds, PyObject **sipUnused, PyObject **, PyObject **sipParseErr)
240 {
241 sipwxLogFormatter *sipCpp = SIP_NULLPTR;
242
243 {
244 if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, ""))
245 {
246 PyErr_Clear();
247
248 Py_BEGIN_ALLOW_THREADS
249 sipCpp = new sipwxLogFormatter();
250 Py_END_ALLOW_THREADS
251
252 if (PyErr_Occurred())
253 {
254 delete sipCpp;
255 return SIP_NULLPTR;
256 }
257
258 sipCpp->sipPySelf = sipSelf;
259
260 return sipCpp;
261 }
262 }
263
264 {
265 const ::wxLogFormatter* a0;
266
267 if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, "J9", sipType_wxLogFormatter, &a0))
268 {
269 Py_BEGIN_ALLOW_THREADS
270 sipCpp = new sipwxLogFormatter(*a0);
271 Py_END_ALLOW_THREADS
272
273 sipCpp->sipPySelf = sipSelf;
274
275 return sipCpp;
276 }
277 }
278
279 return SIP_NULLPTR;
280 }
281
282
283 static PyMethodDef methods_wxLogFormatter[] = {
284 {SIP_MLNAME_CAST(sipName_Format), SIP_MLMETH_CAST(meth_wxLogFormatter_Format), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxLogFormatter_Format)},
285 {SIP_MLNAME_CAST(sipName_FormatTime), SIP_MLMETH_CAST(meth_wxLogFormatter_FormatTime), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxLogFormatter_FormatTime)}
286 };
287
288 PyDoc_STRVAR(doc_wxLogFormatter, "LogFormatter()\n"
289 "\n"
290 "wxLogFormatter class is used to format the log messages.");
291
292
293 sipClassTypeDef sipTypeDef__core_wxLogFormatter = {
294 {
295 -1,
296 SIP_NULLPTR,
297 SIP_NULLPTR,
298 SIP_TYPE_CLASS,
299 sipNameNr_wxLogFormatter,
300 {SIP_NULLPTR},
301 SIP_NULLPTR
302 },
303 {
304 sipNameNr_LogFormatter,
305 {0, 0, 1},
306 2, methods_wxLogFormatter,
307 0, SIP_NULLPTR,
308 0, SIP_NULLPTR,
309 {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
310 },
311 doc_wxLogFormatter,
312 -1,
313 -1,
314 SIP_NULLPTR,
315 SIP_NULLPTR,
316 init_type_wxLogFormatter,
317 SIP_NULLPTR,
318 SIP_NULLPTR,
319 #if PY_MAJOR_VERSION >= 3
320 SIP_NULLPTR,
321 SIP_NULLPTR,
322 #else
323 SIP_NULLPTR,
324 SIP_NULLPTR,
325 SIP_NULLPTR,
326 SIP_NULLPTR,
327 #endif
328 dealloc_wxLogFormatter,
329 assign_wxLogFormatter,
330 array_wxLogFormatter,
331 copy_wxLogFormatter,
332 release_wxLogFormatter,
333 SIP_NULLPTR,
334 SIP_NULLPTR,
335 SIP_NULLPTR,
336 SIP_NULLPTR,
337 SIP_NULLPTR,
338 SIP_NULLPTR,
339 SIP_NULLPTR
340 };
341