Ember
Loading...
Searching...
No Matches
ProjectManager.h
Go to the documentation of this file.
1#pragma once
2
4#include "Types/Types.h"
5#include <memory>
6#include <mutex>
7#include <vector>
8
9namespace EmberCore {
10
18 public:
19 // Maximum number of recent projects to track
20 static const size_t MAX_RECENT_PROJECTS = 10;
21
22 // Singleton access
24
25 // Prevent copying
26 ProjectManager(const ProjectManager &) = delete;
28
29 // Project creation
30 std::shared_ptr<BehaviorTreeProject> CreateProject(const String &name, const String &description = "");
31
32 // Project I/O
33 bool OpenProject(const String &filepath);
34 bool SaveProject();
35 bool SaveProjectAs(const String &filepath);
36 bool CloseProject();
37
38 // Active project access
39 std::shared_ptr<BehaviorTreeProject> GetActiveProject() const;
40 bool HasActiveProject() const;
42 bool IsProjectModified() const;
43 void SetProjectModified(bool modified);
44
45 // Recent projects management
46 const std::vector<String> &GetRecentProjects() const;
47 void AddToRecentProjects(const String &filepath);
48 void RemoveFromRecentProjects(const String &filepath);
50
51 // Check if a recent project still exists
52 bool RecentProjectExists(const String &filepath) const;
53
54 // Project directory
57
58 // Utility
59 void ResetToDefaults();
60
61 // Config file operations (stores recent projects, etc.)
62 bool LoadConfig();
63 bool SaveConfig();
64
65 private:
67 ~ProjectManager() = default;
68
69 // Internal methods (caller must hold mutex_)
70 void AddToRecentProjectsInternal(const String &filepath);
71 void RemoveFromRecentProjectsInternal(const String &filepath);
72
73 // Thread safety
74 mutable std::mutex mutex_;
75
76 // Data members
77 std::shared_ptr<BehaviorTreeProject> active_project_;
80
81 std::vector<String> recent_projects_;
84};
85
86} // namespace EmberCore
void AddToRecentProjectsInternal(const String &filepath)
void AddToRecentProjects(const String &filepath)
void RemoveFromRecentProjectsInternal(const String &filepath)
static const size_t MAX_RECENT_PROJECTS
ProjectManager & operator=(const ProjectManager &)=delete
bool RecentProjectExists(const String &filepath) const
String GetProjectsDirectory() const
bool SaveProjectAs(const String &filepath)
bool OpenProject(const String &filepath)
void SetProjectModified(bool modified)
static ProjectManager & GetInstance()
void RemoveFromRecentProjects(const String &filepath)
const std::vector< String > & GetRecentProjects() const
std::vector< String > recent_projects_
std::shared_ptr< BehaviorTreeProject > active_project_
ProjectManager(const ProjectManager &)=delete
String GetActiveProjectPath() const
std::shared_ptr< BehaviorTreeProject > GetActiveProject() const
std::shared_ptr< BehaviorTreeProject > CreateProject(const String &name, const String &description="")
Main types header for EmberCore.
std::string String
Framework-agnostic string type.
Definition String.h:14