diff options
author | rtk0c <[email protected]> | 2021-05-30 23:00:41 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2021-05-30 23:00:41 -0700 |
commit | c90f78df080a9891930ee346b0ad87498ba5b697 (patch) | |
tree | c4f4c475086337e25cbb985625423591c47310e1 /core/src/Model/Project.hpp | |
parent | 088da97531935a61870ecada10f06b9b9a8255d1 (diff) |
Initial work on templates UI
Diffstat (limited to 'core/src/Model/Project.hpp')
-rw-r--r-- | core/src/Model/Project.hpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/core/src/Model/Project.hpp b/core/src/Model/Project.hpp index 5f26532..bce58c2 100644 --- a/core/src/Model/Project.hpp +++ b/core/src/Model/Project.hpp @@ -1,7 +1,9 @@ #pragma once #include "Model/Items.hpp" +#include "Model/Template/Template.hpp" #include "Model/TransactionsModel.hpp" +#include "Model/Workflow/Workflow.hpp" #include <json/forwards.h> #include <tsl/array_map.h> @@ -15,17 +17,21 @@ public: ItemList<ProductItem> Products; ItemList<FactoryItem> Factories; ItemList<CustomerItem> Customers; - TransactionModel Database; private: tsl::array_map<char, WorkflowInfo> mWorkflows; + tsl::array_map<char, TemplateInfo> mTemplates; std::filesystem::path mRootPath; std::string mRootPathString; std::string mName; + // This is put after the private fields, so that when TransactionModel's constructor runs, all of them will be initialized +public: + TransactionModel Database; + public: /// Load the project from a directory containing the cplt_project.json file. - Project(const std::filesystem::path& rootPath); + Project(std::filesystem::path rootPath); /// Create a project with the given name in the given path. Note that the path should be a directory that will contain the project files once created. /// This function assumes the given directory will exist and is empty. @@ -39,15 +45,23 @@ public: std::filesystem::path GetItemsDirectory() const; std::filesystem::path GetWorkflowsDirectory() const; std::filesystem::path GetWorkflowPath(std::string_view name) const; + std::filesystem::path GetTemplatesDirectory() const; + std::filesystem::path GetTemplatePath(std::string_view name) const; const std::string& GetName() const; void SetName(std::string name); - const decltype(mWorkflows)& GetWorkflows() const; + const tsl::array_map<char, WorkflowInfo>& GetWorkflows() const; std::unique_ptr<Workflow> LoadWorkflow(std::string_view name); std::unique_ptr<Workflow> CreateWorkflow(std::string_view name); bool RemoveWorkflow(std::string_view name); - bool RenameWorkflow(std::string_view name, std::string_view newName); + bool RenameWorkflow(std::string_view oldName, std::string_view newName); + + const tsl::array_map<char, TemplateInfo>& GetTemplates() const; + std::unique_ptr<Template> LoadTemplate(std::string_view name); + bool InsertTemplate(std::string_view name, TemplateInfo info); + bool RemoveTemplate(std::string_view name); + bool RenameTemplate(std::string_view oldName, std::string_view newName); Json::Value Serialize(); void WriteToDisk(); |