kate Library API Documentation

KateTextLine Class Reference

The KateTextLine represents a line of text. More...

#include <katetextline.h>

Inheritance diagram for KateTextLine:

KShared List of all members.

Public Types

typedef KSharedPtr< KateTextLinePtr
enum  Flags { flagNoOtherData = 0x1, flagHlContinue = 0x2, flagVisible = 0x4, flagAutoWrapped = 0x8 }

Public Member Functions

 KateTextLine ()
 ~KateTextLine ()
uint length () const
bool hlLineContinue () const
bool isVisible () const
bool isAutoWrapped () const
int firstChar () const
int lastChar () const
int nextNonSpaceChar (uint pos) const
int previousNonSpaceChar (uint pos) const
QChar getChar (uint pos) const
const QChartext () const
uchar * attributes () const
const QStringstring () const
QString string (uint startCol, uint length) const
QConstString constString (uint startCol, uint length) const
const QCharfirstNonSpace () const
uint indentDepth (uint tabwidth) const
int cursorX (uint pos, uint tabChars) const
bool stringAtPos (uint pos, const QString &match) const
bool startingWith (const QString &match) const
bool endingWith (const QString &match) const
bool searchText (uint startCol, const QString &text, uint *foundAtCol, uint *matchLen, bool casesensitive=true, bool backwards=false)
bool searchText (uint startCol, const QRegExp &regexp, uint *foundAtCol, uint *matchLen, bool backwards=false)
uchar attribute (uint pos) const
const QMemArray< short > & ctxArray () const
const QMemArray< signed char > & foldingListArray () const
const QMemArray< unsigned
short > & 
indentationDepthArray () const
void insertText (uint pos, uint insLen, const QChar *insText, uchar *insAttribs=0)
void removeText (uint pos, uint delLen)
void truncate (uint newLen)
void setHlLineContinue (bool cont)
void setVisible (bool val)
void setAutoWrapped (bool wrapped)
void setAttribs (uchar attribute, uint start, uint end)
void setContext (QMemArray< short > &val)
void setFoldingList (QMemArray< signed char > &val)
void setIndentationDepth (QMemArray< unsigned short > &val)
uint dumpSize (bool withHighlighting) const
char * dump (char *buf, bool withHighlighting) const
char * restore (char *buf)

Detailed Description

The KateTextLine represents a line of text.

A text line that contains the text, an attribute for each character, an attribute for the free space behind the last character and a context number for the syntax highlight. The attribute stores the index to a table that contains fonts and colors and also if a character is selected.

Definition at line 38 of file katetextline.h.


Member Typedef Documentation

typedef KSharedPtr<KateTextLine> KateTextLine::Ptr
 

Define a Shared-Pointer type.

Definition at line 44 of file katetextline.h.

Referenced by KateBufBlock::insertLine(), KateBuffer::insertLine(), KateBufBlock::KateBufBlock(), KateBuffer::line(), KateBufBlock::line(), KateRenderer::paintTextLine(), KateBuffer::plainLine(), KateBuffer::saveFile(), KateBuffer::setLineVisible(), and KateRenderer::textPos().


Member Enumeration Documentation

enum KateTextLine::Flags
 

Used Flags.

Definition at line 50 of file katetextline.h.


Constructor & Destructor Documentation

KateTextLine::KateTextLine  ) 
 

Constructor Creates an empty text line with given attribute and syntax highlight context.

Definition at line 28 of file katetextline.cpp.

KateTextLine::~KateTextLine  ) 
 

Destructor.

Definition at line 33 of file katetextline.cpp.


Member Function Documentation

uint KateTextLine::length  )  const [inline]
 

Returns the length.

Returns:
length of text in line

Definition at line 79 of file katetextline.h.

bool KateTextLine::hlLineContinue  )  const [inline]
 

has the line the hl continue flag set

Returns:
hl continue set?

Definition at line 85 of file katetextline.h.

bool KateTextLine::isVisible  )  const [inline]
 

is this line marked as visible by the folding

Returns:
line visible

Definition at line 91 of file katetextline.h.

bool KateTextLine::isAutoWrapped  )  const [inline]
 

was this line automagically wrapped

Returns:
line auto-wrapped

Definition at line 97 of file katetextline.h.

int KateTextLine::firstChar  )  const
 

Returns the position of the first non-whitespace character.

Returns:
position of first non-whitespace char or -1 if there is none

Definition at line 133 of file katetextline.cpp.

References nextNonSpaceChar().

Referenced by firstNonSpace().

int KateTextLine::lastChar  )  const
 

Returns the position of the last non-whitespace character.

Returns:
position of last non-whitespace char or -1 if there is none

Definition at line 138 of file katetextline.cpp.

References previousNonSpaceChar().

int KateTextLine::nextNonSpaceChar uint  pos  )  const
 

Find the position of the next char that is not a space.

Parameters:
pos Column of the character which is examined first.
Returns:
True if the specified or a following character is not a space Otherwise false.

Definition at line 108 of file katetextline.cpp.

Referenced by firstChar().

int KateTextLine::previousNonSpaceChar uint  pos  )  const
 

Find the position of the previous char that is not a space.

Parameters:
pos Column of the character which is examined first.
Returns:
The position of the first none-whitespace character preceeding pos, or -1 if none is found.

Definition at line 119 of file katetextline.cpp.

Referenced by lastChar().

QChar KateTextLine::getChar uint  pos  )  const [inline]
 

Gets the char at the given position.

Parameters:
pos position
Returns:
character at the given position or QChar::null if position is beyond the length of the string

Definition at line 133 of file katetextline.h.

const QChar* KateTextLine::text  )  const [inline]
 

Gets the text.

Returns:
text of this line as QChar array

Definition at line 139 of file katetextline.h.

uchar* KateTextLine::attributes  )  const [inline]
 

Highlighting array.

Returns:
hl-attributes array

Definition at line 145 of file katetextline.h.

const QString& KateTextLine::string  )  const [inline]
 

Gets a QString.

Returns:
text of line as QString reference

Definition at line 151 of file katetextline.h.

QString KateTextLine::string uint  startCol,
uint  length
const [inline]
 

Gets a substring.

Parameters:
startCol start column of substring
length lenght of substring
Returns:
wanted substring

Definition at line 159 of file katetextline.h.

QConstString KateTextLine::constString uint  startCol,
uint  length
const [inline]
 

Gets a substring as constant string.

Parameters:
startCol start column of substring
length lenght of substring
Returns:
wanted substring

Definition at line 168 of file katetextline.h.

const QChar * KateTextLine::firstNonSpace  )  const
 

Gets a null terminated pointer to first non space char.

Returns:
array of QChars starting at first non-whitespace char

Definition at line 143 of file katetextline.cpp.

References firstChar().

uint KateTextLine::indentDepth uint  tabwidth  )  const
 

indentation depth of this line

Parameters:
tabwidth width of the tabulators
Returns:
indentation width

Definition at line 149 of file katetextline.cpp.

int KateTextLine::cursorX uint  pos,
uint  tabChars
const
 

Returns the x position of the cursor at the given position, which depends on the number of tab characters.

Parameters:
pos position in chars
tabChars tabulator width in chars
Returns:
position with tabulators calculated

Definition at line 184 of file katetextline.cpp.

bool KateTextLine::stringAtPos uint  pos,
const QString match
const
 

Can we find the given string at the given position.

Parameters:
pos startpostion of given string
match string to match at given pos
Returns:
did the string match?

Definition at line 169 of file katetextline.cpp.

bool KateTextLine::startingWith const QString match  )  const
 

Is the line starting with the given string.

Parameters:
match string to test
Returns:
does line start with given string?

Definition at line 174 of file katetextline.cpp.

bool KateTextLine::endingWith const QString match  )  const
 

Is the line ending with the given string.

Parameters:
match string to test
Returns:
does the line end with given string?

Definition at line 179 of file katetextline.cpp.

bool KateTextLine::searchText uint  startCol,
const QString text,
uint *  foundAtCol,
uint *  matchLen,
bool  casesensitive = true,
bool  backwards = false
 

search given string

Parameters:
startCol column to start search
text string to search for
foundAtCol column where text was found
matchLen length of matching
casesensitive should search be case-sensitive
backwards search backwards?
Returns:
string found?

Definition at line 208 of file katetextline.cpp.

bool KateTextLine::searchText uint  startCol,
const QRegExp regexp,
uint *  foundAtCol,
uint *  matchLen,
bool  backwards = false
 

search given regexp

Parameters:
startCol column to start search
regexp regex to search for
foundAtCol column where text was found
matchLen length of matching
backwards search backwards?
Returns:
regexp found?

Definition at line 227 of file katetextline.cpp.

uchar KateTextLine::attribute uint  pos  )  const [inline]
 

Gets the attribute at the given position.

Parameters:
pos position of attribute requested
Returns:
value of attribute

Definition at line 248 of file katetextline.h.

const QMemArray<short>& KateTextLine::ctxArray  )  const [inline]
 

context stack

Returns:
context stack

Definition at line 258 of file katetextline.h.

const QMemArray<signed char>& KateTextLine::foldingListArray  )  const [inline]
 

folding list

Returns:
folding array

Definition at line 264 of file katetextline.h.

const QMemArray<unsigned short>& KateTextLine::indentationDepthArray  )  const [inline]
 

indentation stack

Returns:
indentation array

Definition at line 270 of file katetextline.h.

void KateTextLine::insertText uint  pos,
uint  insLen,
const QChar insText,
uchar *  insAttribs = 0
 

insert text into line

Parameters:
pos insert position
insLen insert length
insText text to insert
insAttribs attributes for the insert text

Definition at line 37 of file katetextline.cpp.

void KateTextLine::removeText uint  pos,
uint  delLen
 

remove text at given position

Parameters:
pos start position of remove
delLen length to remove

Definition at line 74 of file katetextline.cpp.

void KateTextLine::truncate uint  newLen  ) 
 

Truncates the textline to the new length.

Parameters:
newLen new length of line

Definition at line 99 of file katetextline.cpp.

void KateTextLine::setHlLineContinue bool  cont  )  [inline]
 

set hl continue flag

Parameters:
cont continue flag?

Definition at line 298 of file katetextline.h.

void KateTextLine::setVisible bool  val  )  [inline]
 

set visibility

Parameters:
val visible?

Definition at line 308 of file katetextline.h.

void KateTextLine::setAutoWrapped bool  wrapped  )  [inline]
 

auto-wrapped

Parameters:
wrapped line was wrapped?

Definition at line 318 of file katetextline.h.

void KateTextLine::setAttribs uchar  attribute,
uint  start,
uint  end
 

Sets the attributes from start to end -1.

Parameters:
attribute attribue to fill in
start start of filling
end end of filling

Definition at line 199 of file katetextline.cpp.

void KateTextLine::setContext QMemArray< short > &  val  )  [inline]
 

Sets the syntax highlight context number.

Parameters:
val new context array

Definition at line 336 of file katetextline.h.

void KateTextLine::setFoldingList QMemArray< signed char > &  val  )  [inline]
 

update folding list

Parameters:
val new folding list

Definition at line 342 of file katetextline.h.

void KateTextLine::setIndentationDepth QMemArray< unsigned short > &  val  )  [inline]
 

update indentation stack

Parameters:
val new indentation stack

Definition at line 348 of file katetextline.h.

uint KateTextLine::dumpSize bool  withHighlighting  )  const [inline]
 

Dumpsize in bytes.

Parameters:
withHighlighting should we dump the hl, too?
Returns:
size of line for dumping

Definition at line 359 of file katetextline.h.

char * KateTextLine::dump char *  buf,
bool  withHighlighting
const
 

Dumps the line to *buf and counts buff dumpSize bytes up as return value.

Parameters:
buf buffer to dump to
withHighlight dump hl data, too?
Returns:
buffer index after dumping

Definition at line 246 of file katetextline.cpp.

char * KateTextLine::restore char *  buf  ) 
 

Restores the line from *buf and counts buff dumpSize bytes up as return value.

Parameters:
buf buffer to restore from
Returns:
buffer index after restoring

Definition at line 294 of file katetextline.cpp.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kate Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Nov 27 13:52:51 2004 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003