Kate::TextCursor

Search for usage in LXR

Kate::TextCursor Class Referencefinal

#include <katetextcursor.h>

Inheritance diagram for Kate::TextCursor:

Public Member Functions

 TextCursor (TextBuffer &buffer, const KTextEditor::Cursor position, InsertBehavior insertBehavior)
 
 ~TextCursor () override
 
TextBlockblock () const
 
int column () const override
 
int columnInternal () const
 
KTextEditor::Documentdocument () const override
 
InsertBehavior insertBehavior () const override
 
Kate::TextRangekateRange () const
 
int line () const override
 
int lineInBlock () const
 
int lineInternal () const
 
KTextEditor::MovingRangerange () const override
 
void setInsertBehavior (InsertBehavior insertBehavior) override
 
void setPosition (const KTextEditor::Cursor &position) override
 
void setPosition (const TextCursor &position)
 
void setPosition (int line, int column)
 
- Public Member Functions inherited from KTextEditor::MovingCursor
virtual ~MovingCursor ()
 
bool atEndOfDocument () const
 
bool atEndOfLine () const
 
bool atStartOfDocument () const
 
bool atStartOfLine () const
 
bool gotoNextLine ()
 
bool gotoPreviousLine ()
 
bool isValid () const
 
bool isValidTextPosition () const
 
bool move (int chars, WrapBehavior wrapBehavior=Wrap)
 
 operator Cursor () const
 
void setColumn (int column)
 
void setLine (int line)
 
void setPosition (int line, int column)
 
const Cursor toCursor () const
 

Additional Inherited Members

- Public Types inherited from KTextEditor::MovingCursor
enum  InsertBehavior { StayOnInsert = 0x0, MoveOnInsert = 0x1 }
 
enum  WrapBehavior { Wrap = 0x0, NoWrap = 0x1 }
 
- Protected Member Functions inherited from KTextEditor::MovingCursor
 MovingCursor ()
 

Detailed Description

Class representing a 'clever' text cursor.

It will automagically move if the text inside the buffer it belongs to is modified. By intention no subclass of KTextEditor::Cursor, must be converted manually.

Definition at line 29 of file katetextcursor.h.

Constructor & Destructor Documentation

◆ TextCursor()

Kate::TextCursor::TextCursor ( TextBuffer buffer,
const KTextEditor::Cursor  position,
InsertBehavior  insertBehavior 
)

Construct a text cursor.

Parameters
buffertext buffer this cursor belongs to
positionwanted cursor position, if not valid for given buffer, will lead to invalid cursor
insertBehaviorbehavior of this cursor on insert of text at its position

Definition at line 17 of file katetextcursor.cpp.

◆ ~TextCursor()

Kate::TextCursor::~TextCursor ( )
override

Destruct the text cursor.

Definition at line 41 of file katetextcursor.cpp.

Member Function Documentation

◆ block()

TextBlock* Kate::TextCursor::block ( ) const
inline

Get block this cursor belongs to, if any.

Returns
block this pointer is part of, else 0

Definition at line 171 of file katetextcursor.h.

◆ column()

int Kate::TextCursor::column ( ) const
inlineoverridevirtual

Retrieve the column on which this cursor is situated.

Returns
column number, where 0 is the first column.

Implements KTextEditor::MovingCursor.

Definition at line 138 of file katetextcursor.h.

◆ columnInternal()

int Kate::TextCursor::columnInternal ( ) const
inline

Non-virtual version of column(), which is faster.

Returns
column number, where 0 is the first column.

Definition at line 147 of file katetextcursor.h.

◆ document()

KTextEditor::Document * Kate::TextCursor::document ( ) const
overridevirtual

Gets the document to which this cursor is bound.

Returns
a pointer to the document

Implements KTextEditor::MovingCursor.

Definition at line 135 of file katetextcursor.cpp.

◆ insertBehavior()

InsertBehavior Kate::TextCursor::insertBehavior ( ) const
inlineoverridevirtual

Get current insert behavior.

Returns
current insert behavior

Implements KTextEditor::MovingCursor.

Definition at line 74 of file katetextcursor.h.

◆ kateRange()

Kate::TextRange* Kate::TextCursor::kateRange ( ) const
inline

Get range this cursor belongs to, if any.

Returns
range this pointer is part of, else 0

Definition at line 162 of file katetextcursor.h.

◆ line()

int Kate::TextCursor::line ( ) const
overridevirtual

Retrieve the line on which this cursor is situated.

Returns
line number, where 0 is the first line.

Implements KTextEditor::MovingCursor.

Definition at line 124 of file katetextcursor.cpp.

◆ lineInBlock()

int Kate::TextCursor::lineInBlock ( ) const
inline

Get offset into block this cursor belongs to, if any.

Returns
offset into block this pointer is part of, else -1

Definition at line 180 of file katetextcursor.h.

◆ lineInternal()

int Kate::TextCursor::lineInternal ( ) const
inline

Non-virtual version of line(), which is faster.

Inlined for fast access (especially in KateTextBuffer::rangesForLine

Returns
line number, where 0 is the first line.

Definition at line 123 of file katetextcursor.h.

◆ range()

KTextEditor::MovingRange * Kate::TextCursor::range ( ) const
overridevirtual

Get range this cursor belongs to, if any.

Returns
range this pointer is part of, else 0

Implements KTextEditor::MovingCursor.

Definition at line 140 of file katetextcursor.cpp.

◆ setInsertBehavior()

void Kate::TextCursor::setInsertBehavior ( InsertBehavior  insertBehavior)
inlineoverridevirtual

Set insert behavior.

Parameters
insertBehaviornew insert behavior

Implements KTextEditor::MovingCursor.

Definition at line 65 of file katetextcursor.h.

◆ setPosition() [1/3]

void Kate::TextCursor::setPosition ( const KTextEditor::Cursor position)
overridevirtual

Set the current cursor position to position.

Parameters
positionnew cursor position

Implements KTextEditor::MovingCursor.

Definition at line 119 of file katetextcursor.cpp.

◆ setPosition() [2/3]

void Kate::TextCursor::setPosition ( const TextCursor position)

Fast way to set the current cursor position to position.

Parameters
positionnew cursor position

Definition at line 54 of file katetextcursor.cpp.

◆ setPosition() [3/3]

void Kate::TextCursor::setPosition ( int  line,
int  column 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Set the cursor position to line and column.

Parameters
linenew cursor line
columnnew cursor column

Definition at line 107 of file katetextcursor.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Mar 21 2023 03:54:08 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.