edbee - Qt Editor Library
|
This class represents the textbuffer of the editor. More...
#include <textbuffer.h>
Signals | |
void | textAboutToBeChanged (edbee::TextBufferChange change) |
void | textChanged (edbee::TextBufferChange change) |
Public Member Functions | |
TextBuffer (QObject *parent=0) | |
The textbuffer constructor. More... | |
virtual int | length () const =0 |
should return the number of 'characters'. More... | |
virtual QChar | charAt (int offset) const =0 |
A method for returning a single char. More... | |
virtual QString | textPart (int offset, int length) const =0 |
return the given text. More... | |
virtual void | replaceText (int offset, int length, const QChar *buffer, int bufferLength)=0 |
this method should replace the given text And fire a 'text-replaced' signal More... | |
virtual int | lineCount ()=0 |
this method should return an array with all line offsets. A line offset pointsto the START of a line So it does NOT point to a newline character, but it points to the first character AFTER the newline character More... | |
virtual int | lineFromOffset (int offset)=0 |
virtual int | offsetFromLine (int line)=0 |
virtual void | rawAppendBegin ()=0 |
This method starts raw appending. More... | |
virtual void | rawAppend (QChar c)=0 |
this method should append the given character to the buffer More... | |
virtual void | rawAppend (const QChar *data, int dataLength)=0 |
This method should raw append the given character string. More... | |
virtual void | rawAppendEnd ()=0 |
the end raw append method should bring the document in a consistent state and emit the correct "replaceText" signals More... | |
virtual QChar * | rawDataPointer ()=0 |
This method returns the raw data buffer. WARNING this method CAN be slow because when using a gapvector the gap is moved to the end to make a full buffer Modifying the content of the data will mess up the line-offset-vector and other dependent classes. For reading it's ok :-) More... | |
virtual void | replaceText (int offset, int length, const QString &text) |
Replace the given text. More... | |
QString | text () |
Returns the full text as a QString. More... | |
void | setText (const QString &text) |
A convenient method for directly filling the textbuffer with the given content. More... | |
virtual int | columnFromOffsetAndLine (int offset, int line=-1) |
this method translates the given position to a column number. More... | |
virtual void | appendText (const QString &text) |
Appends the given text to the textbuffer. More... | |
virtual int | offsetFromLineAndColumn (int line, int col) |
This method returns the offset from the give line and column If the column exceed the number of column the caret is placed just before the newline. More... | |
virtual QString | line (int line) |
Returns the line at the given line position. This line INCLUDES the newline character (if it's there) More... | |
virtual QString | lineWithoutNewline (int line) |
Returns the line without the newline character. More... | |
virtual int | lineLength (int line) |
Returns the length of the given line. Also counting the trailing newline character if present. More... | |
virtual int | lineLengthWithoutNewline (int line) |
Returns the length of the given line. Without counting a trailing newline character. More... | |
virtual void | replaceText (const TextRange &range, const QString &text) |
replace the texts More... | |
virtual int | findCharPos (int offset, int direction, const QString &chars, bool equals) |
See documentation at findCharPosWithinRange. More... | |
virtual int | findCharPosWithinRange (int offset, int direction, const QString &chars, bool equals, int beginRange, int endRange) |
This method finds the find the first character position that equals the given char. More... | |
virtual int | findCharPosOrClamp (int offset, int direction, const QString &chars, bool equals) |
See documentation at findCharPosWithinRange. This method searches a char position within the given rang (from the given ofset) More... | |
virtual int | findCharPosWithinRangeOrClamp (int offset, int direction, const QString &chars, bool equals, int beginRange, int endRange) |
See documentation at findCharPosWithinRange. This method searches a char position within the given rang (from the given ofset) More... | |
virtual QString | lineOffsetsAsString () |
This class represents the textbuffer of the editor.
edbee::TextBuffer::TextBuffer | ( | QObject * | parent = 0 | ) |
The textbuffer constructor.
|
virtual |
Appends the given text to the textbuffer.
text | the text to appendf |
|
pure virtual |
A method for returning a single char.
Implemented in edbee::CharTextBuffer.
|
virtual |
this method translates the given position to a column number.
offset | the character offset |
line | the line index this position is on. (Use this argument for optimization if you already know this) |
|
virtual |
See documentation at findCharPosWithinRange.
offset | the offset to start searching direction the direction (left < 0, or right > 0 ) |
chars | the chars to search |
equals | when setting to true if will search for the first given char. When false it will stop when another char is found |
|
virtual |
See documentation at findCharPosWithinRange. This method searches a char position within the given rang (from the given ofset)
|
virtual |
This method finds the find the first character position that equals the given char.
offset | the offset to search from. A negative offset means the CURRENT character isn't used |
direction | the direction to search. If the direction is multiple. the nth item is returned |
chars | the character direction |
equals | when setting to true if will search for the first given char. When false it will stop when another char is found |
beginRange | the start of the range to search in |
endRange | the end of the range to search in (exclusive) |
|
virtual |
See documentation at findCharPosWithinRange. This method searches a char position within the given rang (from the given ofset)
|
pure virtual |
should return the number of 'characters'.
Implemented in edbee::CharTextBuffer.
|
virtual |
Returns the line at the given line position. This line INCLUDES the newline character (if it's there)
line | the line to return |
|
pure virtual |
this method should return an array with all line offsets. A line offset pointsto the START of a line So it does NOT point to a newline character, but it points to the first character AFTER the newline character
Implemented in edbee::CharTextBuffer.
|
pure virtual |
Implemented in edbee::CharTextBuffer.
|
virtual |
Returns the length of the given line. Also counting the trailing newline character if present.
line | the line to retrieve the length for |
|
virtual |
Returns the length of the given line. Without counting a trailing newline character.
line | the line to retrieve the length for |
|
virtual |
|
virtual |
Returns the line without the newline character.
|
pure virtual |
Implemented in edbee::CharTextBuffer.
|
virtual |
This method returns the offset from the give line and column If the column exceed the number of column the caret is placed just before the newline.
|
pure virtual |
this method should append the given character to the buffer
Implemented in edbee::CharTextBuffer.
|
pure virtual |
This method should raw append the given character string.
Implemented in edbee::CharTextBuffer.
|
pure virtual |
This method starts raw appending.
Implemented in edbee::CharTextBuffer.
|
pure virtual |
the end raw append method should bring the document in a consistent state and emit the correct "replaceText" signals
WARNING the textAboutToBeReplaced signals are given but at that moment the text is already replaced And the newlines are already added to the newline list!
Implemented in edbee::CharTextBuffer.
|
pure virtual |
This method returns the raw data buffer. WARNING this method CAN be slow because when using a gapvector the gap is moved to the end to make a full buffer Modifying the content of the data will mess up the line-offset-vector and other dependent classes. For reading it's ok :-)
Implemented in edbee::CharTextBuffer.
|
pure virtual |
this method should replace the given text And fire a 'text-replaced' signal
Implemented in edbee::CharTextBuffer.
|
virtual |
Replace the given text.
Replaces the given text.
offset | the offset to replace |
length | the of the text to replace |
text | the new text to insert |
|
virtual |
replace the texts
range | the range to replace |
text | the text to insert at the given location |
void edbee::TextBuffer::setText | ( | const QString & | text | ) |
A convenient method for directly filling the textbuffer with the given content.
QString edbee::TextBuffer::text | ( | ) |
Returns the full text as a QString.
|
signal |
|
signal |
|
pure virtual |
return the given text.
Implemented in edbee::CharTextBuffer.