26 if (PyType_Ready(&
Id_Type) < 0) {
39 "Class for representing an object Id.\n"
41 ".. method:: __init__(brother)\n"
42 " __init__(first=0, second=0)\n"
44 " Build the Id from two numbers or another :class:`Id` using the copy constructor.\n"
46 " :arg brother: An Id object.\n"
47 " :type brother: :class:`Id`"
48 " :arg first: The first number.\n"
50 " :arg second: The second number.\n"
51 " :type second: int\n");
55 static const char *kwlist_1[] = {
"brother",
nullptr};
56 static const char *kwlist_2[] = {
"first",
"second",
nullptr};
58 int first = 0, second = 0;
60 if (PyArg_ParseTupleAndKeywords(args, kwds,
"O!", (
char **)kwlist_1, &
Id_Type, &brother)) {
61 self->id =
new Id(*(((
BPy_Id *)brother)->
id));
63 else if ((
void)PyErr_Clear(),
64 PyArg_ParseTupleAndKeywords(args, kwds,
"|ii", (
char **)kwlist_2, &first, &second)) {
65 self->id =
new Id(first, second);
68 PyErr_SetString(PyExc_TypeError,
"invalid argument(s)");
77 Py_TYPE(
self)->tp_free((PyObject *)
self);
82 return PyUnicode_FromFormat(
83 "[ first: %i, second: %i ](BPy_Id)",
self->id->getFirst(),
self->id->getSecond());
108 "The first number constituting the Id.\n"
114 return PyLong_FromLong(
self->id->getFirst());
120 if ((scalar = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) {
121 PyErr_SetString(PyExc_TypeError,
"value must be an integer");
124 self->id->setFirst(scalar);
129 "The second number constituting the Id.\n"
135 return PyLong_FromLong(
self->id->getSecond());
141 if ((scalar = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) {
142 PyErr_SetString(PyExc_TypeError,
"value must be an integer");
145 self->id->setSecond(scalar);
152 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
158 PyVarObject_HEAD_INIT(
nullptr, 0)
"Id",
176 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
PyObject * PyBool_from_bool(bool b)
static int Id_second_set(BPy_Id *self, PyObject *value, void *UNUSED(closure))
static PyObject * Id_second_get(BPy_Id *self, void *UNUSED(closure))
static void Id_dealloc(BPy_Id *self)
PyDoc_STRVAR(Id_doc, "Class for representing an object Id.\n" "\n" ".. method:: __init__(brother)\n" " __init__(first=0, second=0)\n" "\n" " Build the Id from two numbers or another :class:`Id` using the copy constructor.\n" "\n" " :arg brother: An Id object.\n" " :type brother: :class:`Id`" " :arg first: The first number.\n" " :type first: int\n" " :arg second: The second number.\n" " :type second: int\n")
static int Id_init(BPy_Id *self, PyObject *args, PyObject *kwds)
static PyGetSetDef BPy_Id_getseters[]
static PyObject * Id_repr(BPy_Id *self)
int Id_Init(PyObject *module)
static int Id_first_set(BPy_Id *self, PyObject *value, void *UNUSED(closure))
static PyObject * Id_RichCompare(BPy_Id *o1, BPy_Id *o2, int opid)
static PyObject * Id_first_get(BPy_Id *self, void *UNUSED(closure))
static struct PyModuleDef module
PyObject_HEAD Freestyle::Id * id