edbee - Qt Editor Library v0.11.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
edbee::ChangeGroup Class Reference

An undoable-command-group. More...

#include <change.h>

+ Inheritance diagram for edbee::ChangeGroup:
+ Collaboration diagram for edbee::ChangeGroup:

Public Member Functions

 ChangeGroup (TextEditorController *controller)
 default contructor
 
virtual ~ChangeGroup ()
 The destructor deletes all added textchanges.
 
virtual bool isGroup ()
 A group change is a group change, so this method returns true :)
 
virtual bool isDiscardable ()
 This method is called it the group is discardable. A discardable group will be optimized away if the group is empty, or if there's a single item in the group. A none-discardable group will always remain.
 
virtual void groupClosed ()
 This method is called if the group is closed and is added to the stack Default implementation is to do nothing.
 
virtual void execute (TextDocument *document)
 executes this command group
 
virtual void revert (TextDocument *document)
 Reverts the command gorup.
 
virtual bool giveAndMerge (TextDocument *document, Change *textChange)
 When another group is given, a merge is performed.
 
virtual void flatten ()
 This method flattens the undo-group by expanding all subgroups to local groups.
 
virtual void giveChange (TextDocument *doc, Change *change)
 
virtual Changeat (int idx)
 
virtual Changetake (int idx)
 
virtual int size ()
 
virtual void clear (bool performDelete=true)
 
Changelast ()
 This method returns the last change in the change group.
 
ChangetakeLast ()
 Takes the ownership of the last element and removes it from the stack.
 
int recursiveSize ()
 The total number of items in the list (excluding the group items)
 
virtual TextEditorControllercontrollerContext ()
 if this commandgroup only contains commands for a single controller context Then this context is returned else 0 is returned
 
virtual QString toString ()
 Converts this change group to a string.
 
- Public Member Functions inherited from edbee::ControllerChange
 ControllerChange (TextEditorController *controller)
 A controller specific textcommand. Warning you should NOT modify the textdocument!
 
virtual TextEditorControllercontroller ()
 returns the controller
 
- Public Member Functions inherited from edbee::Change
virtual ~Change ()
 a virtual empty destructor
 
virtual bool canUndo ()
 This method should return true if the change can be reverted.
 
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.
 
bool isDocumentChange ()
 this method can be used to check if the given change is a document change
 

Detailed Description

An undoable-command-group.

Constructor & Destructor Documentation

◆ ChangeGroup()

edbee::ChangeGroup::ChangeGroup ( TextEditorController * controller)

default contructor

Parameters
controllerthe controller this groups belongs to

◆ ~ChangeGroup()

edbee::ChangeGroup::~ChangeGroup ( )
virtual

The destructor deletes all added textchanges.

Member Function Documentation

◆ at()

Change * edbee::ChangeGroup::at ( int idx)
virtual

Reimplemented in edbee::MergableChangeGroup.

◆ clear()

void edbee::ChangeGroup::clear ( bool performDelete = true)
virtual

Reimplemented in edbee::MergableChangeGroup.

◆ controllerContext()

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

if this commandgroup only contains commands for a single controller context Then this context is returned else 0 is returned

0 is always 0!

Reimplemented from edbee::ControllerChange.

◆ execute()

void edbee::ChangeGroup::execute ( TextDocument * document)
virtual

executes this command group

Parameters
documentthe document the document to execute this for

Implements edbee::Change.

Reimplemented in edbee::MergableChangeGroup.

◆ flatten()

void edbee::ChangeGroup::flatten ( )
virtual

This method flattens the undo-group by expanding all subgroups to local groups.

◆ giveAndMerge()

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

When another group is given, a merge is performed.

Reimplemented from edbee::Change.

Reimplemented in edbee::MergableChangeGroup.

◆ giveChange()

void edbee::ChangeGroup::giveChange ( TextDocument * doc,
Change * change )
virtual

Reimplemented in edbee::MergableChangeGroup.

◆ groupClosed()

void edbee::ChangeGroup::groupClosed ( )
virtual

This method is called if the group is closed and is added to the stack Default implementation is to do nothing.

Reimplemented in edbee::MergableChangeGroup.

◆ isDiscardable()

bool edbee::ChangeGroup::isDiscardable ( )
virtual

This method is called it the group is discardable. A discardable group will be optimized away if the group is empty, or if there's a single item in the group. A none-discardable group will always remain.

Reimplemented in edbee::MergableChangeGroup.

◆ isGroup()

bool edbee::ChangeGroup::isGroup ( )
virtual

A group change is a group change, so this method returns true :)

Reimplemented from edbee::Change.

◆ last()

Change * edbee::ChangeGroup::last ( )

This method returns the last change in the change group.

Returns
the last textchange

◆ recursiveSize()

int edbee::ChangeGroup::recursiveSize ( )

The total number of items in the list (excluding the group items)

Returns
the number of items recussive (iterating) all groups

◆ revert()

void edbee::ChangeGroup::revert ( TextDocument * document)
virtual

Reverts the command gorup.

Reimplemented from edbee::Change.

Reimplemented in edbee::MergableChangeGroup.

◆ size()

int edbee::ChangeGroup::size ( )
virtual

Reimplemented in edbee::MergableChangeGroup.

◆ take()

Change * edbee::ChangeGroup::take ( int idx)
virtual

Reimplemented in edbee::MergableChangeGroup.

◆ takeLast()

Change * edbee::ChangeGroup::takeLast ( )

Takes the ownership of the last element and removes it from the stack.

Returns
the last textchange

◆ toString()

QString edbee::ChangeGroup::toString ( )
virtual

Converts this change group to a string.

Implements edbee::Change.

Reimplemented in edbee::MergableChangeGroup.


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