VPTissue Reference Manual
SimShell::Ws::IProject Class Referenceabstract

Interface for project-like behavior. More...

#include <IProject.h>

Inheritance diagram for SimShell::Ws::IProject:
Inheritance graph
Collaboration diagram for SimShell::Ws::IProject:
Collaboration graph

Classes

struct  WidgetCallback
 

Public Types

using ConstFileIterator = typename FileMap::const_iterator
 
using ConstructorType = std::function< std::shared_ptr< IProject >(const std::string &, const std::string &, const std::string &, const std::shared_ptr< IWorkspace > &)>
 First argument : type of project to create. More...
 
using FileIterator = typename FileMap::iterator
 
using FileMap = std::map< std::string, std::shared_ptr< IFile >>
 
- Public Types inherited from SimPT_Sim::Util::Subject< Event::PreferencesChanged, std::weak_ptr< const void > >
typedef std::function< void(const EventType &)> CallbackType
 
typedef Event::PreferencesChanged EventType
 
typedef const std::weak_ptr< const void > * KeyType
 
- Public Types inherited from SimPT_Sim::Util::Subject< Event::ProjectChanged, std::weak_ptr< const void > >
typedef std::function< void(const EventType &)> CallbackType
 
typedef Event::ProjectChanged EventType
 
typedef const std::weak_ptr< const void > * KeyType
 

Public Member Functions

virtual ~IProject ()
 Virtual destructor.
 
virtual FileIterator Add (const std::string &name)=0
 Add existing file to project. More...
 
virtual std::shared_ptr< IFileBack ()=0
 Get last file. More...
 
virtual std::shared_ptr< const IFileBack () const =0
 Get last file. More...
 
virtual FileIterator begin ()=0
 Get iterator pointing to first file.
 
virtual ConstFileIterator begin () const =0
 Get iterator pointing to first file.
 
virtual void Close ()=0
 Close project. More...
 
virtual FileIterator end ()=0
 Get iterator pointing to one position after last file.
 
virtual ConstFileIterator end () const =0
 Get iterator pointing to one position after file.
 
virtual FileIterator Find (const std::string &name)=0
 Get iterator pointing to file with given name. More...
 
virtual ConstFileIterator Find (const std::string &name) const =0
 Get iterator pointing to file with given name. More...
 
virtual std::shared_ptr< IFileFront ()=0
 Get first file. More...
 
virtual std::shared_ptr< const IFileFront () const =0
 Get first file. More...
 
virtual std::shared_ptr< IFileGet (const std::string &name)=0
 Get file with given name. More...
 
virtual std::shared_ptr< const IFileGet (const std::string &name) const =0
 Get file with given name. More...
 
virtual std::vector< QAction * > GetContextMenuActions () const =0
 Get Qt actions that can be triggered on this project.
 
virtual const std::string & GetIndexFile () const =0
 Get name of index file for this type of project.
 
virtual const std::string & GetPath () const =0
 Get path project was initialized with.
 
virtual std::shared_ptr< Session::ISessionGetSession () const =0
 Get session pointer. THIS IS A TEMPORARY HACK.
 
virtual std::string GetSessionFileName () const =0
 Get name of file used to initiate session. More...
 
virtual std::vector< WidgetCallbackGetWidgets ()=0
 Get map of widget creator callbacks.
 
virtual bool IsLeaf (const std::string &name) const =0
 Test whether file with given name exists in project. More...
 
virtual bool IsOpened () const =0
 Test whether project is in 'opened' state. More...
 
virtual bool IsWatchingDirectory () const =0
 Test whether project is currently watching its directory for changes. More...
 
virtual void Open ()=0
 Open most recent file in project.
 
virtual void Open (const std::string &name)=0
 Open given file in project. More...
 
virtual void Open (FileIterator it)=0
 Open given file in project. More...
 
virtual void Refresh ()=0
 Refresh project.
 
virtual void Remove (const std::string &name)=0
 Remove file with given name. More...
 
virtual void Remove (FileIterator it)=0
 Remove file pointed to by iterator. More...
 
virtual Session::ISessionSession () const =0
 Get session of opened project. More...
 
virtual void SetWatchingDirectory (bool)=0
 Set whether project must watch its directory for changes. More...
 
- Public Member Functions inherited from SimShell::Ws::IPreferences
virtual const boost::property_tree::ptree & GetPreferences () const =0
 
virtual void SetPreferences (const boost::property_tree::ptree &)=0
 
- Public Member Functions inherited from SimPT_Sim::Util::Subject< Event::PreferencesChanged, std::weak_ptr< const void > >
void Notify (const EventType &)
 
void Register (const U *, CallbackType)
 
void Unregister (const U *)
 
void UnregisterAll ()
 
- Public Member Functions inherited from SimShell::Ws::IUserData
virtual const boost::property_tree::ptree & GetUserData (const std::string &user) const =0
 
virtual void SetUserData (const std::string &user, const boost::property_tree::ptree &)=0
 
- Public Member Functions inherited from SimPT_Sim::Util::Subject< Event::ProjectChanged, std::weak_ptr< const void > >
void Notify (const EventType &)
 
void Register (const U *, CallbackType)
 
void Unregister (const U *)
 
void UnregisterAll ()
 

Detailed Description

Interface for project-like behavior.

A project is a container of files, indexed by name. Files can be added/removed.

Additionally, a project can be in "closed" or "opened" state. If a project resides in "opened" state, it keeps a session internally.

A project has associated with it a tree of preferences and a tree of user data.

See also
Open Close IPreferences IUserData

