diff options
| author | Adrian Boguszewski <adrbogus1@student.pg.gda.pl> | 2016-07-13 11:36:19 +0000 |
|---|---|---|
| committer | Adrian Boguszewski <adrbogus1@student.pg.gda.pl> | 2016-07-13 11:36:19 +0000 |
| commit | d1947e768272c703674129d5c583204ff2b59251 (patch) | |
| tree | c1bf1563d0c0837cbab3733c18df0c7c82b18ff4 /src/sp-object.h | |
| parent | Merged trunk (diff) | |
| download | inkscape-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.h | 9 |
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 }; |
