summaryrefslogtreecommitdiffstats
path: root/src/libs/shared/Store.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/shared/Store.cpp')
-rw-r--r--src/libs/shared/Store.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/libs/shared/Store.cpp b/src/libs/shared/Store.cpp
index f77be312..fea18b6d 100644
--- a/src/libs/shared/Store.cpp
+++ b/src/libs/shared/Store.cpp
@@ -78,6 +78,29 @@ Store::find_child(SharedPtr<Shared::GraphObject> parent, const string& child_nam
else
return SharedPtr<Shared::GraphObject>();
}
+
+
+unsigned
+Store::child_name_offset(const Raul::Path& parent,
+ const Raul::Symbol& symbol)
+{
+ unsigned offset = 0;
+
+ while (true) {
+ std::stringstream ss;
+ ss << symbol;
+ if (offset > 0)
+ ss << "_" << offset;
+ if (find(parent.base() + ss.str()) == end())
+ break;
+ else if (offset == 0)
+ offset = 2;
+ else
+ ++offset;
+ }
+
+ return offset;
+}
} // namespace Shared