Definition at line 59 of file IProject.h.

Member Typedef Documentation

using SimShell::Ws::IProject::ConstructorType = std::function<std::shared_ptr<IProject>( const std::string&, const std::string&, const std::string&, const std::shared_ptr<IWorkspace>&)>

First argument : type of project to create.

Second argument : path of project. Third argument : preferences file name. Fourth argument : pointer to workspace to which project belongs.

Definition at line 71 of file IProject.h.

Member Function Documentation

virtual FileIterator SimShell::Ws::IProject::Add ( const std::string &  name)
pure virtual

Add existing file to project.

Returns
Iterator pointing to added file.
Exceptions
Exceptionif no such file.

Implemented in SimShell::Ws::Project< FileType, index_file >.

virtual std::shared_ptr<IFile> SimShell::Ws::IProject::Back ( )
pure virtual

Get last file.

Returns
Last file or nullptr if no files in project.

Implemented in SimShell::Ws::Project< FileType, index_file >.

virtual std::shared_ptr<const IFile> SimShell::Ws::IProject::Back ( ) const
pure virtual

Get last file.

Returns
Last file or nullptr if no files in project.

Implemented in SimShell::Ws::Project< FileType, index_file >.

virtual void SimShell::Ws::IProject::Close ( )
pure virtual

Close project.

This only has effect if we are in 'opened' state.

See also
IsOpened()

Implemented in SimShell::Ws::Project< FileType, index_file >.

virtual FileIterator SimShell::Ws::IProject::Find ( const std::string &  name)
pure virtual

Get iterator pointing to file with given name.

Returns
Iterator pointing to file or Project::end() if not found.

Implemented in SimShell::Ws::Project< FileType, index_file >.

virtual ConstFileIterator SimShell::Ws::IProject::Find ( const std::string &  name) const
pure virtual

Get iterator pointing to file with given name.

Returns
Iterator pointing to file or Project::end() if not found.

Implemented in SimShell::Ws::Project< FileType, index_file >.

virtual std::shared_ptr<IFile> SimShell::Ws::IProject::Front ( )
pure virtual

Get first file.

Returns
First file or nullptr if no files in project.

Implemented in SimShell::Ws::Project< FileType, index_file >.

virtual std::shared_ptr<const IFile> SimShell::Ws::IProject::Front ( ) const
pure virtual

Get first file.

Returns
First file or nullptr if no files in project.

Implemented in SimShell::Ws::Project< FileType, index_file >.

virtual std::shared_ptr<IFile> SimShell::Ws::IProject::Get ( const std::string &  name)
pure virtual

Get file with given name.

Exceptions
Exceptionif no such file.

Implemented in SimShell::Ws::Project< FileType, index_file >.

virtual std::shared_ptr<const IFile> SimShell::Ws::IProject::Get ( const std::string &  name) const
pure virtual

Get file with given name.

Exceptions
Exceptionif no such file.

Implemented in SimShell::Ws::Project< FileType, index_file >.

virtual std::string SimShell::Ws::IProject::GetSessionFileName ( ) const
pure virtual

Get name of file used to initiate session.

If project is not opened, will return empty string.

See also
IsOpened()

Implemented in SimShell::Ws::Project< FileType, index_file >.

virtual bool SimShell::Ws::IProject::IsLeaf ( const std::string &  name) const
pure virtual

Test whether file with given name exists in project.

Parameters
nameName of file to test existence.
Returns
Whether file with given name exists in project.

Implemented in SimShell::Ws::Project< FileType, index_file >.

virtual bool SimShell::Ws::IProject::IsOpened ( ) const
pure virtual

Test whether project is in 'opened' state.

Returns
Whether project is in 'opened' state.

Implemented in SimShell::Ws::Project< FileType, index_file >.

virtual bool SimShell::Ws::IProject::IsWatchingDirectory ( ) const
pure virtual

Test whether project is currently watching its directory for changes.

Default is true.

Returns
Whether project is currently watching its directory for changes.
See also
SetWatchingDirectory

Implemented in SimShell::Ws::Project< FileType, index_file >.

virtual void SimShell::Ws::IProject::Open ( const std::string &  name)
pure virtual

Open given file in project.

Parameters
nameFile to open.

Implemented in SimShell::Ws::Project< FileType, index_file >.

virtual void SimShell::Ws::IProject::Open ( FileIterator  it)
pure virtual

Open given file in project.

Parameters
itIterator pointing to file to open.

Implemented in SimShell::Ws::Project< FileType, index_file >.

virtual void SimShell::Ws::IProject::Remove ( const std::string &  name)
pure virtual

Remove file with given name.

Parameters
nameName of file to remove.
Exceptions
Exceptionif no such file.

Implemented in SimShell::Ws::Project< FileType, index_file >.

virtual void SimShell::Ws::IProject::Remove ( FileIterator  it)
pure virtual

Remove file pointed to by iterator.

Parameters
itIterator pointing to file to remove.

Implemented in SimShell::Ws::Project< FileType, index_file >.

virtual Session::ISession& SimShell::Ws::IProject::Session ( ) const
pure virtual

Get session of opened project.

If project is not opened, will throw exception.

See also
IsOpened()

Implemented in SimShell::Ws::Project< FileType, index_file >.

virtual void SimShell::Ws::IProject::SetWatchingDirectory ( bool  )
pure virtual

Set whether project must watch its directory for changes.

Default is true.

See also
IsWatchingDirectory

Implemented in SimShell::Ws::Project< FileType, index_file >.


The documentation for this class was generated from the following file: