aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Conf.hpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/Conf.hpp b/include/Conf.hpp
index 0b97960..90f150a 100644
--- a/include/Conf.hpp
+++ b/include/Conf.hpp
@@ -21,7 +21,8 @@ namespace sibs
{
NONE,
SINGLE,
- LIST
+ LIST,
+ OBJECT
};
ConfigValue() : type(Type::NONE) {}
@@ -38,9 +39,17 @@ namespace sibs
{
}
+
+ ConfigValue(const std::unordered_map<std::string, StringView> &_map) :
+ type(Type::OBJECT),
+ map(_map)
+ {
+
+ }
bool isSingle() const { return type == Type::SINGLE; }
bool isList() const { return type == Type::LIST; }
+ bool isObject() const { return type == Type::OBJECT; }
StringView asSingle() const
{
@@ -53,9 +62,16 @@ namespace sibs
assert(isList());
return values;
}
+
+ const std::unordered_map<std::string, StringView>& asObject() const
+ {
+ assert(isObject());
+ return map;
+ }
private:
Type type;
std::vector<StringView> values;
+ std::unordered_map<std::string, StringView> map;
};
class Parser;