1 #ifndef WS_IPROJECT_H_INCLUDED
2 #define WS_IPROJECT_H_INCLUDED
30 #include <boost/property_tree/ptree.hpp>
44 class MergedPreferences;
71 const std::string&,
const std::string&,
const std::string&,
const std::shared_ptr<IWorkspace>&)>;
72 using FileMap = std::map<std::string, std::shared_ptr<IFile>>;
73 using FileIterator =
typename FileMap::iterator;
74 using ConstFileIterator =
typename FileMap::const_iterator;
77 typedef std::function<std::shared_ptr<QWidget>(std::shared_ptr<MergedPreferences>,
QWidget*)> Type;
90 virtual FileIterator
Add(
const std::string& name) = 0;
94 virtual std::shared_ptr<IFile>
Back() = 0;
98 virtual std::shared_ptr<const IFile>
Back()
const = 0;
101 virtual FileIterator
begin() = 0;
104 virtual ConstFileIterator
begin()
const = 0;
107 virtual FileIterator
end() = 0;
110 virtual ConstFileIterator
end()
const = 0;
115 virtual void Close() = 0;
119 virtual FileIterator
Find(
const std::string& name) = 0;
123 virtual ConstFileIterator
Find(
const std::string& name)
const = 0;
127 virtual std::shared_ptr<IFile>
Front() = 0;
131 virtual std::shared_ptr<const IFile>
Front()
const = 0;
135 virtual std::shared_ptr<IFile>
Get(
const std::string& name) = 0;
139 virtual std::shared_ptr<const IFile>
Get(
const std::string& name)
const = 0;
148 virtual const std::string&
GetPath()
const = 0;
151 virtual std::shared_ptr<Session::ISession>
GetSession()
const = 0;
159 virtual std::vector<WidgetCallback>
GetWidgets() = 0;
164 virtual bool IsLeaf(
const std::string& name)
const = 0;
177 virtual void Open() = 0;
181 virtual void Open(
const std::string& name) = 0;
185 virtual void Open(FileIterator it) = 0;
193 virtual void Remove(
const std::string& name) = 0;
197 virtual void Remove(FileIterator it) = 0;
213 #endif // end_of_inclde_guard
virtual std::shared_ptr< Session::ISession > GetSession() const =0
Get session pointer. THIS IS A TEMPORARY HACK.
virtual void Open()=0
Open most recent file in project.
virtual bool IsWatchingDirectory() const =0
Test whether project is currently watching its directory for changes.
Interface for project-like behavior.
virtual const std::string & GetPath() const =0
Get path project was initialized with.
virtual FileIterator Add(const std::string &name)=0
Add existing file to project.
virtual std::shared_ptr< IFile > Front()=0
Get first file.
virtual FileIterator end()=0
Get iterator pointing to one position after last file.
virtual void SetWatchingDirectory(bool)=0
Set whether project must watch its directory for changes.
virtual FileIterator Find(const std::string &name)=0
Get iterator pointing to file with given name.
virtual void Refresh()=0
Refresh project.
Interface/Implementation of Subject.
Definition for ProjectChanged.
std::string name
Name of callback.
Interface expressing the ability of an object to have a ptree of preferences stored in it...
virtual bool IsOpened() const =0
Test whether project is in 'opened' state.
virtual FileIterator begin()=0
Get iterator pointing to first file.
virtual std::shared_ptr< IFile > Get(const std::string &name)=0
Get file with given name.
virtual std::string GetSessionFileName() const =0
Get name of file used to initiate session.
Type callback
Callback to create widget. Argument is parent widget, returns created widget.
Interface that expresses the ability to have user data, i.e.
virtual std::vector< QAction * > GetContextMenuActions() const =0
Get Qt actions that can be triggered on this project.
virtual std::vector< WidgetCallback > GetWidgets()=0
Get map of widget creator callbacks.
Interface for IWorkspace.
virtual std::shared_ptr< IFile > Back()=0
Get last file.
virtual ~IProject()
Virtual destructor.
Interface for IPreferences.
Subject in Observer pattern.
virtual const std::string & GetIndexFile() const =0
Get name of index file for this type of project.
see the online Qt documentation
Definition for PreferencesChanged.
virtual Session::ISession & Session() const =0
Get session of opened project.
std::function< std::shared_ptr< IProject >(const std::string &, const std::string &, const std::string &, const std::shared_ptr< IWorkspace > &)> ConstructorType
First argument : type of project to create.
Namespace for generic graphical shell for simulators.
virtual void Remove(const std::string &name)=0
Remove file with given name.
Generic session interface.
virtual bool IsLeaf(const std::string &name) const =0
Test whether file with given name exists in project.
virtual void Close()=0
Close project.