fixed class constructor inheritance
parent
41c59ea985
commit
f43c3066d2
|
@ -33,10 +33,10 @@
|
|||
<file leaf-file-name="main.cpp" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/main.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="162">
|
||||
<caret line="9" column="1" lean-forward="false" selection-start-line="9" selection-start-column="1" selection-end-line="9" selection-end-column="1" />
|
||||
<state relative-caret-position="108">
|
||||
<caret line="6" column="0" lean-forward="false" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="e#387#562#0" expanded="true" />
|
||||
<element signature="e#146#321#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -45,8 +45,8 @@
|
|||
<file leaf-file-name="loaders.h" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/loaders.h">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="720">
|
||||
<caret line="40" column="2" lean-forward="true" selection-start-line="40" selection-start-column="2" selection-end-line="40" selection-end-column="2" />
|
||||
<state relative-caret-position="540">
|
||||
<caret line="30" column="37" lean-forward="true" selection-start-line="30" selection-start-column="37" selection-end-line="30" selection-end-column="37" />
|
||||
<folding>
|
||||
<element signature="e#0#2#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -91,8 +91,8 @@
|
|||
<file leaf-file-name="loaders.cpp" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/loaders.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1026">
|
||||
<caret line="57" column="10" lean-forward="false" selection-start-line="57" selection-start-column="10" selection-end-line="57" selection-end-column="10" />
|
||||
<state relative-caret-position="1080">
|
||||
<caret line="60" column="64" lean-forward="false" selection-start-line="60" selection-start-column="64" selection-end-line="60" selection-end-column="64" />
|
||||
<folding>
|
||||
<element signature="e#0#2#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -103,10 +103,10 @@
|
|||
<file leaf-file-name="main.cpp" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/main.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="180">
|
||||
<caret line="10" column="26" lean-forward="false" selection-start-line="10" selection-start-column="26" selection-end-line="10" selection-end-column="26" />
|
||||
<state relative-caret-position="108">
|
||||
<caret line="6" column="0" lean-forward="true" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="e#387#562#0" expanded="true" />
|
||||
<element signature="e#146#321#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -589,12 +589,12 @@
|
|||
<updated>1491540343823</updated>
|
||||
<workItem from="1491540345736" duration="17928000" />
|
||||
<workItem from="1491759279673" duration="614000" />
|
||||
<workItem from="1492298506932" duration="26349000" />
|
||||
<workItem from="1492298506932" duration="27510000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="44891000" />
|
||||
<option name="totallyTimeSpent" value="46052000" />
|
||||
</component>
|
||||
<component name="TodoView">
|
||||
<todo-panel id="selected-file">
|
||||
|
@ -682,14 +682,6 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/cmake-build-debug/config.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="72">
|
||||
<caret line="4" column="28" lean-forward="false" selection-start-line="4" selection-start-column="28" selection-end-line="4" selection-end-column="28" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/jsoncpp.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1558">
|
||||
|
@ -827,20 +819,28 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/loaders.h">
|
||||
<entry file="file://$PROJECT_DIR$/cmake-build-debug/config.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="720">
|
||||
<caret line="40" column="2" lean-forward="true" selection-start-line="40" selection-start-column="2" selection-end-line="40" selection-end-column="2" />
|
||||
<state relative-caret-position="72">
|
||||
<caret line="4" column="28" lean-forward="false" selection-start-line="4" selection-start-column="28" selection-end-line="4" selection-end-column="28" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/loaders.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1080">
|
||||
<caret line="60" column="64" lean-forward="false" selection-start-line="60" selection-start-column="64" selection-end-line="60" selection-end-column="64" />
|
||||
<folding>
|
||||
<element signature="e#0#2#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/loaders.cpp">
|
||||
<entry file="file://$PROJECT_DIR$/src/loaders.h">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1026">
|
||||
<caret line="57" column="10" lean-forward="false" selection-start-line="57" selection-start-column="10" selection-end-line="57" selection-end-column="10" />
|
||||
<state relative-caret-position="540">
|
||||
<caret line="30" column="37" lean-forward="true" selection-start-line="30" selection-start-column="37" selection-end-line="30" selection-end-column="37" />
|
||||
<folding>
|
||||
<element signature="e#0#2#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -849,10 +849,10 @@
|
|||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/main.cpp">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="180">
|
||||
<caret line="10" column="26" lean-forward="false" selection-start-line="10" selection-start-column="26" selection-end-line="10" selection-end-column="26" />
|
||||
<state relative-caret-position="108">
|
||||
<caret line="6" column="0" lean-forward="true" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="e#387#562#0" expanded="true" />
|
||||
<element signature="e#146#321#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
17
main.cpp
17
main.cpp
|
@ -5,17 +5,6 @@
|
|||
#include "src/json/json-forwards.h"
|
||||
#include "src/loaders.h"
|
||||
|
||||
|
||||
void json_file_to_json_obj(std::string filename)
|
||||
{
|
||||
Conf jsonLoader = Conf(filename);
|
||||
Json::Value root = jsonLoader.get_root();
|
||||
|
||||
const std::string planpath = root.get("plan_path", NULL).asString();
|
||||
|
||||
std::cout << planpath;
|
||||
}
|
||||
|
||||
/*configuration load_config_file( std::string filename )
|
||||
{
|
||||
json j_conf = json_file_to_json_obj( filename );
|
||||
|
@ -25,10 +14,8 @@ void json_file_to_json_obj(std::string filename)
|
|||
|
||||
int main()
|
||||
{
|
||||
// configuration appconf = load_config_file( "./config.json" );
|
||||
// std::cout << appconf.plan_path << std::endl;
|
||||
// std::cout << appconf.units_path << std::endl;
|
||||
Conf jsonLoader = Conf("config.json");
|
||||
|
||||
json_file_to_json_obj( "config.json" );
|
||||
std::cout << jsonLoader.get_units_path();
|
||||
return 0;
|
||||
}
|
|
@ -23,7 +23,7 @@ JLoader::JLoader( std::string filename )
|
|||
|
||||
if (! exists( filename ) )
|
||||
{
|
||||
std::cout << "File '" << filename << "' does not exist.";
|
||||
std::cerr << "File '" << filename << "' does not exist.";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ JLoader::JLoader( std::string filename )
|
|||
bool parsingSuccessful = reader.parse( jfile, this->json_root );
|
||||
if (! parsingSuccessful )
|
||||
{
|
||||
std::cout << "Failed to parse " << filename << ":\n\t" << reader.getFormattedErrorMessages();
|
||||
std::cerr << "Failed to parse " << filename << ":\n\t" << reader.getFormattedErrorMessages();
|
||||
exit(1);
|
||||
} else {
|
||||
std::cout << "Parsed " << filename << " with " << this->json_root.size() << " elements." << std::endl;
|
||||
|
@ -57,5 +57,17 @@ Plan::Plan( std::string filename ): JLoader( filename )
|
|||
|
||||
Conf::Conf( std::string filename ): JLoader( filename )
|
||||
{
|
||||
|
||||
this->plan_path = this->get_root()["plan_path"].asString();
|
||||
this->units_path = this->get_root()["units_path"].asString();
|
||||
};
|
||||
|
||||
std::string Conf::get_plan_path()
|
||||
{
|
||||
return this->plan_path;
|
||||
}
|
||||
|
||||
std::string Conf::get_units_path()
|
||||
{
|
||||
return this->units_path;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,9 +45,14 @@ class Conf: public JLoader
|
|||
{
|
||||
private:
|
||||
Json::Value json_root;
|
||||
std::string plan_path;
|
||||
std::string units_path;
|
||||
|
||||
public:
|
||||
using JLoader::JLoader;
|
||||
Conf( std::string filename );
|
||||
std::string get_plan_path();
|
||||
std::string get_units_path();
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue