conf reimpl

master
Chris Punches 2017-06-09 00:46:05 -04:00
parent 3c52f94bfa
commit 7db682e503
3 changed files with 46 additions and 34 deletions

View File

@ -15,10 +15,8 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="50b7ab1f-b700-44ff-b78d-e32f34492ff2" name="Default" comment=""> <list default="true" id="50b7ab1f-b700-44ff-b78d-e32f34492ff2" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/loaders/Conf.cpp" afterPath="$PROJECT_DIR$/src/loaders/Conf.cpp" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/loaders/Conf.cpp" afterPath="$PROJECT_DIR$/src/loaders/Conf.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/loaders/JSON_Loader.cpp" afterPath="$PROJECT_DIR$/src/loaders/JSON_Loader.cpp" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/loaders/Conf.h" afterPath="$PROJECT_DIR$/src/loaders/Conf.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/loaders/JSON_Loader.h" afterPath="$PROJECT_DIR$/src/loaders/JSON_Loader.h" />
</list> </list>
<ignored path="$PROJECT_DIR$/cmake-build-debug/" /> <ignored path="$PROJECT_DIR$/cmake-build-debug/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -76,17 +74,27 @@
<file leaf-file-name="Conf.cpp" pinned="false" current-in-tab="false"> <file leaf-file-name="Conf.cpp" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/loaders/Conf.cpp"> <entry file="file://$PROJECT_DIR$/src/loaders/Conf.cpp">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="108"> <state relative-caret-position="180">
<caret line="6" column="30" lean-forward="false" selection-start-line="6" selection-start-column="30" selection-end-line="6" selection-end-column="30" /> <caret line="10" column="58" lean-forward="true" selection-start-line="10" selection-start-column="58" selection-end-line="10" selection-end-column="58" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="JSON_Loader.cpp" pinned="false" current-in-tab="true"> <file leaf-file-name="Conf.h" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/loaders/Conf.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="12" column="15" lean-forward="false" selection-start-line="12" selection-start-column="15" selection-end-line="12" selection-end-column="15" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="JSON_Loader.cpp" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/loaders/JSON_Loader.cpp"> <entry file="file://$PROJECT_DIR$/src/loaders/JSON_Loader.cpp">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="831"> <state relative-caret-position="777">
<caret line="97" column="37" lean-forward="false" selection-start-line="97" selection-start-column="37" selection-end-line="97" selection-end-column="37" /> <caret line="97" column="37" lean-forward="false" selection-start-line="97" selection-start-column="37" selection-end-line="97" selection-end-column="37" />
<folding> <folding>
<element signature="e#0#2#0" expanded="true" /> <element signature="e#0#2#0" expanded="true" />
@ -137,7 +145,6 @@
<option value="$PROJECT_DIR$/src/loaders/Units.cpp" /> <option value="$PROJECT_DIR$/src/loaders/Units.cpp" />
<option value="$PROJECT_DIR$/src/loaders/Plan.cpp" /> <option value="$PROJECT_DIR$/src/loaders/Plan.cpp" />
<option value="$PROJECT_DIR$/src/loaders/Plan.h" /> <option value="$PROJECT_DIR$/src/loaders/Plan.h" />
<option value="$PROJECT_DIR$/src/loaders/Conf.h" />
<option value="$PROJECT_DIR$/src/loaders/Unit.cpp" /> <option value="$PROJECT_DIR$/src/loaders/Unit.cpp" />
<option value="$PROJECT_DIR$/src/loaders/Unit.h" /> <option value="$PROJECT_DIR$/src/loaders/Unit.h" />
<option value="$PROJECT_DIR$/src/loaders/Suite.h" /> <option value="$PROJECT_DIR$/src/loaders/Suite.h" />
@ -147,9 +154,10 @@
<option value="$PROJECT_DIR$/examplar.cpp" /> <option value="$PROJECT_DIR$/examplar.cpp" />
<option value="$PROJECT_DIR$/src/loaders/JLoader.h" /> <option value="$PROJECT_DIR$/src/loaders/JLoader.h" />
<option value="$PROJECT_DIR$/src/loaders/JLoader.cpp" /> <option value="$PROJECT_DIR$/src/loaders/JLoader.cpp" />
<option value="$PROJECT_DIR$/src/loaders/Conf.cpp" />
<option value="$PROJECT_DIR$/src/loaders/JSON_Loader.cpp" /> <option value="$PROJECT_DIR$/src/loaders/JSON_Loader.cpp" />
<option value="$PROJECT_DIR$/src/loaders/JSON_Loader.h" /> <option value="$PROJECT_DIR$/src/loaders/JSON_Loader.h" />
<option value="$PROJECT_DIR$/src/loaders/Conf.cpp" />
<option value="$PROJECT_DIR$/src/loaders/Conf.h" />
</list> </list>
</option> </option>
</component> </component>
@ -548,12 +556,12 @@
<workItem from="1493165364496" duration="28418000" /> <workItem from="1493165364496" duration="28418000" />
<workItem from="1493849367458" duration="10819000" /> <workItem from="1493849367458" duration="10819000" />
<workItem from="1496894298085" duration="4924000" /> <workItem from="1496894298085" duration="4924000" />
<workItem from="1496974639358" duration="8522000" /> <workItem from="1496974639358" duration="8801000" />
</task> </task>
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="138794000" /> <option name="totallyTimeSpent" value="139073000" />
</component> </component>
<component name="TodoView"> <component name="TodoView">
<todo-panel id="selected-file"> <todo-panel id="selected-file">
@ -887,14 +895,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/loaders/Conf.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="288">
<caret line="16" column="0" lean-forward="false" selection-start-line="16" selection-start-column="0" selection-end-line="16" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/loaders/Plan.cpp"> <entry file="file://$PROJECT_DIR$/src/loaders/Plan.cpp">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0"> <state relative-caret-position="0">
@ -1069,17 +1069,9 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/loaders/Conf.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="108">
<caret line="6" column="30" lean-forward="false" selection-start-line="6" selection-start-column="30" selection-end-line="6" selection-end-column="30" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/loaders/JSON_Loader.cpp"> <entry file="file://$PROJECT_DIR$/src/loaders/JSON_Loader.cpp">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="831"> <state relative-caret-position="777">
<caret line="97" column="37" lean-forward="false" selection-start-line="97" selection-start-column="37" selection-end-line="97" selection-end-column="37" /> <caret line="97" column="37" lean-forward="false" selection-start-line="97" selection-start-column="37" selection-end-line="97" selection-end-column="37" />
<folding> <folding>
<element signature="e#0#2#0" expanded="true" /> <element signature="e#0#2#0" expanded="true" />
@ -1095,5 +1087,21 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/loaders/Conf.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="10" column="58" lean-forward="true" selection-start-line="10" selection-start-column="58" selection-end-line="10" selection-end-column="58" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/loaders/Conf.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="12" column="15" lean-forward="false" selection-start-line="12" selection-start-column="15" selection-end-line="12" selection-end-column="15" />
<folding />
</state>
</provider>
</entry>
</component> </component>
</project> </project>

View File

@ -2,18 +2,22 @@
Conf::Conf( std::string filename ): JSON_Loader() Conf::Conf( std::string filename ): JSON_Loader()
{ {
// Conf is always loaded from file.
this->load_json_file( filename, true ); this->load_json_file( filename, true );
this->plan_path = this->get_key("plan_path", true, false).asString(); // always load plan_path, it is required to function.
this->units_path = this->get_key("units_path", true, false).asString(); 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() std::string Conf::get_plan_path()
{ {
return this->plan_path; return this->plan_path.asString();
} }
std::string Conf::get_units_path() std::string Conf::get_units_path()
{ {
return this->units_path; return this->units_path.asString();
} }

View File

@ -9,8 +9,8 @@
class Conf: public JSON_Loader class Conf: public JSON_Loader
{ {
private: private:
std::string plan_path; Json::Value plan_path;
std::string units_path; Json::Value units_path;
public: public:
Conf( std::string filename ); Conf( std::string filename );