implemented plan and task

master
Chris Punches 2017-04-19 01:50:34 -04:00
parent 39a8145744
commit aebdae2cce
8 changed files with 94 additions and 78 deletions

View File

@ -30,21 +30,11 @@
<splitter split-orientation="horizontal" split-proportion="0.4510178"> <splitter split-orientation="horizontal" split-proportion="0.4510178">
<split-first> <split-first>
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="main.cpp" pinned="false" current-in-tab="false"> <file leaf-file-name="loaders.h" 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="144">
<caret line="8" column="0" lean-forward="false" selection-start-line="8" selection-start-column="0" selection-end-line="8" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="loaders.h" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/loaders.h"> <entry file="file://$PROJECT_DIR$/src/loaders.h">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="324"> <state relative-caret-position="0">
<caret line="18" column="0" lean-forward="false" selection-start-line="18" selection-start-column="0" selection-end-line="18" selection-end-column="0" /> <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding> <folding>
<element signature="e#0#2#0" expanded="true" /> <element signature="e#0#2#0" expanded="true" />
</folding> </folding>
@ -52,11 +42,11 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="test.plan" pinned="false" current-in-tab="true"> <file leaf-file-name="test.plan" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/cmake-build-debug/conf/test.plan"> <entry file="file://$PROJECT_DIR$/cmake-build-debug/conf/test.plan">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90"> <state relative-caret-position="54">
<caret line="5" column="1" lean-forward="true" selection-start-line="5" selection-start-column="1" selection-end-line="5" selection-end-column="1" /> <caret line="3" column="23" lean-forward="false" selection-start-line="3" selection-start-column="23" selection-end-line="3" selection-end-column="23" />
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -66,33 +56,23 @@
</split-first> </split-first>
<split-second> <split-second>
<leaf> <leaf>
<file leaf-file-name="loaders.cpp" pinned="false" current-in-tab="false"> <file leaf-file-name="loaders.cpp" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/loaders.cpp"> <entry file="file://$PROJECT_DIR$/src/loaders.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="1291">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <caret line="89" column="0" lean-forward="true" selection-start-line="89" selection-start-column="0" selection-end-line="89" selection-end-column="0" />
<folding> <folding>
<element signature="e#1907#2041#0" expanded="true" /> <element signature="e#1909#2043#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="all_test.units" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/cmake-build-debug/conf/units/all_test.units">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="342">
<caret line="19" column="8" lean-forward="false" selection-start-line="19" selection-start-column="8" selection-end-line="19" selection-end-column="8" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="main.cpp" pinned="false" current-in-tab="false"> <file leaf-file-name="main.cpp" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/main.cpp"> <entry file="file://$PROJECT_DIR$/main.cpp">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="144"> <state relative-caret-position="216">
<caret line="8" column="0" lean-forward="true" selection-start-line="8" selection-start-column="0" selection-end-line="8" selection-end-column="0" /> <caret line="12" column="8" lean-forward="false" selection-start-line="12" selection-start-column="8" selection-end-line="12" selection-end-column="8" />
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -109,12 +89,12 @@
<option value="$PROJECT_DIR$/units/units.conf" /> <option value="$PROJECT_DIR$/units/units.conf" />
<option value="$PROJECT_DIR$/plan.conf" /> <option value="$PROJECT_DIR$/plan.conf" />
<option value="$PROJECT_DIR$/CMakeLists.txt" /> <option value="$PROJECT_DIR$/CMakeLists.txt" />
<option value="$PROJECT_DIR$/cmake-build-debug/conf/test.plan" />
<option value="$PROJECT_DIR$/src/loaders.h" />
<option value="$PROJECT_DIR$/cmake-build-debug/config.json" /> <option value="$PROJECT_DIR$/cmake-build-debug/config.json" />
<option value="$PROJECT_DIR$/main.cpp" />
<option value="$PROJECT_DIR$/src/loaders.cpp" />
<option value="$PROJECT_DIR$/cmake-build-debug/conf/units/all_test.units" /> <option value="$PROJECT_DIR$/cmake-build-debug/conf/units/all_test.units" />
<option value="$PROJECT_DIR$/cmake-build-debug/conf/test.plan" />
<option value="$PROJECT_DIR$/main.cpp" />
<option value="$PROJECT_DIR$/src/loaders.h" />
<option value="$PROJECT_DIR$/src/loaders.cpp" />
</list> </list>
</option> </option>
</component> </component>
@ -457,12 +437,12 @@
<updated>1491540343823</updated> <updated>1491540343823</updated>
<workItem from="1491540345736" duration="17928000" /> <workItem from="1491540345736" duration="17928000" />
<workItem from="1491759279673" duration="614000" /> <workItem from="1491759279673" duration="614000" />
<workItem from="1492298506932" duration="34826000" /> <workItem from="1492298506932" duration="37953000" />
</task> </task>
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="53368000" /> <option name="totallyTimeSpent" value="56495000" />
</component> </component>
<component name="TodoView"> <component name="TodoView">
<todo-panel id="selected-file"> <todo-panel id="selected-file">
@ -484,7 +464,7 @@
<window_info id="LuaJ" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="LuaJ" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" /> <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.1407334" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.1407334" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.2499049" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.2499049" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32903865" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32903865" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" /> <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
@ -563,24 +543,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/loaders.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="324">
<caret line="18" column="0" lean-forward="false" selection-start-line="18" selection-start-column="0" selection-end-line="18" selection-end-column="0" />
<folding>
<element signature="e#0#2#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/cmake-build-debug/conf/test.plan">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="5" column="1" lean-forward="true" selection-start-line="5" selection-start-column="1" selection-end-line="5" selection-end-column="1" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/cmake-build-debug/config.json"> <entry file="file://$PROJECT_DIR$/cmake-build-debug/config.json">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="18"> <state relative-caret-position="18">
@ -718,31 +680,49 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/cmake-build-debug/conf/units/all_test.units">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="378">
<caret line="21" column="1" lean-forward="true" selection-start-line="21" selection-start-column="1" selection-end-line="21" selection-end-column="1" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/cmake-build-debug/conf/test.plan">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="54">
<caret line="3" column="23" lean-forward="false" selection-start-line="3" selection-start-column="23" selection-end-line="3" selection-end-column="23" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/main.cpp"> <entry file="file://$PROJECT_DIR$/main.cpp">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="144"> <state relative-caret-position="216">
<caret line="8" column="0" lean-forward="true" selection-start-line="8" selection-start-column="0" selection-end-line="8" selection-end-column="0" /> <caret line="12" column="8" lean-forward="false" selection-start-line="12" selection-start-column="8" selection-end-line="12" selection-end-column="8" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/loaders.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<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.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="1291">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <caret line="89" column="0" lean-forward="true" selection-start-line="89" selection-start-column="0" selection-end-line="89" selection-end-column="0" />
<folding> <folding>
<element signature="e#1907#2041#0" expanded="true" /> <element signature="e#1909#2043#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/cmake-build-debug/conf/units/all_test.units">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="342">
<caret line="19" column="8" lean-forward="false" selection-start-line="19" selection-start-column="8" selection-end-line="19" selection-end-column="8" />
<folding />
</state>
</provider>
</entry>
</component> </component>
</project> </project>

View File

@ -1,6 +1,6 @@
{ {
"plan": [ "plan": [
{ "name": "gcc is present", "depends on": [ null ] }, { "name": "gcc is present", "depends on": [ null ] },
{ "name": "gcYou are not c can compile", "depends on": [ "gcc is present" ] } { "name": "gcc can compile", "depends on": [ "gcc is present" ] }
] ]
} }

Binary file not shown.

View File

@ -4,8 +4,16 @@
int main() int main()
{ {
Conf jsonLoader = Conf("config.json"); Conf configuration = Conf("config.json");
UnitHolder units = UnitHolder( jsonLoader.get_units_path() ); UnitHolder unitHolder = UnitHolder( configuration.get_units_path() );
Plan plan = Plan( configuration.get_plan_path() );
for ( int i = 0; i < plan.tasks.size(); ++i )
{
std::cout << plan.tasks[i].get_name() << std::endl;
}
return 0; return 0;
} }

View File

@ -35,6 +35,7 @@ Json::Value JLoader::get_root()
return this->json_root; return this->json_root;
} }
Unit::Unit( Json::Value loader_root ) Unit::Unit( Json::Value loader_root )
{ {
this->name = loader_root.get("name", "?").asString(); this->name = loader_root.get("name", "?").asString();
@ -45,6 +46,7 @@ Unit::Unit( Json::Value loader_root )
this->required = loader_root.get("required", "?").asString(); this->required = loader_root.get("required", "?").asString();
this->rectify = loader_root.get("rectify", "?").asString(); this->rectify = loader_root.get("rectify", "?").asString();
} }
std::string Unit::get_name() { return this->name; } std::string Unit::get_name() { return this->name; }
std::string Unit::get_target() { return this->target; } std::string Unit::get_target() { return this->target; }
std::string Unit::get_output() { return this->output; } std::string Unit::get_output() { return this->output; }
@ -62,15 +64,30 @@ UnitHolder::UnitHolder( std::string filename ): JLoader( filename )
for ( int index = 0; index < raw_units.size(); index++ ) for ( int index = 0; index < raw_units.size(); index++ )
{ {
this->Units.push_back(Unit( raw_units[index] )); this->units.push_back(Unit( raw_units[index] ));
} }
}; };
Task::Task( Json::Value loader_root )
{
this->name = loader_root.get("name", "?").asString();
this->dependencies = loader_root.get("depends on", "");
}
std::string Task::get_name() { return this->name; }
Json::Value Task::get_dependencies() { return this->dependencies;}
Plan::Plan( std::string filename ): JLoader( filename ) Plan::Plan( std::string filename ): JLoader( filename )
{ {
// TODO: Implement Json::Value raw_tasks = this->get_root()["plan"];
for ( int index = 0; index < raw_tasks.size(); index++ )
{
this->tasks.push_back( Task( raw_tasks[index] ) );
}
}; };
Conf::Conf( std::string filename ): JLoader( filename ) Conf::Conf( std::string filename ): JLoader( filename )
{ {
this->plan_path = this->get_root()["plan_path"].asString(); this->plan_path = this->get_root()["plan_path"].asString();

View File

@ -46,18 +46,29 @@ class Unit
class UnitHolder: public JLoader class UnitHolder: public JLoader
{ {
private:
std::vector<Unit> Units;
public: public:
using JLoader::JLoader; using JLoader::JLoader;
std::vector<Unit> units;
UnitHolder( std::string filename ); UnitHolder( std::string filename );
}; };
class Task
{
private:
std::string name;
Json::Value dependencies;
public:
Task( Json::Value loader_root );
std::string get_name();
Json::Value get_dependencies();
};
class Plan: public JLoader class Plan: public JLoader
{ {
public: public:
using JLoader::JLoader; using JLoader::JLoader;
std::vector<Task> tasks;
Plan( std::string filename ); Plan( std::string filename );
}; };