From 7bedd224ace433cf4c1a829ba38f6a3c388227e6 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Thu, 5 Jan 2017 20:03:50 +0100 Subject: Adding base (bzr r15392.1.1) --- 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 e9c60fc7d..222626162 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -773,6 +773,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