diff options
Diffstat (limited to 'src/libs/client/PatchModel.cpp')
-rw-r--r-- | src/libs/client/PatchModel.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/libs/client/PatchModel.cpp b/src/libs/client/PatchModel.cpp index a0f0aa4b..b47bd4f4 100644 --- a/src/libs/client/PatchModel.cpp +++ b/src/libs/client/PatchModel.cpp @@ -188,5 +188,28 @@ PatchModel::polyphonic() const } +unsigned +PatchModel::child_name_offset(const string& base_name) const +{ + assert(Path::is_valid_name(base_name)); + unsigned offset = 0; + + while (true) { + std::stringstream ss; + ss << base_name; + if (offset > 0) + ss << "_" << offset; + if (!find_child(ss.str())) + break; + else if (offset == 0) + offset = 2; + else + ++offset; + } + + return offset; +} + + } // namespace Client } // namespace Ingen |