28 if (PyType_Ready(&
Id_Type) < 0) {
41 "Class for representing an object Id.\n"
43 ".. method:: __init__(brother)\n"
44 " __init__(first=0, second=0)\n"
46 " Build the Id from two numbers or another :class:`Id` using the copy constructor.\n"
48 " :arg brother: An Id object.\n"
49 " :type brother: :class:`Id`"
50 " :arg first: The first number.\n"
52 " :arg second: The second number.\n"
53 " :type second: int\n");
57 static const char *kwlist_1[] = {
"brother",
nullptr};
58 static const char *kwlist_2[] = {
"first",
"second",
nullptr};
60 int first = 0, second = 0;
62 if (PyArg_ParseTupleAndKeywords(args, kwds,
"O!", (
char **)kwlist_1, &
Id_Type, &brother)) {
65 else if ((
void)PyErr_Clear(),
66 PyArg_ParseTupleAndKeywords(args, kwds,
"|ii", (
char **)kwlist_2, &first, &second))
68 self->id =
new Id(first, second);
71 PyErr_SetString(PyExc_TypeError,
"invalid argument(s)");
80 Py_TYPE(
self)->tp_free((PyObject *)
self);
85 return PyUnicode_FromFormat(
86 "[ first: %i, second: %i ](BPy_Id)",
self->id->getFirst(),
self->id->getSecond());
113 "The first number constituting the Id.\n"
119 return PyLong_FromLong(
self->id->getFirst());
125 if ((scalar = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) {
126 PyErr_SetString(PyExc_TypeError,
"value must be an integer");
129 self->id->setFirst(scalar);
136 "The second number constituting the Id.\n"
142 return PyLong_FromLong(
self->id->getSecond());
148 if ((scalar = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) {
149 PyErr_SetString(PyExc_TypeError,
"value must be an integer");
152 self->id->setSecond(scalar);
159 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
165 PyVarObject_HEAD_INIT(
nullptr, 0)
184 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
PyObject * PyBool_from_bool(bool b)
static int Id_second_set(BPy_Id *self, PyObject *value, void *)
static int Id_first_set(BPy_Id *self, PyObject *value, void *)
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 PyObject * Id_repr(BPy_Id *self)
static PyGetSetDef BPy_Id_getseters[]
static PyObject * Id_second_get(BPy_Id *self, void *)
static PyObject * Id_first_get(BPy_Id *self, void *)
int Id_Init(PyObject *module)
static PyObject * Id_RichCompare(BPy_Id *o1, BPy_Id *o2, int opid)
static struct PyModuleDef module
PyObject_HEAD Freestyle::Id * id