edbee - Qt Editor Library
Public Member Functions | List of all members
edbee::TextChangeWithCaret Class Reference

A single text-change with an extra offset which represents the location of the caret. Currently this class is passed a TextDocumentFilter which enables it to alter the caret position I'm in doubt if we really need to implement it this way. More...

#include <textchangewithcaret.h>

+ Inheritance diagram for edbee::TextChangeWithCaret:
+ Collaboration diagram for edbee::TextChangeWithCaret:

Public Member Functions

 TextChangeWithCaret (int offset, int length, const QString &text, int caret)
 
int caret () const
 returns the caret position More...
 
void setCaret (int caret)
 Sets the caret position. More...
 
- Public Member Functions inherited from edbee::TextChange
 TextChange (int offset, int length, const QString &text)
 Constructs a single textchange. More...
 
virtual ~TextChange ()
 undo's a single textchange More...
 
virtual void execute (TextDocument *document)
 executes the given textchange More...
 
virtual void revert (TextDocument *document)
 Reverts the single textchange. More...
 
virtual bool giveAndMerge (TextDocument *document, Change *textChange)
 This method gives the given change to this textchange. The changes will be merged if possible. This method currently only works with executed changes!!! More...
 
virtual QString toString ()
 converts the change to a string More...
 
int offset () const
 Return the offset. More...
 
void setOffset (int offset)
 set the new offset More...
 
virtual int docLength () const
 This is the length in the document. More...
 
virtual int storedLength () const
 The content length is the length that's currently stored in memory. More...
 
void setDocLength (int len)
 Set the length of the change. More...
 
QString storedText () const
 The text currently stored in this textchange. More...
 
void setStoredText (const QString &text)
 Sets the text of this change. More...
 
void appendStoredText (const QString &text)
 Appends the text to this change. More...
 
const QString docText (TextDocument *doc) const
 This method returns the text currently in the document. More...
 
QString testString ()
 This method returns a string used for testing. More...
 
- Public Member Functions inherited from edbee::AbstractRangedChange
virtual ~AbstractRangedChange ()
 default destructor is empty More...
 
void addOffset (int amount)
 Adds the given amount to the offset. 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...
 
- Public Member Functions inherited from edbee::Change
virtual ~Change ()
 a virtual empty destructor 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...
 

Additional Inherited Members

- Protected Member Functions inherited from edbee::TextChange
virtual void mergeStoredData (AbstractRangedChange *change)
 This method merges the old data with the new data change the data to merge with. More...
 
void replaceText (TextDocument *document)
 replaces the text and stores the 'old' content More...
 
- Protected Member Functions inherited from edbee::AbstractRangedChange
int getMergedDocLength (AbstractRangedChange *change)
 Calculates the merged length. More...
 
int getMergedStoredLength (AbstractRangedChange *change)
 Calculates the merge data size, that's required for merging the given change. More...
 
void mergeStoredDataViaMemcopy (void *targetData, void *data, void *changeData, AbstractRangedChange *change, int itemSize)
 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. More...
 
bool merge (AbstractRangedChange *change)
 This method merges the change. More...
 

Detailed Description

A single text-change with an extra offset which represents the location of the caret. Currently this class is passed a TextDocumentFilter which enables it to alter the caret position I'm in doubt if we really need to implement it this way.

Constructor & Destructor Documentation

◆ TextChangeWithCaret()

edbee::TextChangeWithCaret::TextChangeWithCaret ( int  offset,
int  length,
const QString &  text,
int  caret 
)

Member Function Documentation

◆ caret()

int edbee::TextChangeWithCaret::caret ( ) const

returns the caret position

◆ setCaret()

void edbee::TextChangeWithCaret::setCaret ( int  caret)

Sets the caret position.

Parameters
caretthe caret to set

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