diff options
author | Tavian Barnes <tavianator@gmail.com> | 2009-07-09 21:03:16 +0000 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2009-07-09 21:03:16 +0000 |
commit | a64f9e671936451d7a3a60191dcca6e37e97e585 (patch) | |
tree | f95182c1fc24b972bd4a7dd5dae4ba6a7175de83 /libdimensionxx/dimensionxx | |
parent | 9a634a53f0d7135ef82e6888a89091db173c7f7f (diff) | |
download | dimension-a64f9e671936451d7a3a60191dcca6e37e97e585.tar.xz |
Implement removing/inserting in the middle of a dmnsn_array*.
Diffstat (limited to 'libdimensionxx/dimensionxx')
-rw-r--r-- | libdimensionxx/dimensionxx/scene.hpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libdimensionxx/dimensionxx/scene.hpp b/libdimensionxx/dimensionxx/scene.hpp index 73cbc2e..acb2cb1 100644 --- a/libdimensionxx/dimensionxx/scene.hpp +++ b/libdimensionxx/dimensionxx/scene.hpp @@ -25,7 +25,7 @@ namespace Dimension { - // Iterator class for scene objects + // Iterator class for scene objects - never invalidated unless removed class Scene_Iterator; // Base scene class. Wraps a dmnsn_scene*. @@ -55,6 +55,7 @@ namespace Dimension Iterator end(); void push_object(Object& object); + void remove_object(Iterator i); // Access the wrapped C object. dmnsn_scene* dmnsn(); @@ -72,8 +73,10 @@ namespace Dimension class Scene_Iterator { + typedef std::list<std::tr1::shared_ptr<Object> >::iterator Iterator; + public: - Scene_Iterator(std::list<std::tr1::shared_ptr<Object> >::iterator i) + Scene_Iterator(Iterator i) : m_i(i) { } // Scene_Iterator(const Scene_Iterator& i); // ~Scene_Iterator(); @@ -91,8 +94,10 @@ namespace Dimension Scene_Iterator& operator--() { --m_i; return *this; } Scene_Iterator operator--(int) { return Scene_Iterator(m_i--); } + Iterator iterator() const { return m_i; } + private: - std::list<std::tr1::shared_ptr<Object> >::iterator m_i; + Iterator m_i; }; } |