diff options
| author | Adrian Boguszewski <adrbogus1@student.pg.gda.pl> | 2016-07-11 12:24:52 +0000 |
|---|---|---|
| committer | Adrian Boguszewski <adrbogus1@student.pg.gda.pl> | 2016-07-11 12:24:52 +0000 |
| commit | 058e95a59ccb2ab1748392acdfdbbffd516c9c81 (patch) | |
| tree | 86e3958aaad129307f45e590269924b14bca303d /src/sp-object.h | |
| parent | Added simple test for SPObject (diff) | |
| download | inkscape-058e95a59ccb2ab1748392acdfdbbffd516c9c81.tar.gz inkscape-058e95a59ccb2ab1748392acdfdbbffd516c9c81.zip | |
First part of new SPObject children list
(bzr r14954.1.17)
Diffstat (limited to 'src/sp-object.h')
| -rw-r--r-- | src/sp-object.h | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/sp-object.h b/src/sp-object.h index 70d3e5df5..6aa006283 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -6,8 +6,9 @@ * Lauris Kaplinski <lauris@kaplinski.com> * Jon A. Cruz <jon@joncruz.org> * Abhishek Sharma + * Adrian Boguszewski * - * Copyright (C) 1999-2002 authors + * Copyright (C) 1999-2016 authors * Copyright (C) 2001-2002 Ximian, Inc. * * Released under GNU GPL, read the file 'COPYING' for more information @@ -53,6 +54,7 @@ class SPObject; #include <sigc++/functors/slot.h> #include <sigc++/signal.h> #include <vector> +#include <boost/intrusive/list.hpp> #include "version.h" #include "util/forward-pointer-iterator.h" @@ -216,6 +218,7 @@ private: char *id; /* Our very own unique id */ Inkscape::XML::Node *repr; /* Our xml representation */ + public: int refCount; std::list<SPObject*> hrefList; @@ -279,17 +282,9 @@ public: return object->parent; } }; - /// Switch containing next() method. - struct SiblingIteratorStrategy { - static SPObject const *next(SPObject const *object) { - return object->next; - } - }; typedef Inkscape::Util::ForwardPointerIterator<SPObject, ParentIteratorStrategy> ParentIterator; typedef Inkscape::Util::ForwardPointerIterator<SPObject const, ParentIteratorStrategy> ConstParentIterator; - typedef Inkscape::Util::ForwardPointerIterator<SPObject, SiblingIteratorStrategy> SiblingIterator; - typedef Inkscape::Util::ForwardPointerIterator<SPObject const, SiblingIteratorStrategy> ConstSiblingIterator; bool isSiblingOf(SPObject const *object) const { if (object == NULL) return false; @@ -317,7 +312,7 @@ public: */ SPObject *getPrev(); - bool hasChildren() const { return ( children != NULL ); } + bool hasChildren() const { return ( _children.size() > 0 ); } SPObject *firstChild() { return children; } SPObject const *firstChild() const { return children; } @@ -681,9 +676,9 @@ public: void attach(SPObject *object, SPObject *prev); /** - * In list of object's siblings, move object behind prev. + * In list of object's children, move object behind prev. */ - void reorder(SPObject *prev); + void reorder(SPObject* obj, SPObject *prev); /** * Remove object from parent's children, release and unref it. @@ -858,7 +853,17 @@ protected: virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, unsigned int flags); + typedef boost::intrusive::list_member_hook<> ListHook; + ListHook _child_hook; public: + typedef boost::intrusive::list< + SPObject, + boost::intrusive::member_hook< + SPObject, + ListHook, + &SPObject::_child_hook + >> ChildrenList; + ChildrenList _children; virtual void read_content(); void recursivePrintTree(unsigned level = 0); // For debugging |
