BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
jsonitemconverterinterface.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // qt-mvvm: Model-view-view-model framework for large GUI applications
4 //
5 //! @file mvvm/model/mvvm/serialization/jsonitemconverterinterface.h
6 //! @brief Defines class CLASS?
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2020
11 //! @authors Gennady Pospelov et al, Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_MVVM_MODEL_MVVM_SERIALIZATION_JSONITEMCONVERTERINTERFACE_H
16 #define BORNAGAIN_MVVM_MODEL_MVVM_SERIALIZATION_JSONITEMCONVERTERINTERFACE_H
17 
18 #include "mvvm/model_export.h"
19 #include <memory>
20 
21 class QJsonObject;
22 
23 namespace ModelView {
24 
25 class SessionItem;
26 
27 //! Base class for all converters of SessionItem to/from JSON object.
28 
29 class MVVM_MODEL_EXPORT JsonItemConverterInterface {
30 public:
31  virtual ~JsonItemConverterInterface() = default;
32 
33  //! Converts item to JSON.
34  virtual QJsonObject to_json(const SessionItem* item) const = 0;
35 
36  //! Creates item from JSON.
37  virtual std::unique_ptr<SessionItem> from_json(const QJsonObject&) const = 0;
38 };
39 
40 } // namespace ModelView
41 
42 #endif // BORNAGAIN_MVVM_MODEL_MVVM_SERIALIZATION_JSONITEMCONVERTERINTERFACE_H
Base class for all converters of SessionItem to/from JSON object.
virtual std::unique_ptr< SessionItem > from_json(const QJsonObject &) const =0
Creates item from JSON.
virtual QJsonObject to_json(const SessionItem *item) const =0
Converts item to JSON.
virtual ~JsonItemConverterInterface()=default
The main object representing an editable/displayable/serializable entity.
Definition: sessionitem.h:38
materialitems.h Collection of materials to populate MaterialModel.