Panda3D
py_wrappers.h
Go to the documentation of this file.
1 /**
2  * @file py_wrappers.h
3  * @author rdb
4  * @date 2017-11-26
5  */
6 
7 #ifndef PY_WRAPPERS_H
8 #define PY_WRAPPERS_H
9 
10 #include "py_panda.h"
11 
12 #ifdef HAVE_PYTHON
13 
14 /**
15  * These classes are returned from properties that require a subscript
16  * interface, ie. something.children[i] = 3.
17  */
18 struct Dtool_WrapperBase {
19  PyObject_HEAD;
20  PyObject *_self;
21  const char *_name;
22 };
23 
24 struct Dtool_SequenceWrapper {
25  Dtool_WrapperBase _base;
26  lenfunc _len_func;
27  ssizeargfunc _getitem_func;
28 };
29 
30 struct Dtool_MutableSequenceWrapper {
31  Dtool_WrapperBase _base;
32  lenfunc _len_func;
33  ssizeargfunc _getitem_func;
34  ssizeobjargproc _setitem_func;
35  PyObject *(*_insert_func)(PyObject *, size_t, PyObject *);
36 };
37 
38 struct Dtool_MappingWrapper {
39  union {
40  Dtool_WrapperBase _base;
41  Dtool_SequenceWrapper _keys;
42  };
43  binaryfunc _getitem_func;
44  objobjargproc _setitem_func;
45 };
46 
47 struct Dtool_GeneratorWrapper {
48  Dtool_WrapperBase _base;
49  iternextfunc _iternext_func;
50 };
51 
52 EXPCL_PYPANDA Dtool_SequenceWrapper *Dtool_NewSequenceWrapper(PyObject *self, const char *name);
53 EXPCL_PYPANDA Dtool_MutableSequenceWrapper *Dtool_NewMutableSequenceWrapper(PyObject *self, const char *name);
54 EXPCL_PYPANDA Dtool_MappingWrapper *Dtool_NewMappingWrapper(PyObject *self, const char *name);
55 EXPCL_PYPANDA Dtool_MappingWrapper *Dtool_NewMutableMappingWrapper(PyObject *self, const char *name);
56 EXPCL_PYPANDA PyObject *Dtool_NewGenerator(PyObject *self, iternextfunc func);
57 EXPCL_PYPANDA PyObject *Dtool_NewStaticProperty(PyTypeObject *obj, const PyGetSetDef *getset);
58 
59 #endif // HAVE_PYTHON
60 
61 #endif // PY_WRAPPERS_H