summaryrefslogtreecommitdiffstats
path: root/src/sp-root.cpp
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-root.cpp
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-root.cpp')
-rw-r--r--src/sp-root.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/sp-root.cpp b/src/sp-root.cpp
index 98eae2159..cfd0ced10 100644
--- a/src/sp-root.cpp
+++ b/src/sp-root.cpp
@@ -73,9 +73,9 @@ void SPRoot::build(SPDocument *document, Inkscape::XML::Node *repr)
SPGroup::build(document, repr);
// Search for first <defs> node
- for (SPObject *o = this->firstChild() ; o ; o = o->getNext()) {
- if (SP_IS_DEFS(o)) {
- this->defs = SP_DEFS(o);
+ for (auto& o: _children) {
+ if (SP_IS_DEFS(&o)) {
+ this->defs = SP_DEFS(&o);
break;
}
}
@@ -174,9 +174,9 @@ void SPRoot::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
if (co && SP_IS_DEFS(co)) {
// We search for first <defs> node - it is not beautiful, but works
- for (SPObject *c = this->firstChild() ; c ; c = c->getNext()) {
- if (SP_IS_DEFS(c)) {
- this->defs = SP_DEFS(c);
+ for (auto& c: _children) {
+ if (SP_IS_DEFS(&c)) {
+ this->defs = SP_DEFS(&c);
break;
}
}
@@ -189,7 +189,8 @@ void SPRoot::remove_child(Inkscape::XML::Node *child)
SPObject *iter = 0;
// We search for first remaining <defs> node - it is not beautiful, but works
- for (iter = this->firstChild() ; iter ; iter = iter->getNext()) {
+ for (auto& child: _children) {
+ iter = &child;
if (SP_IS_DEFS(iter) && (SPDefs *)iter != this->defs) {
this->defs = (SPDefs *)iter;
break;