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_grid.h"
11 
12 
13         #include <wx/grid.h>
14 
15 
16 PyDoc_STRVAR(doc_wxGridCellCoordsArray_append, "append(self, obj: GridCellCoords)");
17 
18 extern "C" {static PyObject *meth_wxGridCellCoordsArray_append(PyObject *, PyObject *, PyObject *);}
meth_wxGridCellCoordsArray_append(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)19 static PyObject *meth_wxGridCellCoordsArray_append(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
20 {
21     PyObject *sipParseErr = SIP_NULLPTR;
22 
23     {
24          ::wxGridCellCoords* obj;
25         int objState = 0;
26          ::wxGridCellCoordsArray *sipCpp;
27 
28         static const char *sipKwdList[] = {
29             sipName_obj,
30         };
31 
32         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1", &sipSelf, sipType_wxGridCellCoordsArray, &sipCpp, sipType_wxGridCellCoords, &obj, &objState))
33         {
34         sipCpp->Add(*obj);
35             sipReleaseType(obj,sipType_wxGridCellCoords,objState);
36 
37             Py_INCREF(Py_None);
38             return Py_None;
39         }
40     }
41 
42     /* Raise an exception if the arguments couldn't be parsed. */
43     sipNoMethod(sipParseErr, sipName_GridCellCoordsArray, sipName_append, doc_wxGridCellCoordsArray_append);
44 
45     return SIP_NULLPTR;
46 }
47 
48 
49 PyDoc_STRVAR(doc_wxGridCellCoordsArray_index, "index(self, obj: GridCellCoords) -> int");
50 
51 extern "C" {static PyObject *meth_wxGridCellCoordsArray_index(PyObject *, PyObject *, PyObject *);}
meth_wxGridCellCoordsArray_index(PyObject * sipSelf,PyObject * sipArgs,PyObject * sipKwds)52 static PyObject *meth_wxGridCellCoordsArray_index(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
53 {
54     PyObject *sipParseErr = SIP_NULLPTR;
55 
56     {
57          ::wxGridCellCoords* obj;
58         int objState = 0;
59          ::wxGridCellCoordsArray *sipCpp;
60 
61         static const char *sipKwdList[] = {
62             sipName_obj,
63         };
64 
65         if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, SIP_NULLPTR, "BJ1", &sipSelf, sipType_wxGridCellCoordsArray, &sipCpp, sipType_wxGridCellCoords, &obj, &objState))
66         {
67             int sipRes = 0;
68             sipErrorState sipError = sipErrorNone;
69 
70         int idx = sipCpp->Index(*obj, false);
71         if (idx == wxNOT_FOUND) {
72             sipError = sipErrorFail;
73             wxPyErr_SetString(PyExc_ValueError,
74                               "sequence.index(x): x not in sequence");
75             }
76         sipRes = idx;
77             sipReleaseType(obj,sipType_wxGridCellCoords,objState);
78 
79             if (sipError == sipErrorFail)
80                 return 0;
81 
82             if (sipError == sipErrorNone)
83             {
84             return SIPLong_FromLong(sipRes);
85             }
86 
87             sipAddException(sipError, &sipParseErr);
88         }
89     }
90 
91     /* Raise an exception if the arguments couldn't be parsed. */
92     sipNoMethod(sipParseErr, sipName_GridCellCoordsArray, sipName_index, doc_wxGridCellCoordsArray_index);
93 
94     return SIP_NULLPTR;
95 }
96 
97 
98 extern "C" {static int slot_wxGridCellCoordsArray___contains__(PyObject *,PyObject *);}
slot_wxGridCellCoordsArray___contains__(PyObject * sipSelf,PyObject * sipArg)99 static int slot_wxGridCellCoordsArray___contains__(PyObject *sipSelf,PyObject *sipArg)
100 {
101      ::wxGridCellCoordsArray *sipCpp = reinterpret_cast< ::wxGridCellCoordsArray *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxGridCellCoordsArray));
102 
103     if (!sipCpp)
104         return -1;
105 
106     PyObject *sipParseErr = SIP_NULLPTR;
107 
108     {
109          ::wxGridCellCoords* obj;
110         int objState = 0;
111 
112         if (sipParseArgs(&sipParseErr, sipArg, "1J1", sipType_wxGridCellCoords, &obj, &objState))
113         {
114             int sipRes = 0;
115 
116         int idx = sipCpp->Index(*obj, false);
117         sipRes = idx != wxNOT_FOUND;
118             sipReleaseType(obj,sipType_wxGridCellCoords,objState);
119 
120             return sipRes;
121         }
122     }
123 
124     /* Raise an exception if the arguments couldn't be parsed. */
125     sipNoMethod(sipParseErr, sipName_GridCellCoordsArray, sipName___contains__, SIP_NULLPTR);
126 
127     return -1;
128 }
129 
130 
131 extern "C" {static PyObject *slot_wxGridCellCoordsArray___getitem__(PyObject *,PyObject *);}
slot_wxGridCellCoordsArray___getitem__(PyObject * sipSelf,PyObject * sipArg)132 static PyObject *slot_wxGridCellCoordsArray___getitem__(PyObject *sipSelf,PyObject *sipArg)
133 {
134      ::wxGridCellCoordsArray *sipCpp = reinterpret_cast< ::wxGridCellCoordsArray *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxGridCellCoordsArray));
135 
136     if (!sipCpp)
137         return SIP_NULLPTR;
138 
139     PyObject *sipParseErr = SIP_NULLPTR;
140 
141     {
142         long index;
143 
144         if (sipParseArgs(&sipParseErr, sipArg, "1l", &index))
145         {
146              ::wxGridCellCoords*sipRes = 0;
147             sipErrorState sipError = sipErrorNone;
148 
149             if (0 > index)
150                 index += sipCpp->GetCount();
151             if ((index < sipCpp->GetCount()) && (0 <= index)) {
152                 sipRes = new wxGridCellCoords(sipCpp->Item(index));
153             }
154             else {
155                 wxPyErr_SetString(PyExc_IndexError, "sequence index out of range");
156                 sipError = sipErrorFail;
157             }
158 
159             if (sipError == sipErrorFail)
160                 return 0;
161 
162             if (sipError == sipErrorNone)
163             {
164             return sipConvertFromNewType(sipRes,sipType_wxGridCellCoords,SIP_NULLPTR);
165             }
166 
167             sipAddException(sipError, &sipParseErr);
168         }
169     }
170 
171     /* Raise an exception if the arguments couldn't be parsed. */
172     sipNoMethod(sipParseErr, sipName_GridCellCoordsArray, sipName___getitem__, SIP_NULLPTR);
173 
174     return SIP_NULLPTR;
175 }
176 
177 
178 extern "C" {static SIP_SSIZE_T slot_wxGridCellCoordsArray___len__(PyObject *);}
slot_wxGridCellCoordsArray___len__(PyObject * sipSelf)179 static SIP_SSIZE_T slot_wxGridCellCoordsArray___len__(PyObject *sipSelf)
180 {
181      ::wxGridCellCoordsArray *sipCpp = reinterpret_cast< ::wxGridCellCoordsArray *>(sipGetCppPtr((sipSimpleWrapper *)sipSelf,sipType_wxGridCellCoordsArray));
182 
183     if (!sipCpp)
184         return 0;
185 
186 
187     {
188         {
189             SIP_SSIZE_T sipRes = 0;
190 
191         sipRes = sipCpp->GetCount();
192 
193             return sipRes;
194         }
195     }
196 
197     return 0;
198 }
199 
200 
201 /* Call the instance's destructor. */
202 extern "C" {static void release_wxGridCellCoordsArray(void *, int);}
release_wxGridCellCoordsArray(void * sipCppV,int)203 static void release_wxGridCellCoordsArray(void *sipCppV, int)
204 {
205     Py_BEGIN_ALLOW_THREADS
206 
207     delete reinterpret_cast< ::wxGridCellCoordsArray *>(sipCppV);
208 
209     Py_END_ALLOW_THREADS
210 }
211 
212 
213 extern "C" {static void assign_wxGridCellCoordsArray(void *, SIP_SSIZE_T, void *);}
assign_wxGridCellCoordsArray(void * sipDst,SIP_SSIZE_T sipDstIdx,void * sipSrc)214 static void assign_wxGridCellCoordsArray(void *sipDst, SIP_SSIZE_T sipDstIdx, void *sipSrc)
215 {
216     reinterpret_cast< ::wxGridCellCoordsArray *>(sipDst)[sipDstIdx] = *reinterpret_cast< ::wxGridCellCoordsArray *>(sipSrc);
217 }
218 
219 
220 extern "C" {static void *array_wxGridCellCoordsArray(SIP_SSIZE_T);}
array_wxGridCellCoordsArray(SIP_SSIZE_T sipNrElem)221 static void *array_wxGridCellCoordsArray(SIP_SSIZE_T sipNrElem)
222 {
223     return new  ::wxGridCellCoordsArray[sipNrElem];
224 }
225 
226 
227 extern "C" {static void *copy_wxGridCellCoordsArray(const void *, SIP_SSIZE_T);}
copy_wxGridCellCoordsArray(const void * sipSrc,SIP_SSIZE_T sipSrcIdx)228 static void *copy_wxGridCellCoordsArray(const void *sipSrc, SIP_SSIZE_T sipSrcIdx)
229 {
230     return new  ::wxGridCellCoordsArray(reinterpret_cast<const  ::wxGridCellCoordsArray *>(sipSrc)[sipSrcIdx]);
231 }
232 
233 
234 extern "C" {static void dealloc_wxGridCellCoordsArray(sipSimpleWrapper *);}
dealloc_wxGridCellCoordsArray(sipSimpleWrapper * sipSelf)235 static void dealloc_wxGridCellCoordsArray(sipSimpleWrapper *sipSelf)
236 {
237     if (sipIsOwnedByPython(sipSelf))
238     {
239         release_wxGridCellCoordsArray(sipGetAddress(sipSelf), 0);
240     }
241 }
242 
243 
244 extern "C" {static void *init_type_wxGridCellCoordsArray(sipSimpleWrapper *, PyObject *, PyObject *, PyObject **, PyObject **, PyObject **);}
init_type_wxGridCellCoordsArray(sipSimpleWrapper *,PyObject * sipArgs,PyObject * sipKwds,PyObject ** sipUnused,PyObject **,PyObject ** sipParseErr)245 static void *init_type_wxGridCellCoordsArray(sipSimpleWrapper *, PyObject *sipArgs, PyObject *sipKwds, PyObject **sipUnused, PyObject **, PyObject **sipParseErr)
246 {
247      ::wxGridCellCoordsArray *sipCpp = SIP_NULLPTR;
248 
249     {
250         if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, ""))
251         {
252             Py_BEGIN_ALLOW_THREADS
253             sipCpp = new  ::wxGridCellCoordsArray();
254             Py_END_ALLOW_THREADS
255 
256             return sipCpp;
257         }
258     }
259 
260     {
261         const  ::wxGridCellCoordsArray* a0;
262 
263         if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, SIP_NULLPTR, sipUnused, "J9", sipType_wxGridCellCoordsArray, &a0))
264         {
265             Py_BEGIN_ALLOW_THREADS
266             sipCpp = new  ::wxGridCellCoordsArray(*a0);
267             Py_END_ALLOW_THREADS
268 
269             return sipCpp;
270         }
271     }
272 
273     return SIP_NULLPTR;
274 }
275 
276 
277 /* Define this type's Python slots. */
278 static sipPySlotDef slots_wxGridCellCoordsArray[] = {
279     {(void *)slot_wxGridCellCoordsArray___contains__, contains_slot},
280     {(void *)slot_wxGridCellCoordsArray___getitem__, getitem_slot},
281     {(void *)slot_wxGridCellCoordsArray___len__, len_slot},
282     {0, (sipPySlotType)0}
283 };
284 
285 
286 static PyMethodDef methods_wxGridCellCoordsArray[] = {
287     {SIP_MLNAME_CAST(sipName_append), SIP_MLMETH_CAST(meth_wxGridCellCoordsArray_append), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxGridCellCoordsArray_append)},
288     {SIP_MLNAME_CAST(sipName_index), SIP_MLMETH_CAST(meth_wxGridCellCoordsArray_index), METH_VARARGS|METH_KEYWORDS, SIP_MLDOC_CAST(doc_wxGridCellCoordsArray_index)}
289 };
290 
291 PyDoc_STRVAR(doc_wxGridCellCoordsArray, "\1GridCellCoordsArray()\n"
292 "GridCellCoordsArray(GridCellCoordsArray)");
293 
294 
295 sipClassTypeDef sipTypeDef__grid_wxGridCellCoordsArray = {
296     {
297         -1,
298         SIP_NULLPTR,
299         SIP_NULLPTR,
300         SIP_TYPE_CLASS,
301         sipNameNr_wxGridCellCoordsArray,
302         {SIP_NULLPTR},
303         SIP_NULLPTR
304     },
305     {
306         sipNameNr_GridCellCoordsArray,
307         {0, 0, 1},
308         2, methods_wxGridCellCoordsArray,
309         0, SIP_NULLPTR,
310         0, SIP_NULLPTR,
311         {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR},
312     },
313     doc_wxGridCellCoordsArray,
314     -1,
315     -1,
316     SIP_NULLPTR,
317     slots_wxGridCellCoordsArray,
318     init_type_wxGridCellCoordsArray,
319     SIP_NULLPTR,
320     SIP_NULLPTR,
321 #if PY_MAJOR_VERSION >= 3
322     SIP_NULLPTR,
323     SIP_NULLPTR,
324 #else
325     SIP_NULLPTR,
326     SIP_NULLPTR,
327     SIP_NULLPTR,
328     SIP_NULLPTR,
329 #endif
330     dealloc_wxGridCellCoordsArray,
331     assign_wxGridCellCoordsArray,
332     array_wxGridCellCoordsArray,
333     copy_wxGridCellCoordsArray,
334     release_wxGridCellCoordsArray,
335     SIP_NULLPTR,
336     SIP_NULLPTR,
337     SIP_NULLPTR,
338     SIP_NULLPTR,
339     SIP_NULLPTR,
340     SIP_NULLPTR,
341     SIP_NULLPTR
342 };
343