SetPropertyBlockCommand.h header

#include <ew/core/SetPropertyBlockCommand.h>

Namespace ew::core

RemovePropertyBlockCommand class

class ew::core::RemovePropertyBlockCommand

Command that removes a property block.

Fields naming it are left alone: a field pointing at a block the project no longer has is reported by the validator, while silently retyping it would discard every value beneath it.

Members

ew::core::taxonomy::RemovePropertyBlockCommand::RemovePropertyBlockCommand(Taxonomy &taxonomy, ew::core::foundation::BlockId id)

Creates a command that will remove the block with id from taxonomy.

ew::core::taxonomy::RemovePropertyBlockCommand::~RemovePropertyBlockCommand() override

Destroys the command.

void ew::core::taxonomy::RemovePropertyBlockCommand::apply() override

Removes the block, remembering its definition.

void ew::core::taxonomy::RemovePropertyBlockCommand::undo() override

Puts the block back exactly as it was.

QString ew::core::taxonomy::RemovePropertyBlockCommand::description() const override

Returns a short description for the undo/redo UI.

ew::core::foundation::OperationSubject ew::core::taxonomy::RemovePropertyBlockCommand::subject() const override

Returns the subject this command changes. See Command::subject().

SetPropertyBlockCommand class

class ew::core::SetPropertyBlockCommand

Command that defines a property block, or replaces the definition of one that exists.

One command for both, because to an author they are the same act – "this is what a Stats block is" – and because undo has to restore the PREVIOUS definition, which a plain add could not do. Editing a block changes every property that uses it, everywhere, which is exactly why the change has to be one undoable step rather than a sequence a writer could land halfway through.

Members

ew::core::taxonomy::SetPropertyBlockCommand::SetPropertyBlockCommand(Taxonomy &taxonomy, PropertyBlock block)

Creates a command that will store block in taxonomy when applied.

ew::core::taxonomy::SetPropertyBlockCommand::~SetPropertyBlockCommand() override

Destroys the command.

void ew::core::taxonomy::SetPropertyBlockCommand::apply() override

Stores the held definition, remembering whatever was there before.

void ew::core::taxonomy::SetPropertyBlockCommand::undo() override

Restores the previous definition, or removes the block when there was none.

QString ew::core::taxonomy::SetPropertyBlockCommand::description() const override

Returns a short description for the undo/redo UI.

ew::core::foundation::OperationSubject ew::core::taxonomy::SetPropertyBlockCommand::subject() const override

Returns the subject this command changes. See Command::subject().