BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
jsonitemcopystrategy.cpp
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/jsonitemcopystrategy.cpp
6 //! @brief Implements 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 
17 #include "mvvm/model/sessionitem.h"
18 #include <QJsonObject>
19 
20 using namespace ModelView;
21 
23  std::unique_ptr<JsonItemConverterInterface> m_converter;
24 };
25 
27  : p_impl(std::make_unique<JsonItemCopyStrategyImpl>())
28 {
29  p_impl->m_converter = CreateItemCopyConverter(item_factory);
30 }
31 
33 
34 std::unique_ptr<SessionItem> JsonItemCopyStrategy::createCopy(const SessionItem* item) const
35 {
36  auto json = p_impl->m_converter->to_json(item);
37  return p_impl->m_converter->from_json(json);
38 }
Interface class for all factories capable of producing SessionItem's.
std::unique_ptr< SessionItem > createCopy(const SessionItem *item) const
Creates item copy by deep copying all children. SessionItem identifiers will be regenerated.
std::unique_ptr< JsonItemCopyStrategyImpl > p_impl
JsonItemCopyStrategy(const ItemFactoryInterface *item_factory)
The main object representing an editable/displayable/serializable entity.
Definition: sessionitem.h:38
Defines class CLASS?
Defines class CLASS?
materialitems.h Collection of materials to populate MaterialModel.
std::unique_ptr< JsonItemConverterInterface > CreateItemCopyConverter(const ItemFactoryInterface *item_factory)
Creates JSON item converter intended for item copying.
Definition: filesystem.h:81
Defines class CLASS?
std::unique_ptr< JsonItemConverterInterface > m_converter