summaryrefslogtreecommitdiff
path: root/src/option_types.hh
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-03-07 01:12:37 +0000
committerMaxime Coste <mawww@kakoune.org>2017-03-07 01:12:37 +0000
commitf0ae0b84102a0cb7d0dda0b8b7b1ba425d5d6eb7 (patch)
tree0a38687f1796139771873cd760192af747baf4b4 /src/option_types.hh
parent6373338c50a9431de7440b9274a079b4dc6c5755 (diff)
Replace IdMap with HashMap
Diffstat (limited to 'src/option_types.hh')
-rw-r--r--src/option_types.hh39
1 files changed, 0 insertions, 39 deletions
diff --git a/src/option_types.hh b/src/option_types.hh
index 3d9548f9..d9dc7db7 100644
--- a/src/option_types.hh
+++ b/src/option_types.hh
@@ -6,7 +6,6 @@
#include "units.hh"
#include "coord.hh"
#include "array_view.hh"
-#include "id_map.hh"
#include "hash_map.hh"
#include "flags.hh"
#include "enum.hh"
@@ -107,44 +106,6 @@ struct option_type_name<Vector<T, D>>
static String name() { return option_type_name<T>::name() + StringView{"-list"}; }
};
-template<typename Value, MemoryDomain domain>
-String option_to_string(const IdMap<Value, domain>& opt)
-{
- String res;
- for (auto it = begin(opt); it != end(opt); ++it)
- {
- if (it != begin(opt))
- res += list_separator;
- String elem = escape(option_to_string(it->key), '=', '\\') + "=" +
- escape(option_to_string(it->value), '=', '\\');
- res += escape(elem, list_separator, '\\');
- }
- return res;
-}
-
-template<typename Value, MemoryDomain domain>
-void option_from_string(StringView str, IdMap<Value, domain>& opt)
-{
- opt.clear();
- for (auto& elem : split(str, list_separator, '\\'))
- {
- Vector<String> pair_str = split(elem, '=', '\\');
- if (pair_str.size() != 2)
- throw runtime_error("map option expects key=value");
- String key;
- Value value;
- option_from_string(pair_str[0], key);
- option_from_string(pair_str[1], value);
- opt.append({ std::move(key), std::move(value) });
- }
-}
-
-template<typename T, MemoryDomain D>
-struct option_type_name<IdMap<T, D>>
-{
- static String name() { return format("str-to-{}-map", option_type_name<T>::name()); }
-};
-
template<typename Key, typename Value, MemoryDomain domain>
String option_to_string(const HashMap<Key, Value, domain>& opt)
{