edbee - Qt Editor Library
Public Member Functions | List of all members
edbee::Change Class Referenceabstract

A basic change. More...

#include <change.h>

+ Inheritance diagram for edbee::Change:
+ Collaboration diagram for edbee::Change:

Public Member Functions

virtual ~Change ()
 a virtual empty destructor More...
 
virtual void execute (TextDocument *document)=0
 This method should execute the command. More...
 
virtual void revert (TextDocument *)
 this method reverts the given operation More...
 
virtual bool giveAndMerge (TextDocument *document, Change *textChange)
 Gives the change and merges it if possible. This method should return false if the change couldn't be merged. When the method returns true the ownership of the given textchange is transfered to this class. More...
 
virtual bool canUndo ()
 This method should return true if the change can be reverted. More...
 
virtual bool isPersistenceRequired ()
 This flag is used to mark this stack item as non-persistence requirable The default behaviour is that every textchange requires persistence. It is also possible to have certain changes that do not require persitence but should be placed on the undo stack. More...
 
virtual TextEditorControllercontrollerContext ()
 A text command can belong to a controller/view When it's a view only command. The undo only applies only to this view warning a DOCUMENT change may NEVER return a controllerContext!! More...
 
bool isDocumentChange ()
 this method can be used to check if the given change is a document change More...
 
virtual bool isGroup ()
 This method returns true if this change is a group change. When an object is group change it should be inherited by TextChangeGroup. More...
 
virtual QString toString ()=0
 

Detailed Description

A basic change.

Constructor & Destructor Documentation

◆ ~Change()

edbee::Change::~Change ( )
virtual

a virtual empty destructor

Member Function Documentation

◆ canUndo()

bool edbee::Change::canUndo ( )
virtual

This method should return true if the change can be reverted.

◆ controllerContext()

TextEditorController * edbee::Change::controllerContext ( )
virtual

A text command can belong to a controller/view When it's a view only command. The undo only applies only to this view warning a DOCUMENT change may NEVER return a controllerContext!!

Reimplemented in edbee::ChangeGroup, and edbee::ControllerChange.

◆ execute()

virtual void edbee::Change::execute ( TextDocument document)
pure virtual

◆ giveAndMerge()

bool edbee::Change::giveAndMerge ( TextDocument document,
Change textChange 
)
virtual

Gives the change and merges it if possible. This method should return false if the change couldn't be merged. When the method returns true the ownership of the given textchange is transfered to this class.

Parameters
documentthe document this change is for
textChangethe textchange
Returns
true if the merge succeeded. The textChange ownership is only tranfered if true if returend

Reimplemented in edbee::ChangeGroup, edbee::MergableChangeGroup, edbee::TextChange, edbee::SelectionChange, edbee::LineDataListChange, and edbee::LineDataChange.

◆ isDocumentChange()

bool edbee::Change::isDocumentChange ( )

this method can be used to check if the given change is a document change

◆ isGroup()

bool edbee::Change::isGroup ( )
virtual

This method returns true if this change is a group change. When an object is group change it should be inherited by TextChangeGroup.

Reimplemented in edbee::ChangeGroup.

◆ isPersistenceRequired()

bool edbee::Change::isPersistenceRequired ( )
virtual

This flag is used to mark this stack item as non-persistence requirable The default behaviour is that every textchange requires persistence. It is also possible to have certain changes that do not require persitence but should be placed on the undo stack.

Reimplemented in edbee::EmptyDocumentChange.

◆ revert()

void edbee::Change::revert ( TextDocument )
virtual

◆ toString()

virtual QString edbee::Change::toString ( )
pure virtual

The documentation for this class was generated from the following files: