From cffb895797998f18bbf80c1f1e67c44f511c51cf Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 25 Jun 2012 19:11:13 +0200 Subject: [PATCH] remove ugly id_to_str param in idvaluemap and str_to_str --- src/filter_group.cc | 4 ++-- src/filter_registry.cc | 2 +- src/highlighter_group.cc | 4 ++-- src/highlighter_registry.cc | 2 +- src/idvaluemap.hh | 8 +++----- src/utils.hh | 5 ----- 6 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/filter_group.cc b/src/filter_group.cc index bf5839ac..2dfe0684 100644 --- a/src/filter_group.cc +++ b/src/filter_group.cc @@ -41,13 +41,13 @@ FilterGroup& FilterGroup::get_group(const String& id) CandidateList FilterGroup::complete_id(const String& prefix, size_t cursor_pos) { - return m_filters.complete_id(prefix, cursor_pos); + return m_filters.complete_id(prefix, cursor_pos); } CandidateList FilterGroup::complete_group_id(const String& prefix, size_t cursor_pos) { - return m_filters.complete_id_if( + return m_filters.complete_id_if( prefix, cursor_pos, [](std::pair& func) { return func.second.target() != nullptr; }); diff --git a/src/filter_registry.cc b/src/filter_registry.cc index 3a54954f..a2a08266 100644 --- a/src/filter_registry.cc +++ b/src/filter_registry.cc @@ -33,7 +33,7 @@ void FilterRegistry::add_filter_to_group(FilterGroup& group, CandidateList FilterRegistry::complete_filter(const String& prefix, size_t cursor_pos) { - return m_factories.complete_id(prefix, cursor_pos); + return m_factories.complete_id(prefix, cursor_pos); } } diff --git a/src/highlighter_group.cc b/src/highlighter_group.cc index 2c86c62f..5203f2a6 100644 --- a/src/highlighter_group.cc +++ b/src/highlighter_group.cc @@ -41,13 +41,13 @@ HighlighterGroup& HighlighterGroup::get_group(const String& id) CandidateList HighlighterGroup::complete_id(const String& prefix, size_t cursor_pos) { - return m_highlighters.complete_id(prefix, cursor_pos); + return m_highlighters.complete_id(prefix, cursor_pos); } CandidateList HighlighterGroup::complete_group_id(const String& prefix, size_t cursor_pos) { - return m_highlighters.complete_id_if( + return m_highlighters.complete_id_if( prefix, cursor_pos, [](std::pair& func) { return func.second.target() != nullptr; }); diff --git a/src/highlighter_registry.cc b/src/highlighter_registry.cc index bd0a57b7..b2ca4e97 100644 --- a/src/highlighter_registry.cc +++ b/src/highlighter_registry.cc @@ -35,7 +35,7 @@ void HighlighterRegistry::add_highlighter_to_group(Window& window, CandidateList HighlighterRegistry::complete_highlighter(const String& prefix, size_t cursor_pos) { - return m_factories.complete_id(prefix, cursor_pos); + return m_factories.complete_id(prefix, cursor_pos); } } diff --git a/src/idvaluemap.hh b/src/idvaluemap.hh index a6eb315d..f6627872 100644 --- a/src/idvaluemap.hh +++ b/src/idvaluemap.hh @@ -63,8 +63,7 @@ public: } } - template + template CandidateList complete_id_if(const String& prefix, size_t cursor_pos, _Condition condition) @@ -76,18 +75,17 @@ public: if (not condition(value)) continue; - String id_str = id_to_string(value.first); + String id_str = value.first; if (id_str.substr(0, real_prefix.length()) == real_prefix) result.push_back(std::move(id_str)); } return result; } - template CandidateList complete_id(const String& prefix, size_t cursor_pos) { - return complete_id_if( + return complete_id_if( prefix, cursor_pos, [](const value_type&) { return true; }); } diff --git a/src/utils.hh b/src/utils.hh index ebde984f..e6d37cb8 100644 --- a/src/utils.hh +++ b/src/utils.hh @@ -117,11 +117,6 @@ bool operator== (const std::unique_ptr& lhs, T* rhs) return lhs.get() == rhs; } -inline String str_to_str(const String& str) -{ - return str; -} - } #endif // utils_hh_INCLUDED