BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Abstract command interface to manipulate SessionItem in model context. More...
Classes | |
struct | AbstractItemCommandImpl |
Public Member Functions | |
AbstractItemCommand (const AbstractItemCommand &other)=delete | |
AbstractItemCommand (SessionItem *receiver) | |
virtual | ~AbstractItemCommand () |
std::string | description () const |
Returns command description. More... | |
void | execute () |
Execute command. More... | |
bool | isObsolete () const |
Returns whether the command is obsolete (which means that it shouldn't be kept in the stack). More... | |
AbstractItemCommand & | operator= (const AbstractItemCommand &other)=delete |
CommandResult | result () const |
void | undo () |
Undo command as it was before execution. More... | |
Protected Member Functions | |
SessionItem * | itemFromPath (const Path &path) const |
SessionModel * | model () const |
Path | pathFromItem (SessionItem *item) const |
void | setDescription (const std::string &text) |
Sets command description. More... | |
void | setObsolete (bool flag) |
Sets command obsolete flag. More... | |
void | setResult (const CommandResult &command_result) |
Private Member Functions | |
virtual void | execute_command ()=0 |
virtual void | undo_command ()=0 |
Private Attributes | |
std::unique_ptr< AbstractItemCommandImpl > | p_impl |
Abstract command interface to manipulate SessionItem in model context.
Definition at line 31 of file abstractitemcommand.h.
|
explicit |
Definition at line 40 of file abstractitemcommand.cpp.
References ModelView::SessionItem::model(), and p_impl.
|
virtualdefault |
|
delete |
std::string AbstractItemCommand::description | ( | ) | const |
Returns command description.
Definition at line 87 of file abstractitemcommand.cpp.
References p_impl.
void AbstractItemCommand::execute | ( | ) |
Execute command.
Definition at line 56 of file abstractitemcommand.cpp.
References execute_command(), and p_impl.
Referenced by TEST_F().
|
privatepure virtual |
Implemented in ModelView::SetValueCommand, ModelView::RemoveItemCommand, ModelView::MoveItemCommand, ModelView::InsertNewItemCommand, and ModelView::CopyItemCommand.
Referenced by execute().
bool AbstractItemCommand::isObsolete | ( | ) | const |
Returns whether the command is obsolete (which means that it shouldn't be kept in the stack).
Definition at line 80 of file abstractitemcommand.cpp.
References p_impl.
Referenced by ModelView::AbstractItemCommand::AbstractItemCommandImpl::can_undo(), and TEST_F().
|
protected |
Definition at line 116 of file abstractitemcommand.cpp.
References ModelView::Utils::ItemFromPath(), and p_impl.
Referenced by ModelView::CopyItemCommand::execute_command(), ModelView::InsertNewItemCommand::execute_command(), ModelView::MoveItemCommand::execute_command(), ModelView::RemoveItemCommand::execute_command(), ModelView::SetValueCommand::swap_values(), ModelView::CopyItemCommand::undo_command(), ModelView::InsertNewItemCommand::undo_command(), ModelView::MoveItemCommand::undo_command(), and ModelView::RemoveItemCommand::undo_command().
|
protected |
Definition at line 121 of file abstractitemcommand.cpp.
References p_impl.
|
delete |
|
protected |
Definition at line 111 of file abstractitemcommand.cpp.
References ModelView::Utils::PathFromItem().
Referenced by ModelView::CopyItemCommand::CopyItemCommand(), ModelView::InsertNewItemCommand::InsertNewItemCommand(), ModelView::MoveItemCommand::MoveItemCommand(), ModelView::RemoveItemCommand::RemoveItemCommand(), ModelView::SetValueCommand::SetValueCommand(), ModelView::MoveItemCommand::execute_command(), and ModelView::MoveItemCommand::undo_command().
CommandResult AbstractItemCommand::result | ( | ) | const |
Definition at line 92 of file abstractitemcommand.cpp.
References p_impl.
Referenced by ModelView::CopyItemCommand::execute_command(), ModelView::SetValueCommand::swap_values(), and TEST_F().
|
protected |
Sets command description.
Definition at line 106 of file abstractitemcommand.cpp.
References p_impl.
Referenced by ModelView::CopyItemCommand::CopyItemCommand(), ModelView::MoveItemCommand::MoveItemCommand(), ModelView::RemoveItemCommand::RemoveItemCommand(), ModelView::SetValueCommand::SetValueCommand(), and ModelView::InsertNewItemCommand::execute_command().
|
protected |
Sets command obsolete flag.
Definition at line 99 of file abstractitemcommand.cpp.
References p_impl.
Referenced by ModelView::CopyItemCommand::execute_command(), ModelView::InsertNewItemCommand::execute_command(), ModelView::RemoveItemCommand::execute_command(), and ModelView::SetValueCommand::swap_values().
|
protected |
Definition at line 126 of file abstractitemcommand.cpp.
References p_impl.
Referenced by ModelView::CopyItemCommand::CopyItemCommand(), ModelView::InsertNewItemCommand::InsertNewItemCommand(), ModelView::MoveItemCommand::MoveItemCommand(), ModelView::RemoveItemCommand::RemoveItemCommand(), ModelView::SetValueCommand::SetValueCommand(), ModelView::CopyItemCommand::execute_command(), ModelView::InsertNewItemCommand::execute_command(), ModelView::RemoveItemCommand::execute_command(), ModelView::SetValueCommand::swap_values(), ModelView::CopyItemCommand::undo_command(), and ModelView::InsertNewItemCommand::undo_command().
void AbstractItemCommand::undo | ( | ) |
Undo command as it was before execution.
Definition at line 68 of file abstractitemcommand.cpp.
References p_impl, and undo_command().
Referenced by TEST_F().
|
privatepure virtual |
Implemented in ModelView::SetValueCommand, ModelView::RemoveItemCommand, ModelView::MoveItemCommand, ModelView::InsertNewItemCommand, and ModelView::CopyItemCommand.
Referenced by undo().
|
private |
Definition at line 62 of file abstractitemcommand.h.
Referenced by AbstractItemCommand(), description(), execute(), isObsolete(), itemFromPath(), model(), result(), setDescription(), setObsolete(), setResult(), and undo().