15 #ifndef BORNAGAIN_MVVM_MODEL_MVVM_SERIALIZATION_JSONITEM_TYPES_H
16 #define BORNAGAIN_MVVM_MODEL_MVVM_SERIALIZATION_JSONITEM_TYPES_H
21 #include "mvvm/model_export.h"
31 class ItemFactoryInterface;
37 using create_item_t = std::function<std::unique_ptr<SessionItem>(
const QJsonObject&)>;
Interface class for all factories capable of producing SessionItem's.
The main object representing an editable/displayable/serializable entity.
materialitems.h Collection of materials to populate MaterialModel.
bool isRebuildItemDataAndTagFromJson(ConverterMode mode)
Returns true if item content should be reconstructed from JSON.
bool isRegenerateIdWhenBackFromJson(ConverterMode mode)
Returns true if given mode requires ID regeneration instead of using the one stored in JSON.
ConverterMode
Flags to define converter behavior on the way from SessionItem to JSON and back.
@ copy
full deep copying with item identifiers regenerated
@ none
undefined converter mode
@ project
selective copying for saving/loading the project (tags and data created by item, updated from JSON)
@ clone
full deep copying with item identifiers preserved
Provides necessary callbacks to convert SessionItem to JSON and back.
update_item_t m_update_item
creates new SessionItem from JSON object
std::function< std::unique_ptr< SessionItem >(const QJsonObject &)> create_item_t
std::function< QJsonObject(const SessionItem &)> create_json_t
create_item_t m_create_item
creates JSON object from session item
std::function< void(const QJsonObject &, SessionItem *)> update_item_t
create_json_t m_create_json
Collection of input paramters for SessionItemConverter.