Use a id_map implementation for SwitchMap

That way parameter definition order is respected when writing
command doc strings.
This commit is contained in:
Maxime Coste 2014-06-05 23:49:52 +01:00
parent 1533a28394
commit ffd860c1da
2 changed files with 7 additions and 3 deletions

View File

@ -18,6 +18,9 @@ public:
using iterator = typename container_type::iterator;
using const_iterator = typename container_type::const_iterator;
id_map() = default;
id_map(std::initializer_list<value_type> val) : m_content{val} {}
void append(const value_type& value)
{
m_content.push_back(value);
@ -91,6 +94,8 @@ public:
prefix, cursor_pos, [](const value_type&) { return true; });
}
bool empty() const { return m_content.empty(); }
iterator begin() { return m_content.begin(); }
iterator end() { return m_content.end(); }
const_iterator begin() const { return m_content.begin(); }

View File

@ -2,11 +2,10 @@
#define parameters_parser_hh_INCLUDED
#include "exception.hh"
#include "id_map.hh"
#include "memoryview.hh"
#include "string.hh"
#include <unordered_map>
namespace Kakoune
{
@ -40,7 +39,7 @@ struct SwitchDesc
String description;
};
using SwitchMap = std::unordered_map<String, SwitchDesc>;
using SwitchMap = id_map<SwitchDesc>;
String generate_switches_doc(const SwitchMap& opts);