Kate::TextBlock

Search for usage in LXR

Kate::TextBlock Class Reference

#include <katetextblock.h>

Public Member Functions

 TextBlock (TextBuffer *buffer, int blockIndex)
 
 ~TextBlock ()
 
void appendLine (const QString &textOfLine)
 
void clearLines ()
 
void debugPrint (int blockIndex) const
 
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_NO_EXPORT void rangesForLine (int line, KTextEditor::View *view, bool rangesWithAttributeOnly, QList< TextRange * > &outRanges) const
 
void removeCursor (Kate::TextCursor *cursor)
 
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 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 33 of file katetextblock.h.

Constructor & Destructor Documentation

◆ TextBlock()

Kate::TextBlock::TextBlock ( TextBuffer * buffer,
int blockIndex )

Construct an empty text block.

Parameters
bufferparent text buffer
startLinestart 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
textOfLinetext of the line to append

Definition at line 55 of file katetextblock.cpp.

◆ clearLines()

void Kate::TextBlock::clearLines ( )

Clear the lines.

Definition at line 60 of file katetextblock.cpp.

◆ debugPrint()

void Kate::TextBlock::debugPrint ( int blockIndex) const

Debug output, print whole block content with line numbers and line length.

Parameters
blockIndexindex of this block in buffer

Definition at line 485 of file katetextblock.cpp.

◆ insertCursor()

void Kate::TextBlock::insertCursor ( Kate::TextCursor * cursor)
inline

Insert cursor into this block.

Parameters
cursorcursor to insert

Definition at line 179 of file katetextblock.h.

◆ insertText()

void Kate::TextBlock::insertText ( const KTextEditor::Cursor position,
const QString & text )

Insert text at given cursor position.

Parameters
positionposition where to insert text
texttext to insert

Definition at line 347 of file katetextblock.cpp.

◆ line()

TextLine Kate::TextBlock::line ( int line) const

Retrieve a text line.

Parameters
linewanted line number
Returns
text line

Definition at line 36 of file katetextblock.cpp.

◆ lineLength()

int Kate::TextBlock::lineLength ( int line) const
inline

Retrieve length for line.

Parameters
linewanted line number
Returns
length of line

Definition at line 80 of file katetextblock.h.

◆ lines()

int Kate::TextBlock::lines ( ) const
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 605 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
targetBlockblock to merge with

Definition at line 543 of file katetextblock.cpp.

◆ rangesForLine()

void Kate::TextBlock::rangesForLine ( int line,
KTextEditor::View * view,
bool rangesWithAttributeOnly,
QList< TextRange * > & outRanges ) const

Append to outRanges addresses of all ranges in this block which might intersect the given line.

Parameters
lineline to check intersection
viewonly return ranges associated with given view
rangesWithAttributeOnlyranges with attributes only?
outRangeswhere to append results

Definition at line 572 of file katetextblock.cpp.

◆ removeCursor()

void Kate::TextBlock::removeCursor ( Kate::TextCursor * cursor)
inline

Remove cursor from this block.

Parameters
cursorcursor to remove

Definition at line 191 of file katetextblock.h.

◆ removeText()

void Kate::TextBlock::removeText ( KTextEditor::Range range,
QString & removedText )

Remove text at given range.

Parameters
rangerange of text to remove, must be on one line only.
removedTextwill be filled with removed text

Definition at line 416 of file katetextblock.cpp.

◆ setBlockIndex()

void Kate::TextBlock::setBlockIndex ( int index)
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
lineline number to set attributes
textLineline reference to get attributes from

Definition at line 44 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
fromLineline from which to split
newBlockThe block to which the data will be moved after splitting

Definition at line 497 of file katetextblock.cpp.

◆ startLine()

int Kate::TextBlock::startLine ( ) const

Start line of this block.

Returns
start line of this block

Definition at line 31 of file katetextblock.cpp.

◆ text()

void Kate::TextBlock::text ( QString & text) const

Retrieve text of block.

Parameters
textfor this block, lines separated by '
'

Definition at line 65 of file katetextblock.cpp.

◆ unwrapLine()

void Kate::TextBlock::unwrapLine ( int line,
TextBlock * previousBlock,
int fixStartLinesStartIndex )

Unwrap given line.

Parameters
lineline to unwrap
previousBlockprevious block, if any, if we unwrap first line in block, we need to have this
fixStartLinesStartIndexstart index to fix start lines, normally this is this block or the previous one

Definition at line 178 of file katetextblock.cpp.

◆ wrapLine()

void Kate::TextBlock::wrapLine ( const KTextEditor::Cursor position,
int fixStartLinesStartIndex )

Wrap line at given cursor position.

Parameters
positionline/column as cursor where to wrap
fixStartLinesStartIndexstart index to fix start lines, normally this is this block

Definition at line 74 of file katetextblock.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:56 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.