From 2f4b9db39239ed5150094a81743beea42a3eedc2 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Thu, 1 Apr 2021 22:18:46 -0700 Subject: Initial work on SQLite database --- core/src/Model/Project.hpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'core/src/Model/Project.hpp') diff --git a/core/src/Model/Project.hpp b/core/src/Model/Project.hpp index 280eaf3..8d437ea 100644 --- a/core/src/Model/Project.hpp +++ b/core/src/Model/Project.hpp @@ -1,10 +1,11 @@ #pragma once #include "Model/Items.hpp" +#include "Model/TransactionDatabase.hpp" +#include #include #include -#include class Project { public: @@ -16,15 +17,20 @@ private: std::filesystem::path mRootPath; std::string mRootPathString; std::string mName; + TransactionDatabase mDb; public: - /// Load the project from a cplt_project.json file. - static Project Load(const std::filesystem::path& projectFilePath); - /// Load the project from the directory containing the cplt_project.json file. - static Project LoadDir(const std::filesystem::path& projectPath); + /// Load the project from a directory containing the cplt_project.json file. + Project(const 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. - static Project Create(std::string name, const std::filesystem::path& path); + Project(std::filesystem::path rootPath, std::string name); + + Project(const Project&) = delete; + Project& operator=(const Project&) = delete; + Project(Project&&) = default; + Project& operator=(Project&&) = default; /// Path to a *directory* that contains the project file. const std::filesystem::path& GetPath() const; @@ -35,7 +41,4 @@ public: Json::Value Serialize(); void WriteToDisk(); - -private: - Project() = default; }; -- cgit v1.2.3-70-g09d2