diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-04-21 10:50:09 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-04-21 10:50:09 +0100 |
| commit | 8beda67fae3a57b450139037715122016bde2319 (patch) | |
| tree | 17a3e8033c123595f206af0dd9a04a2789a2614a /src/function_group.hh | |
| parent | a1ec45d91a2fb3c82d4677ba2b82b28acfd8570d (diff) | |
Use StringView in FunctionGroup and FunctionRegistry
Diffstat (limited to 'src/function_group.hh')
| -rw-r--r-- | src/function_group.hh | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/function_group.hh b/src/function_group.hh index 3bac5159..025a8f92 100644 --- a/src/function_group.hh +++ b/src/function_group.hh @@ -33,23 +33,23 @@ public: m_functions.append(std::forward<FunctionAndId>(function)); } - void remove(const String& id) + void remove(StringView id) { m_functions.remove(id); } - FunctionGroup& get_group(const String& path, Codepoint path_separator = 0) + FunctionGroup& get_group(StringView path, Codepoint path_separator = 0) { auto sep_it = std::find(path.begin(), path.end(), path_separator); - String id(path.begin(), sep_it); + StringView id(path.begin(), sep_it); auto it = m_functions.find(id); if (it == m_functions.end()) - throw group_not_found("no such id: " + id); + throw group_not_found("no such id: "_str + id); FunctionGroup* group = it->second.template target<FunctionGroup>(); if (not group) - throw group_not_found("not a group: " + id); + throw group_not_found("not a group: "_str + id); if (sep_it != path.end()) - return group->get_group(String(sep_it+1, path.end()), path_separator); + return group->get_group(StringView(sep_it+1, path.end()), path_separator); else return *group; } |
