Kate::TextBlock
#include <katetextblock.h>
Public Member Functions | |
TextBlock (TextBuffer *buffer, int blockIndex) | |
~TextBlock () | |
void | appendLine (const QString &textOfLine) |
int | blockSize () const |
void | clearBlockContent (TextBlock *targetBlock) |
void | clearLines () |
bool | containsRange (TextRange *range) const |
void | debugPrint (int blockIndex) const |
void | deleteBlockContent () |
void | insertCursor (Kate::TextCursor *cursor) |
void | insertText (const KTextEditor::Cursor position, const QString &text) |
TextLine | line (int line) const |
int | lineLength (int line) const |
int | lines () const |
void | markModifiedLinesAsSaved () |
void | mergeBlock (TextBlock *targetBlock) |
KTEXTEDITOR_EXPORT QList< TextRange * > | rangesForLine (int line, KTextEditor::View *view, bool rangesWithAttributeOnly) const |
KTEXTEDITOR_NO_EXPORT void | rangesForLine (int line, KTextEditor::View *view, bool rangesWithAttributeOnly, QList< TextRange * > &outRanges) const |
void | removeCursor (Kate::TextCursor *cursor) |
void | removeRange (TextRange *range) |
void | removeText (KTextEditor::Range range, QString &removedText) |
void | setBlockIndex (int index) |
void | setLineMetaData (int line, const TextLine &textLine) |
void | splitBlock (int fromLine, TextBlock *newBlock) |
KTEXTEDITOR_EXPORT int | startLine () const |
void | text (QString &text) const |
void | unwrapLine (int line, TextBlock *previousBlock, int fixStartLinesStartIndex) |
void | updateRange (TextRange *range) |
void | wrapLine (const KTextEditor::Cursor position, int fixStartLinesStartIndex) |
Detailed Description
Class representing a text block.
This is used to build up a Kate::TextBuffer. This class should only be used by TextBuffer/Cursor/Range.
Definition at line 35 of file katetextblock.h.
Constructor & Destructor Documentation
◆ TextBlock()
Kate::TextBlock::TextBlock | ( | TextBuffer * | buffer, |
int | blockIndex ) |
Construct an empty text block.
- Parameters
-
buffer parent text buffer startLine start line of this block
Definition at line 14 of file katetextblock.cpp.
◆ ~TextBlock()
Kate::TextBlock::~TextBlock | ( | ) |
Destruct the text block.
Definition at line 22 of file katetextblock.cpp.
Member Function Documentation
◆ appendLine()
void Kate::TextBlock::appendLine | ( | const QString & | textOfLine | ) |
Append a new line with given text.
- Parameters
-
textOfLine text of the line to append
Definition at line 56 of file katetextblock.cpp.
◆ blockSize()
|
inline |
Returns the size of this block i.e., the count of QChars it has + number of new lines.
Definition at line 236 of file katetextblock.h.
◆ clearBlockContent()
void Kate::TextBlock::clearBlockContent | ( | TextBlock * | targetBlock | ) |
Clear the block content, delete all lines, move all cursors not bound to range to given block at 0,0.
This is used by clear() of TextBuffer.
- Parameters
-
targetBlock empty target block for cursors
Definition at line 608 of file katetextblock.cpp.
◆ clearLines()
void Kate::TextBlock::clearLines | ( | ) |
Clear the lines.
Definition at line 62 of file katetextblock.cpp.
◆ containsRange()
|
inline |
Is the given range contained in this block?
- Parameters
-
range range to check for
- Returns
- contained in this blocks mapping?
Definition at line 191 of file katetextblock.h.
◆ debugPrint()
void Kate::TextBlock::debugPrint | ( | int | blockIndex | ) | const |
Debug output, print whole block content with line numbers and line length.
- Parameters
-
blockIndex index of this block in buffer
Definition at line 492 of file katetextblock.cpp.
◆ deleteBlockContent()
void Kate::TextBlock::deleteBlockContent | ( | ) |
Delete the block content, delete all lines and delete all cursors not bound to ranges.
This is used in destructor of TextBuffer, for fast cleanup. Only stuff remaining afterwards are cursors which are part of a range, TextBuffer will delete them itself...
Definition at line 584 of file katetextblock.cpp.
◆ insertCursor()
|
inline |
Insert cursor into this block.
- Parameters
-
cursor cursor to insert
Definition at line 205 of file katetextblock.h.
◆ insertText()
void Kate::TextBlock::insertText | ( | const KTextEditor::Cursor | position, |
const QString & | text ) |
Insert text at given cursor position.
- Parameters
-
position position where to insert text text text to insert
Definition at line 350 of file katetextblock.cpp.
◆ line()
TextLine Kate::TextBlock::line | ( | int | line | ) | const |
Retrieve a text line.
- Parameters
-
line wanted line number
- Returns
- text line
Definition at line 37 of file katetextblock.cpp.
◆ lineLength()
|
inline |
Retrieve length for line
.
- Parameters
-
line wanted line number
- Returns
- length of line
Definition at line 80 of file katetextblock.h.
◆ lines()
|
inline |
Number of lines in this block.
- Returns
- number of lines
Definition at line 101 of file katetextblock.h.
◆ markModifiedLinesAsSaved()
void Kate::TextBlock::markModifiedLinesAsSaved | ( | ) |
Flag all modified text lines as saved on disk.
Definition at line 674 of file katetextblock.cpp.
◆ mergeBlock()
void Kate::TextBlock::mergeBlock | ( | TextBlock * | targetBlock | ) |
Merge this block with given one, the given one must be a direct predecessor.
- Parameters
-
targetBlock block to merge with
Definition at line 551 of file katetextblock.cpp.
◆ rangesForLine() [1/2]
QList< TextRange * > Kate::TextBlock::rangesForLine | ( | int | line, |
KTextEditor::View * | view, | ||
bool | rangesWithAttributeOnly ) const |
Return all ranges in this block which might intersect the given line.
- Parameters
-
line line to check intersection view only return ranges associated with given view rangesWithAttributeOnly ranges with attributes only?
- Returns
- list of possible candidate ranges
Definition at line 632 of file katetextblock.cpp.
◆ rangesForLine() [2/2]
void Kate::TextBlock::rangesForLine | ( | int | line, |
KTextEditor::View * | view, | ||
bool | rangesWithAttributeOnly, | ||
QList< TextRange * > & | outRanges ) const |
Definition at line 641 of file katetextblock.cpp.
◆ removeCursor()
|
inline |
Remove cursor from this block.
- Parameters
-
cursor cursor to remove
Definition at line 214 of file katetextblock.h.
◆ removeRange()
void Kate::TextBlock::removeRange | ( | TextRange * | range | ) |
Remove a range from this block.
- Parameters
-
range range to remove
Definition at line 736 of file katetextblock.cpp.
◆ removeText()
void Kate::TextBlock::removeText | ( | KTextEditor::Range | range, |
QString & | removedText ) |
Remove text at given range.
- Parameters
-
range range of text to remove, must be on one line only. removedText will be filled with removed text
Definition at line 421 of file katetextblock.cpp.
◆ setBlockIndex()
|
inline |
Definition at line 56 of file katetextblock.h.
◆ setLineMetaData()
void Kate::TextBlock::setLineMetaData | ( | int | line, |
const TextLine & | textLine ) |
Transfer all non text attributes for the given line from the given text line to the one in the block.
- Parameters
-
line line number to set attributes textLine line reference to get attributes from
Definition at line 45 of file katetextblock.cpp.
◆ splitBlock()
void Kate::TextBlock::splitBlock | ( | int | fromLine, |
TextBlock * | newBlock ) |
Split given block.
All lines starting from fromLine
will be moved to it, together with the cursors belonging to it.
- Parameters
-
fromLine line from which to split newBlock The block to which the data will be moved after splitting
Definition at line 504 of file katetextblock.cpp.
◆ startLine()
int Kate::TextBlock::startLine | ( | ) | const |
Start line of this block.
- Returns
- start line of this block
Definition at line 32 of file katetextblock.cpp.
◆ text()
void Kate::TextBlock::text | ( | QString & | text | ) | const |
Retrieve text of block.
- Parameters
-
text for this block, lines separated by '
'
Definition at line 68 of file katetextblock.cpp.
◆ unwrapLine()
void Kate::TextBlock::unwrapLine | ( | int | line, |
TextBlock * | previousBlock, | ||
int | fixStartLinesStartIndex ) |
Unwrap given line.
- Parameters
-
line line to unwrap previousBlock previous block, if any, if we unwrap first line in block, we need to have this fixStartLinesStartIndex start index to fix start lines, normally this is this block or the previous one
Definition at line 185 of file katetextblock.cpp.
◆ updateRange()
void Kate::TextBlock::updateRange | ( | TextRange * | range | ) |
Update a range from this block.
Will move the range to right set, either cached for one-line ranges or not.
- Parameters
-
range range to update
Definition at line 684 of file katetextblock.cpp.
◆ wrapLine()
void Kate::TextBlock::wrapLine | ( | const KTextEditor::Cursor | position, |
int | fixStartLinesStartIndex ) |
Wrap line at given cursor position.
- Parameters
-
position line/column as cursor where to wrap fixStartLinesStartIndex start index to fix start lines, normally this is this block
Definition at line 77 of file katetextblock.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Sep 13 2024 11:55:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.