summaryrefslogtreecommitdiffstats
path: root/src/sp-object.h
diff options
context:
space:
mode:
authorAdrian Boguszewski <adrbogus1@student.pg.gda.pl>2016-07-13 11:36:19 +0000
committerAdrian Boguszewski <adrbogus1@student.pg.gda.pl>2016-07-13 11:36:19 +0000
commitd1947e768272c703674129d5c583204ff2b59251 (patch)
treec1bf1563d0c0837cbab3733c18df0c7c82b18ff4 /src/sp-object.h
parentMerged trunk (diff)
downloadinkscape-d1947e768272c703674129d5c583204ff2b59251.tar.gz
inkscape-d1947e768272c703674129d5c583204ff2b59251.zip
Second part of new SPObject children list
(bzr r14954.1.19)
Diffstat (limited to 'src/sp-object.h')
-rw-r--r--src/sp-object.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/sp-object.h b/src/sp-object.h
index 6aa006283..2534b2268 100644
--- a/src/sp-object.h
+++ b/src/sp-object.h
@@ -209,7 +209,6 @@ public:
SPDocument *document; /* Document we are part of */
SPObject *parent; /* Our parent (only one allowed) */
SPObject *children; /* Our children */
- SPObject *_last_child; /* Remembered last child */
SPObject *next; /* Next object in linked list */
private:
@@ -314,11 +313,11 @@ public:
bool hasChildren() const { return ( _children.size() > 0 ); }
- SPObject *firstChild() { return children; }
- SPObject const *firstChild() const { return children; }
+ SPObject *firstChild() { return _children.empty() ? nullptr : &_children.front(); }
+ SPObject const *firstChild() const { return _children.empty() ? nullptr : &_children.front(); }
- SPObject *lastChild() { return _last_child; }
- SPObject const *lastChild() const { return _last_child; }
+ SPObject *lastChild() { return _children.empty() ? nullptr : &_children.back(); }
+ SPObject const *lastChild() const { return _children.empty() ? nullptr : &_children.back(); }
enum Action { ActionGeneral, ActionBBox, ActionUpdate, ActionShow };