BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
SaveLoadInterface.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Support/IO/SaveLoadInterface.h
6 //! @brief Defines save/load interface.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_SUPPORT_IO_SAVELOADINTERFACE_H
16 #define BORNAGAIN_GUI_SUPPORT_IO_SAVELOADINTERFACE_H
17 
18 #include <QDateTime>
19 #include <QString>
20 
21 //! Abstract base class to handle non-XML data save and load.
22 
23 //! Inherited (mix-in) by DataItem
24 
26 public:
27  virtual ~SaveLoadInterface() = default;
28 
29  //! Loads non-XML data from _projectDir_ and returns success flag.
30  virtual bool loadData(const QString& projectDir) = 0;
31 
32  //! Saves non-XML data in _projectDir_ and returns success flag.
33  virtual bool saveData(const QString& projectDir) = 0;
34 
35  //! Checks if object owns non-XML data
36  virtual bool containsNonXMLData() const = 0;
37 
38  //! Indicates last modification timepoint.
39  virtual QDateTime lastModified() const = 0;
40 
41  //! Reports file name to save/load non-XML data.
42  virtual QString fileName() const = 0;
43 
44  //! Reports file name to save/load non-XML data with directory name attached.
45  QString fileName(const QString& projectDir) const;
46 };
47 
48 #endif // BORNAGAIN_GUI_SUPPORT_IO_SAVELOADINTERFACE_H
Abstract base class to handle non-XML data save and load.
virtual QString fileName() const =0
Reports file name to save/load non-XML data.
virtual ~SaveLoadInterface()=default
virtual bool containsNonXMLData() const =0
Checks if object owns non-XML data.
virtual bool loadData(const QString &projectDir)=0
Loads non-XML data from projectDir and returns success flag.
virtual QDateTime lastModified() const =0
Indicates last modification timepoint.
virtual bool saveData(const QString &projectDir)=0
Saves non-XML data in projectDir and returns success flag.
QString projectDir(const QString &projectFileName)
Returns project directory deduced from project file name.