Use a id_map implementation for SwitchMap
That way parameter definition order is respected when writing command doc strings.
This commit is contained in:
parent
1533a28394
commit
ffd860c1da
|
@ -18,6 +18,9 @@ public:
|
||||||
using iterator = typename container_type::iterator;
|
using iterator = typename container_type::iterator;
|
||||||
using const_iterator = typename container_type::const_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)
|
void append(const value_type& value)
|
||||||
{
|
{
|
||||||
m_content.push_back(value);
|
m_content.push_back(value);
|
||||||
|
@ -91,6 +94,8 @@ public:
|
||||||
prefix, cursor_pos, [](const value_type&) { return true; });
|
prefix, cursor_pos, [](const value_type&) { return true; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool empty() const { return m_content.empty(); }
|
||||||
|
|
||||||
iterator begin() { return m_content.begin(); }
|
iterator begin() { return m_content.begin(); }
|
||||||
iterator end() { return m_content.end(); }
|
iterator end() { return m_content.end(); }
|
||||||
const_iterator begin() const { return m_content.begin(); }
|
const_iterator begin() const { return m_content.begin(); }
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
#define parameters_parser_hh_INCLUDED
|
#define parameters_parser_hh_INCLUDED
|
||||||
|
|
||||||
#include "exception.hh"
|
#include "exception.hh"
|
||||||
|
#include "id_map.hh"
|
||||||
#include "memoryview.hh"
|
#include "memoryview.hh"
|
||||||
#include "string.hh"
|
#include "string.hh"
|
||||||
|
|
||||||
#include <unordered_map>
|
|
||||||
|
|
||||||
namespace Kakoune
|
namespace Kakoune
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -40,7 +39,7 @@ struct SwitchDesc
|
||||||
String description;
|
String description;
|
||||||
};
|
};
|
||||||
|
|
||||||
using SwitchMap = std::unordered_map<String, SwitchDesc>;
|
using SwitchMap = id_map<SwitchDesc>;
|
||||||
|
|
||||||
String generate_switches_doc(const SwitchMap& opts);
|
String generate_switches_doc(const SwitchMap& opts);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user