diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-01-11 19:33:38 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2018-01-11 20:59:33 +0100 |
commit | aee178901d8bd03f9e0aeb50e3a5ed7570d9f910 (patch) | |
tree | 5421f51aebca24dd14b7b09e4b310ca2f1313983 /include | |
parent | b2b12abc4073c981a7fd856bc5071da887f98e43 (diff) |
Start with config object types, for git dependencies
Diffstat (limited to 'include')
-rw-r--r-- | include/Conf.hpp | 18 |
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; |