diff options
author | dec05eba <dec05eba@protonmail.com> | 2017-12-10 01:10:48 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2017-12-10 01:12:08 +0100 |
commit | 1d3e221a7a20bfd03517e3ae1e35e4a309a69b6a (patch) | |
tree | fdb38039d12cf38e9ac6102118727b78437cf3db /include/Conf.hpp | |
parent | 2ed7d0b09caa872e44e2eb09b09b2387e93f9b34 (diff) |
Add support for dependencies in global lib dir
Global lib dir is located at ~/.sibs/lib
TODO: If global lib dir doesn't exist, download it from github/server
Diffstat (limited to 'include/Conf.hpp')
-rw-r--r-- | include/Conf.hpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/include/Conf.hpp b/include/Conf.hpp index 8b98189..3634f4c 100644 --- a/include/Conf.hpp +++ b/include/Conf.hpp @@ -4,6 +4,7 @@ #include "Result.hpp" #include "StringView.hpp" #include "utils.hpp" +#include "Dependency.hpp" #include <vector> #include <cassert> #include <stdexcept> @@ -79,6 +80,36 @@ namespace sibs public: static Result<bool> readFromFile(const char *filepath, const ConfigCallback &callback); }; + + class SibsConfig : public ConfigCallback + { + public: + SibsConfig() : finishedProcessing(false) {} + + const std::string& getPackageName() const + { + assert(finishedProcessing); + return packageName; + } + + const std::vector<Dependency>& getDependencies() const + { + return dependencies; + } + protected: + void processObject(StringView name) override; + void processField(StringView name, const ConfigValue &value) override; + + void finished() override + { + finishedProcessing = true; + } + private: + StringView currentObject; + std::string packageName; + std::vector<Dependency> dependencies; + bool finishedProcessing; + }; } #endif //SIBS_CONF_HPP |