diff options
author | Maxime Curioni <maxime.curioni@gmail.com> | 2008-07-23 14:19:08 +0400 |
---|---|---|
committer | Maxime Curioni <maxime.curioni@gmail.com> | 2008-07-23 14:19:08 +0400 |
commit | d1b82d1f15a04a7c2383f0689ceede94971f4b81 (patch) | |
tree | 0c94a3a7fb5c23d144395a75567715a224996c8a /source/blender/freestyle/intern/python/BPy_Iterator.h | |
parent | a9789d90ae7c4408684490844ee9edf37ae84f65 (diff) |
soc-2008-mxcurioni: added Iterator class, base class for all iterators in Freestyle (on the C++ side). Created the equivalent in Python BPy_Iterator with the simple interface:
- getExactTypeName()
- increment()
- decrement()
- isBegin()
- isEnd()
Contrary to previously stated, I am reverting back to implementing iterators in the (Python) API, for different reasons:
- it will make testing quicker to achieve, as I won't have to recode a big chunk of the original Python files
- it will be a base for API refactoring
- it won't prevent the use a list-based approach later (it is simple to get it from the Iterator)
Diffstat (limited to 'source/blender/freestyle/intern/python/BPy_Iterator.h')
-rw-r--r-- | source/blender/freestyle/intern/python/BPy_Iterator.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_Iterator.h b/source/blender/freestyle/intern/python/BPy_Iterator.h new file mode 100644 index 00000000000..0f92c3b7f28 --- /dev/null +++ b/source/blender/freestyle/intern/python/BPy_Iterator.h @@ -0,0 +1,35 @@ +#ifndef FREESTYLE_PYTHON_ITERATOR_H +#define FREESTYLE_PYTHON_ITERATOR_H + +#include "../system/Iterator.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/////////////////////////////////////////////////////////////////////////////////////////// + +#include <Python.h> + +extern PyTypeObject Iterator_Type; + +#define BPy_Iterator_Check(v) (( (PyObject *) v)->ob_type == &Iterator_Type) + +/*---------------------------Python BPy_Iterator structure definition----------*/ +typedef struct { + PyObject_HEAD + Iterator *it; +} BPy_Iterator; + +/*---------------------------Python BPy_Iterator visible prototypes-----------*/ + +PyMODINIT_FUNC Iterator_Init( PyObject *module ); + + +/////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif /* FREESTYLE_PYTHON_ITERATOR_H */ |