diff options
Diffstat (limited to 'lib/configuration/configuration.h')
-rw-r--r-- | lib/configuration/configuration.h | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/lib/configuration/configuration.h b/lib/configuration/configuration.h index af75122..1d0fb54 100644 --- a/lib/configuration/configuration.h +++ b/lib/configuration/configuration.h @@ -23,8 +23,17 @@ public: explicit Configuration(); ~Configuration(); - bool parseConfigFile(const std::string &path); - bool parseCommandLine(int argc, char **argv); + bool parse(const std::string &path); + bool parse(int argc, char **argv); + + const std::vector<boost::shared_ptr<boost::program_options::option_description>> &options() + { + return configuration_desc.options(); + } + + bool exists(const char *path) { + return vm.count(path) ? true : false; + } template <typename T> std::optional<T> value(const char *path) const @@ -64,12 +73,6 @@ public: return std::optional<T>(vm[path].as<T>()); } - const std::vector<boost::shared_ptr<boost::program_options::option_description>> &options() - { - return configuration_desc.options(); - } - - QHash<QString, QString> section(const std::string &prefix) const; QStringList positionalArguments() const { QStringList l; @@ -82,6 +85,16 @@ public: return l; } + QHash<QString, QString> section(const std::string &prefix) const; + const boost::program_options::options_description commandlineOptions() const + { + return commandLine_desc; + } + const boost::program_options::options_description configurationOptions() const + { + return configuration_desc; + } + private: boost::program_options::options_description commandLine_desc; boost::program_options::options_description configuration_desc; |