From 7db682e5033001771e1944e6cf82e52da9e0329f Mon Sep 17 00:00:00 2001 From: Chris Punches Date: Fri, 9 Jun 2017 00:46:05 -0400 Subject: [PATCH] conf reimpl --- .idea/workspace.xml | 64 +++++++++++++++++++++++++------------------- src/loaders/Conf.cpp | 12 ++++++--- src/loaders/Conf.h | 4 +-- 3 files changed, 46 insertions(+), 34 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 0612696..1548331 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -15,10 +15,8 @@ - - - + @@ -548,12 +556,12 @@ - + - @@ -887,14 +895,6 @@ - - - - - - - - @@ -1069,17 +1069,9 @@ - - - - - - - - - + @@ -1095,5 +1087,21 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/loaders/Conf.cpp b/src/loaders/Conf.cpp index bfcaeae..e4c5c5a 100644 --- a/src/loaders/Conf.cpp +++ b/src/loaders/Conf.cpp @@ -2,18 +2,22 @@ Conf::Conf( std::string filename ): JSON_Loader() { + // Conf is always loaded from file. this->load_json_file( filename, true ); - this->plan_path = this->get_key("plan_path", true, false).asString(); - this->units_path = this->get_key("units_path", true, false).asString(); + // always load plan_path, it is required to function. + this->get_key( this->plan_path, "plan_path", true, false ); + + // always load units_path, it is required to function. + this->get_key( this->units_path, "units_path", true, false ); }; std::string Conf::get_plan_path() { - return this->plan_path; + return this->plan_path.asString(); } std::string Conf::get_units_path() { - return this->units_path; + return this->units_path.asString(); } diff --git a/src/loaders/Conf.h b/src/loaders/Conf.h index bf38ec2..6bacb77 100644 --- a/src/loaders/Conf.h +++ b/src/loaders/Conf.h @@ -9,8 +9,8 @@ class Conf: public JSON_Loader { private: - std::string plan_path; - std::string units_path; + Json::Value plan_path; + Json::Value units_path; public: Conf( std::string filename );