BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ModelView::Project Class Reference

Project represents content of all application models in a folder on disk. More...

Inheritance diagram for ModelView::Project:
[legend]
Collaboration diagram for ModelView::Project:
[legend]

Classes

struct  ProjectImpl
 

Public Member Functions

 Project (const ProjectContext &context)
 
 ~Project ()
 
bool isModified () const override
 
bool load (const std::string &dirname) override
 Loads all models from the given directory. More...
 
std::string projectDir () const override
 Returns the full path to a project directory. More...
 
bool save (const std::string &dirname) const override
 Saves all models to a given directory. More...
 

Private Attributes

std::unique_ptr< ProjectImplp_impl
 

Detailed Description

Project represents content of all application models in a folder on disk.

Responsible for saving/loading application models to/from disk.

Definition at line 28 of file project.h.

Constructor & Destructor Documentation

◆ Project()

Project::Project ( const ProjectContext context)

Definition at line 57 of file project.cpp.

57 : p_impl(std::make_unique<ProjectImpl>(context)) {}
std::unique_ptr< ProjectImpl > p_impl
Definition: project.h:42

◆ ~Project()

Project::~Project ( )
default

Member Function Documentation

◆ isModified()

bool Project::isModified ( ) const
overridevirtual

Implements ModelView::ProjectInterface.

Definition at line 83 of file project.cpp.

84 {
85  return p_impl->m_change_controller.hasChanged();
86 }

References p_impl.

◆ load()

bool Project::load ( const std::string &  dirname)
overridevirtual

Loads all models from the given directory.

Implements ModelView::ProjectInterface.

Definition at line 78 of file project.cpp.

79 {
80  return p_impl->process(dirname, &ModelDocumentInterface::load);
81 }
virtual void load(const std::string &file_name)=0

References ModelView::ModelDocumentInterface::load(), and p_impl.

Here is the call graph for this function:

◆ projectDir()

std::string Project::projectDir ( ) const
overridevirtual

Returns the full path to a project directory.

It is a name where the project has been last time saved, or loaded from.

Implements ModelView::ProjectInterface.

Definition at line 64 of file project.cpp.

65 {
66  return p_impl->m_project_dir;
67 }

References p_impl.

◆ save()

bool Project::save ( const std::string &  dirname) const
overridevirtual

Saves all models to a given directory.

Directory should exist. Provided name will become 'projectDir'.

Implements ModelView::ProjectInterface.

Definition at line 72 of file project.cpp.

73 {
74  return p_impl->process(dirname, &ModelDocumentInterface::save);
75 }
virtual void save(const std::string &file_name) const =0

References p_impl, and ModelView::ModelDocumentInterface::save().

Here is the call graph for this function:

Member Data Documentation

◆ p_impl

std::unique_ptr<ProjectImpl> ModelView::Project::p_impl
private

Definition at line 43 of file project.h.

Referenced by isModified(), load(), projectDir(), and save().


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