neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
i_project_manager.hpp
Go to the documentation of this file.
1// i_project_manager.hpp
2/*
3 neoGFX Design Studio
4 Copyright(C) 2020 Leigh Johnston
5
6 This program is free software: you can redistribute it and / or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
26
28{
30 {
31 public:
32 declare_event(project_added, i_project&)
33 declare_event(project_removed, i_project&)
34 declare_event(project_activated, i_project&)
35 declare_event(project_deactivated, i_project&)
36 public:
37 struct project_not_found : std::logic_error { project_not_found() : std::logic_error{ "neogfx::DesignStudio::i_project_manager::project_not_found" } {} };
38 struct no_active_project : std::logic_error { no_active_project() : std::logic_error{ "neogfx::DesignStudio::i_project_manager::no_active_project" } {} };
39 struct element_type_not_found : std::runtime_error { element_type_not_found(std::string const& aReason) : std::runtime_error{ "neogfx::DesignStudio::i_project_manager::element_type_not_found: " + aReason } {} };
40 public:
42 public:
43 virtual ~i_project_manager() = default;
44 // interface
45 public:
46 virtual const project_list& projects() const = 0;
47 virtual bool project_active() const = 0;
48 virtual i_project& active_project() const = 0;
49 virtual void activate_project(const i_project& aProject) = 0;
50 virtual void deactivate_project() = 0;
51 virtual i_project& open_project(const ng::i_string& aProjectFile) = 0;
52 virtual i_project& create_project(const ng::i_string& aProjectName, const ng::i_string& aProjectNamespace) = 0;
53 virtual void close_project(const i_project& aProject) = 0;
54 public:
55 virtual i_element_library& library(const ng::i_string& aElementType) const = 0;
56 // helpers
57 public:
58 i_project& open_project(std::string const& aProjectFile)
59 {
60 return open_project(ng::string{ aProjectFile });
61 }
62 i_project& create_project(std::string const& aProjectName, std::string const& aProjectNamespace)
63 {
64 return create_project(ng::string{ aProjectName }, ng::string{ aProjectNamespace });
65 }
66 };
67}
virtual void close_project(const i_project &aProject)=0
virtual i_element_library & library(const ng::i_string &aElementType) const =0
i_project & create_project(std::string const &aProjectName, std::string const &aProjectNamespace)
virtual void activate_project(const i_project &aProject)=0
i_project & open_project(std::string const &aProjectFile)
virtual i_project & open_project(const ng::i_string &aProjectFile)=0
virtual i_project & create_project(const ng::i_string &aProjectName, const ng::i_string &aProjectNamespace)=0
virtual const project_list & projects() const =0
virtual bool project_active() const =0
declare_event(project_added, i_project &) declare_event(project_removed
virtual i_project & active_project() const =0
Definition plf_hive.h:79
#define declare_event(declName,...)
Definition i_event.hpp:305