Back to Docs_main.
pyd.class_wrap
- struct wrapped_class_object;
- The class object, a subtype of PyObject
- template wrapped_class_type(T)
- PyTypeObject wrapped_class_type;
- The type object, an instance of PyType_Type
- template wrapped_methods(T)
- Various wrapped methods
- PyObject* wrapped_new(PyTypeObject* type, PyObject* args, PyObject* kwds);
- The generic "_new__" method
- void wrapped_dealloc(PyObject* _self);
- The generic dealloc method.
- PyObject* wrapped_repr(PyObject* _self);
- The default repr method calls the class's toString.
- template wrapped_init(T)
- int init(PyObject* self, PyObject* args, PyObject* kwds);
- The default init method calls the class's zero-argument constructor.
- template wrapped_get(T,alias Fn)
- PyObject* func(PyObject* self, void* closure);
- A generic wrapper around a "getter" property.
- template wrapped_set(T,alias Fn)
- int func(PyObject* self, PyObject* value, void* closure);
- A generic wrapper around a "setter" property.
- template is_wrapped(T)
- A useful check for whether a given class has been wrapped. Mainly used by
the conversion functions (see make_object.d), but possibly useful elsewhere.
- struct wrapped_class;
- This struct wraps a D class. Its member functions are the primary way of
wrapping the specific parts of the class.
- template def(char[] name,alias fn,uint MIN_ARGS = NumberOfArgs!(typeof(&fn)),fn_t = typeof(&fn))
- Wraps a member function of the class.
Params:
name The name of the function as it will appear in Python. fn The member function to wrap. MIN_ARGS The minimum number of arguments this function can accept. fn_t The type of the function. It is only useful to specify this if more than one function has the same name as this one.
- template prop(char[] name,alias fn,bool RO = false)
- Wraps a property of the class.
Params:
name The name of the property as it will appear in Python. fn The property to wrap. RO Whether this is a read-only property.
- template init(alias C1 = undefined,alias C2 = undefined,alias C3 = undefined,alias C4 = undefined,alias C5 = undefined,alias C6 = undefined,alias C7 = undefined,alias C8 = undefined,alias C9 = undefined,alias C10 = undefined)
- Wraps the constructors of the class.
This template takes a series of specializations of the ctor template (see ctor_wrap.d), each of which describes a different constructor that the class supports. The default constructor need not be specified, and will always be available if the class supports it.
BUGS:
This currently does not support having multiple constructors with the same number of arguments.
