From 7fecbddd1fb8b57f9c6efd3204645e33d9b38d09 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 24 Jan 2017 10:32:24 +0100 Subject: update to trunk (bzr r15356.1.18) --- src/sp-object.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/sp-object.cpp') diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 75f4657ef..0dc301c49 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -775,6 +775,21 @@ void SPObject::appendChild(Inkscape::XML::Node *child) { repr->appendChild(child); } +SPObject* SPObject::nthChild(unsigned index) { + g_assert(this->repr); + if (hasChildren()) { + std::vector l; + unsigned counter = 0; + for (auto& child: children) { + if (counter == index) { + return &child; + } + counter++; + } + } + return NULL; +} + void SPObject::addChild(Inkscape::XML::Node *child, Inkscape::XML::Node * prev) { g_assert(this->repr); -- cgit v1.2.3