From 14401d11e598651e7caf39cce884362e58ef5941 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 17 Aug 2008 23:00:34 +0000 Subject: Copy/paste of connections. git-svn-id: http://svn.drobilla.net/lad/ingen@1426 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/shared/Store.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/libs/shared/Store.cpp') 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 parent, const string& child_nam else return SharedPtr(); } + + +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 -- cgit v1.2.1