From d1b82d1f15a04a7c2383f0689ceede94971f4b81 Mon Sep 17 00:00:00 2001 From: Maxime Curioni Date: Wed, 23 Jul 2008 10:19:08 +0000 Subject: 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) --- source/blender/freestyle/intern/view_map/ViewMapIterators.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'source/blender/freestyle/intern/view_map/ViewMapIterators.h') diff --git a/source/blender/freestyle/intern/view_map/ViewMapIterators.h b/source/blender/freestyle/intern/view_map/ViewMapIterators.h index 004674ba758..25da503af66 100755 --- a/source/blender/freestyle/intern/view_map/ViewMapIterators.h +++ b/source/blender/freestyle/intern/view_map/ViewMapIterators.h @@ -32,6 +32,8 @@ # define VIEWMAPITERATORS_H #include "ViewMap.h" +#include "../system/Iterator.h" //soc + /**********************************/ /* */ @@ -57,7 +59,7 @@ namespace ViewVertexInternal{ * An instance of an orientedViewEdgeIterator can only * be obtained from a ViewVertex by calling edgesBegin() or edgesEnd(). */ - class orientedViewEdgeIterator + class orientedViewEdgeIterator : Iterator { public: friend class ViewVertex; @@ -204,7 +206,7 @@ namespace ViewVertexInternal{ public: /*! increments.*/ - inline void increment() + virtual inline void increment() { if(_Nature & Nature::T_VERTEX) { @@ -336,11 +338,11 @@ namespace ViewEdgeInternal { _previous_edge = _previous_edge->previousEdge(); } - bool isBegin() const { + virtual bool isBegin() const { return _vertex == _begin; } - bool isEnd() const { + virtual bool isEnd() const { return (!_vertex) || (_vertex == _begin && _previous_edge); } @@ -385,7 +387,7 @@ namespace ViewEdgeInternal { * ::Caution::: the dereferencing operator returns a *pointer* to * the pointed ViewEdge. */ -class ViewEdgeIterator +class ViewEdgeIterator : Iterator { public: -- cgit v1.2.3