1 #ifndef WS_IWORKSPACE_H_INCLUDED
2 #define WS_IWORKSPACE_H_INCLUDED
28 #include <boost/property_tree/ptree.hpp>
58 ProjectMapEntry(
const std::shared_ptr<IProject>& p,
const std::string& t)
59 : m_project(p), m_type(t) {}
61 inline IProject* operator->() {
return m_project.get(); }
62 inline const IProject* operator->()
const {
return m_project.get(); }
64 inline IProject& operator*() {
return *m_project.get(); }
65 inline const IProject& operator*()
const {
return *m_project.get(); }
67 inline std::shared_ptr<const IProject>
Project()
const {
return m_project; }
68 inline std::shared_ptr<IProject>
Project() {
return m_project; }
70 inline std::string Type() {
return m_type; }
73 std::shared_ptr<IProject> m_project;
77 using ProjectMap = std::map<std::string, ProjectMapEntry>;
78 using ProjectIterator =
typename ProjectMap::iterator;
79 using ConstProjectIterator =
typename ProjectMap::const_iterator ;
86 virtual ProjectIterator
Add(
const std::string& type,
const std::string& name) = 0;
90 virtual std::shared_ptr<IProject>
Back() = 0;
94 virtual std::shared_ptr<const IProject>
Back()
const = 0;
97 virtual ProjectIterator
begin() = 0;
100 virtual ConstProjectIterator
begin()
const = 0;
104 virtual std::shared_ptr<IProject>
Front() = 0;
108 virtual std::shared_ptr<const IProject>
Front()
const = 0;
111 virtual ProjectIterator
end() = 0;
114 virtual ConstProjectIterator
end()
const = 0;
118 virtual ProjectIterator
Find(
const std::string& name) = 0;
122 virtual ConstProjectIterator
Find(
const std::string& name)
const = 0;
126 virtual bool IsProject(
const std::string& name)
const = 0;
130 virtual std::shared_ptr<IProject>
Get(
const std::string& name) = 0;
134 virtual std::shared_ptr<const IProject>
Get(
const std::string& name)
const = 0;
140 virtual const std::string&
GetPath()
const = 0;
146 virtual ProjectIterator
New(
const std::string& type,
const std::string& name) = 0;
154 virtual void Remove(ProjectIterator it) = 0;
158 virtual void Remove(
const std::string& name) = 0;
162 virtual ProjectIterator
Rename(ProjectIterator,
const std::string& new_name) = 0;
166 virtual ProjectIterator
Rename(
const std::string& old_name,
const std::string& new_name) = 0;
172 #endif // end_of_inclde_guard
virtual ProjectIterator begin()=0
Get iterator pointing to first project.
virtual const std::string & GetIndexFile() const =0
Get name of index file for this type of workspace.
virtual std::shared_ptr< IProject > Front()=0
Get first project.
Interface for project-like behavior.
virtual ProjectIterator Find(const std::string &name)=0
Get iterator to project with given name.
Abstraction of project in workspace on file system.
virtual ProjectIterator Add(const std::string &type, const std::string &name)=0
Add existing project to workspace.
virtual void Refresh()=0
Refresh workspace.
virtual ~IWorkspace()
Virtual destructor.
virtual const std::string & GetPath() const =0
Get path workspace was initialized with.
virtual ProjectIterator end()=0
Get iterator pointing to one position after last project.
Interface for workspace-like behavior.
Interface/Implementation of Subject.
Definition for WorkspaceChanged.
Interface expressing the ability of an object to have a ptree of preferences stored in it...
virtual std::shared_ptr< IProject > Get(const std::string &name)=0
Get project with given name.
Interface that expresses the ability to have user data, i.e.
virtual bool IsProject(const std::string &name) const =0
Get iterator to project with given name.
virtual ProjectIterator New(const std::string &type, const std::string &name)=0
Create new project in workspace.
virtual ProjectIterator Rename(ProjectIterator, const std::string &new_name)=0
Rename project.
Interface for IPreferences.
virtual std::shared_ptr< IProject > Back()=0
Get last project.
Subject in Observer pattern.
Definition for PreferencesChanged.
Namespace for generic graphical shell for simulators.
virtual void Remove(ProjectIterator it)=0
Remove project.