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/longlong.h>
13 
14 
15 
16 extern "C" {static void assign_wxLongLong(void *, SIP_SSIZE_T, void *);}
assign_wxLongLong(void * sipDst,SIP_SSIZE_T sipDstIdx,void * sipSrc)17 static void assign_wxLongLong(void *sipDst, SIP_SSIZE_T sipDstIdx, void *sipSrc)
18 {
19     reinterpret_cast< ::wxLongLong *>(sipDst)[sipDstIdx] = *reinterpret_cast< ::wxLongLong *>(sipSrc);
20 }
21 
22 
23 extern "C" {static void *array_wxLongLong(SIP_SSIZE_T);}
array_wxLongLong(SIP_SSIZE_T sipNrElem)24 static void *array_wxLongLong(SIP_SSIZE_T sipNrElem)
25 {
26     return new  ::wxLongLong[sipNrElem];
27 }
28 
29 
30 extern "C" {static void *copy_wxLongLong(const void *, SIP_SSIZE_T);}
copy_wxLongLong(const void * sipSrc,SIP_SSIZE_T sipSrcIdx)31 static void *copy_wxLongLong(const void *sipSrc, SIP_SSIZE_T sipSrcIdx)
32 {
33     return new  ::wxLongLong(reinterpret_cast<const  ::wxLongLong *>(sipSrc)[sipSrcIdx]);
34 }
35 
36 
37 /* Call the mapped type's destructor. */
38 extern "C" {static void release_wxLongLong(void *, int);}
release_wxLongLong(void * ptr,int)39 static void release_wxLongLong(void *ptr, int)
40 {
41     Py_BEGIN_ALLOW_THREADS
42     delete reinterpret_cast< ::wxLongLong *>(ptr);
43     Py_END_ALLOW_THREADS
44 }
45 
46 
47 
48 extern "C" {static int convertTo_wxLongLong(PyObject *, void **, int *, PyObject *);}
convertTo_wxLongLong(PyObject * sipPy,void ** sipCppPtrV,int * sipIsErr,PyObject * sipTransferObj)49 static int convertTo_wxLongLong(PyObject *sipPy,void **sipCppPtrV,int *sipIsErr,PyObject *sipTransferObj)
50 {
51      ::wxLongLong **sipCppPtr = reinterpret_cast< ::wxLongLong **>(sipCppPtrV);
52 
53         // Code to test a PyObject for compatibility
54         if (!sipIsErr) {
55             if (PyNumber_Check(sipPy))
56                 return TRUE;
57             return FALSE;
58         }
59 
60         // Code to convert from a compatible PyObject
61         #if wxUSE_LONGLONG_NATIVE
62             *sipCppPtr = new wxLongLong(PyLong_AsLongLong(sipPy));
63         #else
64             #error TODO. Get the hi/lo 32-bit dwords to construct the wxLongLong
65         #endif
66         return sipGetState(sipTransferObj);
67 
68 }
69 
70 
71 extern "C" {static PyObject *convertFrom_wxLongLong(void *, PyObject *);}
convertFrom_wxLongLong(void * sipCppV,PyObject *)72 static PyObject *convertFrom_wxLongLong(void *sipCppV, PyObject *)
73 {
74     ::wxLongLong *sipCpp = reinterpret_cast< ::wxLongLong *>(sipCppV);
75 
76         #if wxUSE_LONGLONG_NATIVE
77             return PyLong_FromLongLong(sipCpp->GetValue());
78         #else
79             #error This is untested
80             // Convert a wxLongLong to a Python Long by getting the hi/lo
81             // dwords, then shifting and or-ing them together
82             PyObject *hi, *lo, *shifter, *shifted, *result;
83             hi = PyLong_FromLong( sipCpp->GetHi() );
84             lo = PyLong_FromLong( sipCpp->GetLo() );
85             shifter = PyLong_FromLong(32);
86             shifted = PyNumber_Lshift(hi, shifter);
87             result = PyNumber_Or(shifted, lo);
88             Py_DECREF(hi);
89             Py_DECREF(lo);
90             Py_DECREF(shifter);
91             Py_DECREF(shifted);
92             return result;
93         #endif
94 }
95 
96 
97 sipMappedTypeDef sipTypeDef__core_wxLongLong = {
98     {
99         -1,
100         SIP_NULLPTR,
101         0,
102         SIP_TYPE_MAPPED,
103         sipNameNr_wxLongLong,     /* wxLongLong */
104         {0},
105         0
106     },
107     {
108         -1,
109         {0, 0, 1},
110         0, 0,
111         0, 0,
112         0, 0,
113         {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
114     },
115     assign_wxLongLong,
116     array_wxLongLong,
117     copy_wxLongLong,
118     release_wxLongLong,
119     convertTo_wxLongLong,
120     convertFrom_wxLongLong
121 };
122