init project
This commit is contained in:
commit
821ea7eed0
16 changed files with 950 additions and 0 deletions
32
include/projects/project.hpp
Normal file
32
include/projects/project.hpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
class Project {
|
||||
public:
|
||||
Project(const std::string& path, const std::string& path_to_scripts, const std::string& name);
|
||||
Project(const Project&) = delete;
|
||||
Project(Project&&) = default;
|
||||
|
||||
const std::filesystem::path& GetPath() const;
|
||||
const std::filesystem::path& GetPathToScripts() const;
|
||||
const std::string& GetName() const;
|
||||
bool IsSubDirectory(const std::filesystem::path&) const;
|
||||
|
||||
void SetPath(const std::string& path);
|
||||
void SetPathToScripts(const std::string& path_to_scripts);
|
||||
void SetName(const std::string& name);
|
||||
|
||||
void PrintInfo() const;
|
||||
|
||||
private:
|
||||
std::filesystem::path path_;
|
||||
std::filesystem::path path_to_scripts_;
|
||||
std::string name_;
|
||||
};
|
||||
|
||||
Project CreateProject();
|
||||
Project CreateProject(const std::string& name);
|
24
include/projects/project_list.hpp
Normal file
24
include/projects/project_list.hpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include "projects/project.hpp"
|
||||
|
||||
class ProjectList {
|
||||
public:
|
||||
ProjectList();
|
||||
|
||||
const std::deque<Project>& GetProjects();
|
||||
void AddProject(Project&&);
|
||||
|
||||
const Project& GetProject(
|
||||
const std::filesystem::path& path = std::filesystem::current_path()) const;
|
||||
void LoadFromYaml(const std::string& file_path);
|
||||
void SaveToYaml(const std::string& file_path) const;
|
||||
|
||||
private:
|
||||
std::deque<Project> projects_;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue