Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp')
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp301
1 files changed, 160 insertions, 141 deletions
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
index f8bae0e5aca..6b23ffadffb 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
@@ -31,179 +31,198 @@ extern "C" {
//------------------------INSTANCE METHODS ----------------------------------
-PyDoc_STRVAR(AdjacencyIterator_doc,
-"Class hierarchy: :class:`Iterator` > :class:`AdjacencyIterator`\n"
-"\n"
-"Class for representing adjacency iterators used in the chaining\n"
-"process. An AdjacencyIterator is created in the increment() and\n"
-"decrement() methods of a :class:`ChainingIterator` and passed to the\n"
-"traverse() method of the ChainingIterator.\n"
-"\n"
-".. method:: __init__()\n"
-"\n"
-" Default constructor.\n"
-"\n"
-".. method:: __init__(brother)\n"
-"\n"
-" Copy constructor.\n"
-"\n"
-" :arg brother: An AdjacencyIterator object.\n"
-" :type brother: :class:`AdjacencyIterator`\n"
-"\n"
-".. method:: __init__(vertex, restrict_to_selection=True, restrict_to_unvisited=True)\n"
-"\n"
-" Builds a AdjacencyIterator object.\n"
-"\n"
-" :arg vertex: The vertex which is the next crossing.\n"
-" :type vertex: :class:`ViewVertex`\n"
-" :arg restrict_to_selection: Indicates whether to force the chaining\n"
-" to stay within the set of selected ViewEdges or not.\n"
-" :type restrict_to_selection: bool\n"
-" :arg restrict_to_unvisited: Indicates whether a ViewEdge that has\n"
-" already been chained must be ignored ot not.\n"
-" :type restrict_to_unvisited: bool");
+PyDoc_STRVAR(
+ AdjacencyIterator_doc,
+ "Class hierarchy: :class:`Iterator` > :class:`AdjacencyIterator`\n"
+ "\n"
+ "Class for representing adjacency iterators used in the chaining\n"
+ "process. An AdjacencyIterator is created in the increment() and\n"
+ "decrement() methods of a :class:`ChainingIterator` and passed to the\n"
+ "traverse() method of the ChainingIterator.\n"
+ "\n"
+ ".. method:: __init__()\n"
+ "\n"
+ " Default constructor.\n"
+ "\n"
+ ".. method:: __init__(brother)\n"
+ "\n"
+ " Copy constructor.\n"
+ "\n"
+ " :arg brother: An AdjacencyIterator object.\n"
+ " :type brother: :class:`AdjacencyIterator`\n"
+ "\n"
+ ".. method:: __init__(vertex, restrict_to_selection=True, restrict_to_unvisited=True)\n"
+ "\n"
+ " Builds a AdjacencyIterator object.\n"
+ "\n"
+ " :arg vertex: The vertex which is the next crossing.\n"
+ " :type vertex: :class:`ViewVertex`\n"
+ " :arg restrict_to_selection: Indicates whether to force the chaining\n"
+ " to stay within the set of selected ViewEdges or not.\n"
+ " :type restrict_to_selection: bool\n"
+ " :arg restrict_to_unvisited: Indicates whether a ViewEdge that has\n"
+ " already been chained must be ignored ot not.\n"
+ " :type restrict_to_unvisited: bool");
static int AdjacencyIterator_init(BPy_AdjacencyIterator *self, PyObject *args, PyObject *kwds)
{
- static const char *kwlist_1[] = {"brother", NULL};
- static const char *kwlist_2[] = {"vertex", "restrict_to_selection", "restrict_to_unvisited", NULL};
- PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0;
-
- if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &AdjacencyIterator_Type, &obj1)) {
- if (!obj1) {
- self->a_it = new AdjacencyIterator();
- self->at_start = true;
- }
- else {
- self->a_it = new AdjacencyIterator(*(((BPy_AdjacencyIterator *)obj1)->a_it));
- self->at_start = ((BPy_AdjacencyIterator *)obj1)->at_start;
- }
- }
- else if (PyErr_Clear(), (obj2 = obj3 = 0),
- PyArg_ParseTupleAndKeywords(args, kwds, "O!|O!O!", (char **)kwlist_2,
- &ViewVertex_Type, &obj1, &PyBool_Type, &obj2, &PyBool_Type, &obj3))
- {
- bool restrictToSelection = (!obj2) ? true : bool_from_PyBool(obj2);
- bool restrictToUnvisited = (!obj3) ? true : bool_from_PyBool(obj3);
- self->a_it = new AdjacencyIterator(((BPy_ViewVertex *)obj1)->vv, restrictToSelection, restrictToUnvisited);
- self->at_start = ((BPy_AdjacencyIterator *)obj1)->at_start;
- }
- else {
- PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
- return -1;
- }
- self->py_it.it = self->a_it;
- return 0;
+ static const char *kwlist_1[] = {"brother", NULL};
+ static const char *kwlist_2[] = {
+ "vertex", "restrict_to_selection", "restrict_to_unvisited", NULL};
+ PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0;
+
+ if (PyArg_ParseTupleAndKeywords(
+ args, kwds, "|O!", (char **)kwlist_1, &AdjacencyIterator_Type, &obj1)) {
+ if (!obj1) {
+ self->a_it = new AdjacencyIterator();
+ self->at_start = true;
+ }
+ else {
+ self->a_it = new AdjacencyIterator(*(((BPy_AdjacencyIterator *)obj1)->a_it));
+ self->at_start = ((BPy_AdjacencyIterator *)obj1)->at_start;
+ }
+ }
+ else if (PyErr_Clear(),
+ (obj2 = obj3 = 0),
+ PyArg_ParseTupleAndKeywords(args,
+ kwds,
+ "O!|O!O!",
+ (char **)kwlist_2,
+ &ViewVertex_Type,
+ &obj1,
+ &PyBool_Type,
+ &obj2,
+ &PyBool_Type,
+ &obj3)) {
+ bool restrictToSelection = (!obj2) ? true : bool_from_PyBool(obj2);
+ bool restrictToUnvisited = (!obj3) ? true : bool_from_PyBool(obj3);
+ self->a_it = new AdjacencyIterator(
+ ((BPy_ViewVertex *)obj1)->vv, restrictToSelection, restrictToUnvisited);
+ self->at_start = ((BPy_AdjacencyIterator *)obj1)->at_start;
+ }
+ else {
+ PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
+ return -1;
+ }
+ self->py_it.it = self->a_it;
+ return 0;
}
static PyObject *AdjacencyIterator_iter(BPy_AdjacencyIterator *self)
{
- Py_INCREF(self);
- self->at_start = true;
- return (PyObject *) self;
+ Py_INCREF(self);
+ self->at_start = true;
+ return (PyObject *)self;
}
static PyObject *AdjacencyIterator_iternext(BPy_AdjacencyIterator *self)
{
- if (self->a_it->isEnd()) {
- PyErr_SetNone(PyExc_StopIteration);
- return NULL;
- }
- if (self->at_start)
- self->at_start = false;
- else {
- self->a_it->increment();
- if (self->a_it->isEnd()) {
- PyErr_SetNone(PyExc_StopIteration);
- return NULL;
- }
- }
- ViewEdge *ve = self->a_it->operator->();
- return BPy_ViewEdge_from_ViewEdge(*ve);
+ if (self->a_it->isEnd()) {
+ PyErr_SetNone(PyExc_StopIteration);
+ return NULL;
+ }
+ if (self->at_start)
+ self->at_start = false;
+ else {
+ self->a_it->increment();
+ if (self->a_it->isEnd()) {
+ PyErr_SetNone(PyExc_StopIteration);
+ return NULL;
+ }
+ }
+ ViewEdge *ve = self->a_it->operator->();
+ return BPy_ViewEdge_from_ViewEdge(*ve);
}
/*----------------------AdjacencyIterator get/setters ----------------------------*/
PyDoc_STRVAR(AdjacencyIterator_object_doc,
-"The ViewEdge object currently pointed to by this iterator.\n"
-"\n"
-":type: :class:`ViewEdge`");
+ "The ViewEdge object currently pointed to by this iterator.\n"
+ "\n"
+ ":type: :class:`ViewEdge`");
static PyObject *AdjacencyIterator_object_get(BPy_AdjacencyIterator *self, void *UNUSED(closure))
{
- if (self->a_it->isEnd()) {
- PyErr_SetString(PyExc_RuntimeError, "iteration has stopped");
- return NULL;
- }
- ViewEdge *ve = self->a_it->operator*();
- if (ve)
- return BPy_ViewEdge_from_ViewEdge(*ve);
- Py_RETURN_NONE;
+ if (self->a_it->isEnd()) {
+ PyErr_SetString(PyExc_RuntimeError, "iteration has stopped");
+ return NULL;
+ }
+ ViewEdge *ve = self->a_it->operator*();
+ if (ve)
+ return BPy_ViewEdge_from_ViewEdge(*ve);
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(AdjacencyIterator_is_incoming_doc,
-"True if the current ViewEdge is coming towards the iteration vertex, and\n"
-"False otherwise.\n"
-"\n"
-":type: bool");
+ "True if the current ViewEdge is coming towards the iteration vertex, and\n"
+ "False otherwise.\n"
+ "\n"
+ ":type: bool");
-static PyObject *AdjacencyIterator_is_incoming_get(BPy_AdjacencyIterator *self, void *UNUSED(closure))
+static PyObject *AdjacencyIterator_is_incoming_get(BPy_AdjacencyIterator *self,
+ void *UNUSED(closure))
{
- if (self->a_it->isEnd()) {
- PyErr_SetString(PyExc_RuntimeError, "iteration has stopped");
- return NULL;
- }
- return PyBool_from_bool(self->a_it->isIncoming());
+ if (self->a_it->isEnd()) {
+ PyErr_SetString(PyExc_RuntimeError, "iteration has stopped");
+ return NULL;
+ }
+ return PyBool_from_bool(self->a_it->isIncoming());
}
static PyGetSetDef BPy_AdjacencyIterator_getseters[] = {
- {(char *)"is_incoming", (getter)AdjacencyIterator_is_incoming_get, (setter)NULL,
- (char *)AdjacencyIterator_is_incoming_doc, NULL},
- {(char *)"object", (getter)AdjacencyIterator_object_get, (setter)NULL, (char *)AdjacencyIterator_object_doc, NULL},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {(char *)"is_incoming",
+ (getter)AdjacencyIterator_is_incoming_get,
+ (setter)NULL,
+ (char *)AdjacencyIterator_is_incoming_doc,
+ NULL},
+ {(char *)"object",
+ (getter)AdjacencyIterator_object_get,
+ (setter)NULL,
+ (char *)AdjacencyIterator_object_doc,
+ NULL},
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
/*-----------------------BPy_AdjacencyIterator type definition ------------------------------*/
PyTypeObject AdjacencyIterator_Type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- "AdjacencyIterator", /* tp_name */
- sizeof(BPy_AdjacencyIterator), /* tp_basicsize */
- 0, /* tp_itemsize */
- 0, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- AdjacencyIterator_doc, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- (getiterfunc)AdjacencyIterator_iter, /* tp_iter */
- (iternextfunc)AdjacencyIterator_iternext, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- BPy_AdjacencyIterator_getseters, /* tp_getset */
- &Iterator_Type, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- (initproc)AdjacencyIterator_init, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
+ PyVarObject_HEAD_INIT(NULL, 0) "AdjacencyIterator", /* tp_name */
+ sizeof(BPy_AdjacencyIterator), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ 0, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_reserved */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ AdjacencyIterator_doc, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ (getiterfunc)AdjacencyIterator_iter, /* tp_iter */
+ (iternextfunc)AdjacencyIterator_iternext, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ BPy_AdjacencyIterator_getseters, /* tp_getset */
+ &Iterator_Type, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ (initproc)AdjacencyIterator_init, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
};
///////////////////////////////////////////////////////////////////////////////////////////