23 std::string generate_description(
const std::string& modelType,
const TagRow& tagrow);
50 auto item = parent->takeItem(
p_impl->tagrow);
52 if (
p_impl->initial_identifier.empty())
53 p_impl->initial_identifier = item->identifier();
61 auto child =
p_impl->factory_func().release();
63 if (!
p_impl->initial_identifier.empty())
68 if (parent->insertItem(child,
p_impl->tagrow)) {
77 std::string generate_description(
const std::string& modelType,
const TagRow& tagrow)
79 std::ostringstream ostr;
80 ostr <<
"New item type '" << modelType <<
"' tag:'" << tagrow.
tag <<
"', row:" << tagrow.
row;
Abstract command interface to manipulate SessionItem in model context.
SessionItem * itemFromPath(const Path &path) const
void setDescription(const std::string &text)
Sets command description.
void setResult(const CommandResult &command_result)
Path pathFromItem(SessionItem *item) const
void setObsolete(bool flag)
Sets command obsolete flag.
InsertNewItemCommand(item_factory_func_t func, SessionItem *parent, const TagRow &tagrow)
std::unique_ptr< InsertNewItemCommandImpl > p_impl
~InsertNewItemCommand() override
void execute_command() override
void undo_command() override
Supports navigation through SessionModel.
The main object representing an editable/displayable/serializable entity.
Aggregate to hold (tag, row) information for SessionModel.
const int IDENTIFIER
unique identifier
materialitems.h Collection of materials to populate MaterialModel.
std::function< std::unique_ptr< SessionItem >()> item_factory_func_t
Definition for item factory funciton.
item_factory_func_t factory_func
std::string initial_identifier
InsertNewItemCommandImpl(item_factory_func_t func, TagRow tagrow)