This is an abstract class for ranged changes This are changes (text changes and line changes) that span a range in an array. These ranges share a common alogrithm for performing merges, detecting overlaps etc.
More...
#include <abstractrangedchange.h>
|
virtual | ~AbstractRangedChange () |
| default destructor is empty More...
|
|
virtual int | offset () const =0 |
| this method should return the offset of the change More...
|
|
virtual void | setOffset (int value)=0 |
| this method should set the offset More...
|
|
void | addOffset (int amount) |
| Adds the given amount to the offset. More...
|
|
virtual void | setDocLength (int value)=0 |
| this method should set the old length More...
|
|
virtual int | docLength () const =0 |
| this method should return the length in the document More...
|
|
virtual int | storedLength () const =0 |
| this method should return the length of this item in memory More...
|
|
bool | isOverlappedBy (AbstractRangedChange *secondChange) |
| This method checks if this textchange is overlapped by the second text change overlapping is an exclusive overlap, which means the changes are really on top of eachother to test if the changes are touching use isTouchedBy. More...
|
|
bool | isTouchedBy (AbstractRangedChange *secondChange) |
| Touched ranges are ranges that are next to eachother Touching means the end offset of one range is the start offset of the other range. More...
|
|
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 TextEditorController * | controllerContext () |
| 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 |
|
This is an abstract class for ranged changes This are changes (text changes and line changes) that span a range in an array. These ranges share a common alogrithm for performing merges, detecting overlaps etc.
◆ ~AbstractRangedChange()
edbee::AbstractRangedChange::~AbstractRangedChange |
( |
| ) |
|
|
virtual |
default destructor is empty
◆ addOffset()
void edbee::AbstractRangedChange::addOffset |
( |
int |
amount | ) |
|
Adds the given amount to the offset.
- Parameters
-
◆ docLength()
virtual int edbee::AbstractRangedChange::docLength |
( |
| ) |
const |
|
pure virtual |
◆ getMergedDocLength()
Calculates the merged length.
- Parameters
-
change | the change that't being merged |
◆ getMergedStoredLength()
Calculates the merge data size, that's required for merging the given change.
- Parameters
-
change | the change to merge with this change |
- Returns
- the size of this change
◆ isOverlappedBy()
This method checks if this textchange is overlapped by the second text change overlapping is an exclusive overlap, which means the changes are really on top of eachother to test if the changes are touching use isTouchedBy.
- Parameters
-
secondChange | the other change to compare it to |
- Returns
- tue if the changes overlap
◆ isTouchedBy()
Touched ranges are ranges that are next to eachother Touching means the end offset of one range is the start offset of the other range.
- Parameters
-
secondChange | the other change to match |
- Returns
- true if the changes overlap
◆ merge()
This method merges the change.
- Parameters
-
document | the document to merges |
change | the change change to merge |
◆ mergeStoredData()
implement this method to merge to old data. Sample implementation
SingleTextChange* singleTextChange = dynamic_cast<SingleTextChange*>(change); QString newText; newText.resize( calculateMergeDataSize( change) ); mergeData( newText.data(), text_.data(), singleTextChange->text_.data(), change, sizeof(QChar) );
Implemented in edbee::LineDataListChange, and edbee::TextChange.
◆ mergeStoredDataViaMemcopy()
void edbee::AbstractRangedChange::mergeStoredDataViaMemcopy |
( |
void * |
targetData, |
|
|
void * |
data, |
|
|
void * |
changeData, |
|
|
AbstractRangedChange * |
change, |
|
|
int |
itemSize |
|
) |
| |
|
protected |
This method merges the data via a memcopy. I really don't like this way of merging the data. though this is a way which support all kinds of arrays. I cannot use inheritance, because the types like QString don't have a common ancestor.
- Parameters
-
targetData | the target of the data, (be sure enough space is reserved!! |
data | pointer to the data of this change (this can be a 0 pointer!, which results in 0-filling the target) |
changeData | pointer to the of the other change data (this can be a 0 pointer!, which results in 0-filling the target) |
change | the other change of the data to merge |
itemSize | the size of single item |
◆ offset()
virtual int edbee::AbstractRangedChange::offset |
( |
| ) |
const |
|
pure virtual |
◆ setDocLength()
virtual void edbee::AbstractRangedChange::setDocLength |
( |
int |
value | ) |
|
|
pure virtual |
◆ setOffset()
virtual void edbee::AbstractRangedChange::setOffset |
( |
int |
value | ) |
|
|
pure virtual |
◆ storedLength()
virtual int edbee::AbstractRangedChange::storedLength |
( |
| ) |
const |
|
pure virtual |
The documentation for this class was generated from the following files: