mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-25 07:09:48 -06:00
Config/Layer: Allow all keys of a section to be iterated over
This commit is contained in:
@ -98,6 +98,18 @@ void Layer::DeleteAllKeys()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Section Layer::GetSection(System system, const std::string& section)
|
||||||
|
{
|
||||||
|
return Section{m_map.lower_bound(ConfigLocation{system, section, ""}),
|
||||||
|
m_map.lower_bound(ConfigLocation{system, section + '\001', ""})};
|
||||||
|
}
|
||||||
|
|
||||||
|
ConstSection Layer::GetSection(System system, const std::string& section) const
|
||||||
|
{
|
||||||
|
return ConstSection{m_map.lower_bound(ConfigLocation{system, section, ""}),
|
||||||
|
m_map.lower_bound(ConfigLocation{system, section + '\001', ""})};
|
||||||
|
}
|
||||||
|
|
||||||
void Layer::Load()
|
void Layer::Load()
|
||||||
{
|
{
|
||||||
if (m_loader)
|
if (m_loader)
|
||||||
|
@ -62,6 +62,30 @@ private:
|
|||||||
const LayerType m_layer;
|
const LayerType m_layer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Section
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using iterator = LayerMap::iterator;
|
||||||
|
Section(iterator begin_, iterator end_) : m_begin(begin_), m_end(end_) {}
|
||||||
|
iterator begin() const { return m_begin; }
|
||||||
|
iterator end() const { return m_end; }
|
||||||
|
private:
|
||||||
|
iterator m_begin;
|
||||||
|
iterator m_end;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ConstSection
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using iterator = LayerMap::const_iterator;
|
||||||
|
ConstSection(iterator begin_, iterator end_) : m_begin(begin_), m_end(end_) {}
|
||||||
|
iterator begin() const { return m_begin; }
|
||||||
|
iterator end() const { return m_end; }
|
||||||
|
private:
|
||||||
|
iterator m_begin;
|
||||||
|
iterator m_end;
|
||||||
|
};
|
||||||
|
|
||||||
class Layer
|
class Layer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -106,6 +130,9 @@ public:
|
|||||||
current_value = new_value;
|
current_value = new_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Section GetSection(System system, const std::string& section);
|
||||||
|
ConstSection GetSection(System system, const std::string& section) const;
|
||||||
|
|
||||||
// Explicit load and save of layers
|
// Explicit load and save of layers
|
||||||
void Load();
|
void Load();
|
||||||
void Save();
|
void Save();
|
||||||
|
Reference in New Issue
Block a user