summaryrefslogtreecommitdiffstats
path: root/src/sp-object.cpp
diff options
context:
space:
mode:
authorJabiertxof <jtx@jtx>2017-01-05 19:03:50 +0000
committerJabiertxof <jtx@jtx>2017-01-05 19:03:50 +0000
commit7bedd224ace433cf4c1a829ba38f6a3c388227e6 (patch)
treec859469be41c0b1248bd2b3a18560697c120596b /src/sp-object.cpp
parent* [INTL:sk] Slovak translation update (diff)
downloadinkscape-7bedd224ace433cf4c1a829ba38f6a3c388227e6.tar.gz
inkscape-7bedd224ace433cf4c1a829ba38f6a3c388227e6.zip
Adding base
(bzr r15392.1.1)
Diffstat (limited to 'src/sp-object.cpp')
-rw-r--r--src/sp-object.cpp15
1 files changed, 15 insertions, 0 deletions
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<SPObject*> 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);