From d1947e768272c703674129d5c583204ff2b59251 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 13 Jul 2016 13:36:19 +0200 Subject: Second part of new SPObject children list (bzr r14954.1.19) --- src/sp-hatch.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/sp-hatch.cpp') diff --git a/src/sp-hatch.cpp b/src/sp-hatch.cpp index 2d938618c..c06045e8f 100644 --- a/src/sp-hatch.cpp +++ b/src/sp-hatch.cpp @@ -233,14 +233,13 @@ void SPHatch::set(unsigned int key, const gchar* value) bool SPHatch::_hasHatchPatchChildren(SPHatch const *hatch) { - bool matched = false; - for (SPObject const *child = hatch->firstChild(); child && !matched; child = child->getNext() ) { - SPHatchPath const *hatchPath = dynamic_cast(child); + for (auto& child: hatch->_children) { + SPHatchPath const *hatchPath = dynamic_cast(&child); if (hatchPath) { - matched = true; + return true; } } - return matched; + return false; } std::vector SPHatch::hatchPaths() @@ -249,8 +248,8 @@ std::vector SPHatch::hatchPaths() SPHatch *src = chase_hrefs(this, sigc::ptr_fun(&_hasHatchPatchChildren)); if (src) { - for (SPObject *child = src->firstChild(); child; child = child->getNext()) { - SPHatchPath *hatchPath = dynamic_cast(child); + for (auto& child: src->_children) { + SPHatchPath *hatchPath = dynamic_cast(&child); if (hatchPath) { list.push_back(hatchPath); } @@ -265,8 +264,8 @@ std::vector SPHatch::hatchPaths() const SPHatch const *src = chase_hrefs(this, sigc::ptr_fun(&_hasHatchPatchChildren)); if (src) { - for (SPObject const *child = src->firstChild(); child; child = child->getNext()) { - SPHatchPath const *hatchPath = dynamic_cast(child); + for (auto& child: src->_children) { + SPHatchPath const *hatchPath = dynamic_cast(&child); if (hatchPath) { list.push_back(hatchPath); } -- cgit v1.2.3 From 24d3f50003ca3cec6a03a7f5267cc4fe5588c69f Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 14 Jul 2016 13:17:21 +0200 Subject: Renamed children list in SPObject (bzr r14954.1.21) --- src/sp-hatch.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/sp-hatch.cpp') diff --git a/src/sp-hatch.cpp b/src/sp-hatch.cpp index c06045e8f..f667017fa 100644 --- a/src/sp-hatch.cpp +++ b/src/sp-hatch.cpp @@ -233,7 +233,7 @@ void SPHatch::set(unsigned int key, const gchar* value) bool SPHatch::_hasHatchPatchChildren(SPHatch const *hatch) { - for (auto& child: hatch->_children) { + for (auto& child: hatch->children) { SPHatchPath const *hatchPath = dynamic_cast(&child); if (hatchPath) { return true; @@ -248,7 +248,7 @@ std::vector SPHatch::hatchPaths() SPHatch *src = chase_hrefs(this, sigc::ptr_fun(&_hasHatchPatchChildren)); if (src) { - for (auto& child: src->_children) { + for (auto& child: src->children) { SPHatchPath *hatchPath = dynamic_cast(&child); if (hatchPath) { list.push_back(hatchPath); @@ -264,7 +264,7 @@ std::vector SPHatch::hatchPaths() const SPHatch const *src = chase_hrefs(this, sigc::ptr_fun(&_hasHatchPatchChildren)); if (src) { - for (auto& child: src->_children) { + for (auto& child: src->children) { SPHatchPath const *hatchPath = dynamic_cast(&child); if (hatchPath) { list.push_back(hatchPath); -- cgit v1.2.3