• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

Kate

  • Kate
  • TextBlock
Public Member Functions

Kate::TextBlock Class Reference

Class representing a text block. More...

#include <katetextblock.h>

List of all members.

Public Member Functions

 TextBlock (TextBuffer *buffer, int startLine)
 ~TextBlock ()
void appendLine (TextLine line)
void clearBlockContent (TextBlock *targetBlock)
bool containsRange (TextRange *range) const
void debugPrint (int blockIndex) const
void deleteBlockContent ()
void insertText (const KTextEditor::Cursor &position, const QString &text)
TextLine line (int line) const
int lines () const
void mergeBlock (TextBlock *targetBlock)
QList< QSet< TextRange * > > rangesForLine (int line) const
void removeText (const KTextEditor::Range &range, QString &removedText)
void setStartLine (int startLine)
TextBlock * splitBlock (int fromLine)
int startLine () const
void text (QString &text) const
void unwrapLine (int line, TextBlock *previousBlock)
void wrapLine (const KTextEditor::Cursor &position)

Detailed Description

Class representing a text block.

This is used to build up a Kate::TextBuffer.

Definition at line 41 of file katetextblock.h.


Constructor & Destructor Documentation

builddir build BUILD kdelibs kate buffer katetextblock cpp builddir build BUILD kdelibs kate buffer katetextblock cpp Kate::TextBlock::TextBlock ( TextBuffer *  buffer,
int  startLine 
)

Construct an empty text block.

Parameters:
bufferparent text buffer
startLinestart line of this block

Definition at line 28 of file katetextblock.cpp.

Kate::TextBlock::~TextBlock ( )

Destruct the text block.

Definition at line 34 of file katetextblock.cpp.


Member Function Documentation

void Kate::TextBlock::appendLine ( TextLine  line) [inline]

Append a new line.

Parameters:
lineline to append

Definition at line 82 of file katetextblock.h.

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:
targetBlockempty target block for cursors

Definition at line 502 of file katetextblock.cpp.

bool Kate::TextBlock::containsRange ( TextRange *  range) const [inline]

Is the given range contained in this block?

Parameters:
rangerange to check for
Returns:
contained in this blocks mapping?

Definition at line 172 of file katetextblock.h.

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 416 of file katetextblock.cpp.

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 490 of file katetextblock.cpp.

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

notify the text history

cursor and range handling below

Definition at line 293 of file katetextblock.cpp.

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

Retrieve a text line.

Parameters:
linewanted line number
Returns:
text line

Definition at line 52 of file katetextblock.cpp.

int Kate::TextBlock::lines ( ) const [inline]

Number of lines in this block.

Returns:
number of lines

Definition at line 88 of file katetextblock.h.

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 467 of file katetextblock.cpp.

QList<QSet<TextRange*> > Kate::TextBlock::rangesForLine ( int  line) const [inline]

Return all ranges in this block which might intersect the given line.

Parameters:
lineline to check intersection
Returns:
list of sets of possible candidate ranges

Definition at line 163 of file katetextblock.h.

void Kate::TextBlock::removeText ( const 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

notify the text history

cursor and range handling below

Definition at line 354 of file katetextblock.cpp.

void Kate::TextBlock::setStartLine ( int  startLine)

Set start line of this block.

Parameters:
startLinenew start line of this block

Definition at line 43 of file katetextblock.cpp.

TextBlock * Kate::TextBlock::splitBlock ( int  fromLine)

Split given block.

A new block will be created and all lines starting from the given index will be moved to it, together with the cursors belonging to it.

Parameters:
fromLineline from which to split
Returns:
new block containing the lines + cursors removed from this one

Definition at line 424 of file katetextblock.cpp.

int Kate::TextBlock::startLine ( ) const [inline]

Start line of this block.

Returns:
start line of this block

Definition at line 63 of file katetextblock.h.

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

Retrieve text of block.

Parameters:
textfor this block, lines separated by '
'

Definition at line 67 of file katetextblock.cpp.

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

Unwrap given line.

Parameters:
lineline to unwrap
previousBlockprevious block, if any, if we unwrap first line in block, we need to have this

notify the text history in advance

cursor and range handling below

notify the text history in advance

cursor and range handling below

Definition at line 159 of file katetextblock.cpp.

void Kate::TextBlock::wrapLine ( const KTextEditor::Cursor &  position)

Wrap line at given cursor position.

Parameters:
positionline/column as cursor where to wrap
nextBlocknext block, if any

notify the text history

cursor and range handling below

Definition at line 79 of file katetextblock.cpp.


The documentation for this class was generated from the following files:
  • katetextblock.h
  • katetextblock.cpp

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal