diff options
author | David Robillard <d@drobilla.net> | 2008-08-17 23:00:34 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-08-17 23:00:34 +0000 |
commit | 14401d11e598651e7caf39cce884362e58ef5941 (patch) | |
tree | 05b2c57b1f55640149ba850a2f9f1fda175dccb8 /src/libs/shared/Store.cpp | |
parent | 9938fac4b15f8939c9056c16a3a7662575af52e1 (diff) | |
download | ingen-14401d11e598651e7caf39cce884362e58ef5941.tar.gz ingen-14401d11e598651e7caf39cce884362e58ef5941.tar.bz2 ingen-14401d11e598651e7caf39cce884362e58ef5941.zip |
Copy/paste of connections.
git-svn-id: http://svn.drobilla.net/lad/ingen@1426 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/shared/Store.cpp')
-rw-r--r-- | src/libs/shared/Store.cpp | 23 |
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 |