kate Library API Documentation

TextLine Class Reference

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

#include <katetextline.h>

Inheritance diagram for TextLine:

KShared List of all members.

Public Types

typedef KSharedPtr< TextLinePtr
typedef QValueVector< Ptr > List
enum  Flags { flagNoOtherData = 0x1, flagHlContinue = 0x2, flagVisible = 0x4, flagAutoWrapped = 0x8 }

Public Member Functions

 TextLine ()
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
short * ctx () const
bool ctxSize () const
bool ctxEmpty () 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 QStringtextArray () const
const QMemArray< uchar > & attributesArray () 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 append (const QChar *s, uint l)
void truncate (uint newLen)
QString withoutTrailingSpaces ()
void setHlLineContinue (bool cont)
void setVisible (bool val)
void setAutoWrapped (bool wrapped)
void setAttribs (uchar attribute, uint start, uint end)
void setContext (short *newctx, uint len)
void setFoldingList (QMemArray< signed char > &val)
void setIndentationDepth (QMemArray< unsigned short > &val)
uint dumpSize () const
char * dump (char *buf) const
char * restore (char *buf)

Detailed Description

The TextLine 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 40 of file katetextline.h.


Constructor & Destructor Documentation

TextLine::TextLine  ) 
 

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

Definition at line 28 of file katetextline.cpp.


Member Function Documentation

uint TextLine::length  )  const [inline]
 

Returns the length.

Definition at line 61 of file katetextline.h.

References QString::length().

bool TextLine::hlLineContinue  )  const [inline]
 

Return some flags.

Definition at line 66 of file katetextline.h.

int TextLine::firstChar  )  const
 

Returns the position of the first character which is not a white space.

Definition at line 139 of file katetextline.cpp.

References nextNonSpaceChar().

int TextLine::lastChar  )  const
 

Returns the position of the last character which is not a white space.

Definition at line 144 of file katetextline.cpp.

References QString::length(), and previousNonSpaceChar().

Referenced by withoutTrailingSpaces().

int TextLine::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 114 of file katetextline.cpp.

References QString::length().

Referenced by firstChar().

int TextLine::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:
True if the specified or a preceding character is not a space Otherwise false.

Definition at line 125 of file katetextline.cpp.

References QString::length().

Referenced by lastChar().

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

Gets the char at the given position.

Definition at line 103 of file katetextline.h.

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

Gets the text.

Definition at line 111 of file katetextline.h.

References QString::unicode().

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

Gets a QString.

Definition at line 118 of file katetextline.h.

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

Gets a QString.

Definition at line 123 of file katetextline.h.

References QString::mid().

int TextLine::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.

Definition at line 195 of file katetextline.cpp.

References QString::length().

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

Can we find the given string at the given position.

Definition at line 180 of file katetextline.cpp.

References QString::length(), and QString::mid().

bool TextLine::startingWith const QString match  )  const
 

Is the line starting with the given string.

Definition at line 185 of file katetextline.cpp.

References QString::left(), and QString::length().

bool TextLine::endingWith const QString match  )  const
 

Is the line ending with the given string.

Definition at line 190 of file katetextline.cpp.

References QString::length(), and QString::right().

short* TextLine::ctx  )  const [inline]
 

Gets the syntax highlight context number.

Definition at line 157 of file katetextline.h.

References QMemArray< short >::data().

bool TextLine::ctxSize  )  const [inline]
 

Gets size of the ctxArray.

Definition at line 162 of file katetextline.h.

References QMemArray< short >::size().

bool TextLine::ctxEmpty  )  const [inline]
 

Empty ctx stack ?

Definition at line 167 of file katetextline.h.

References QMemArray< short >::isEmpty().

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

Gets the attribute at the given position.

Definition at line 175 of file katetextline.h.

References QString::length().

const QString& TextLine::textArray  )  const [inline]
 

Raw access on the memarray's, for example the katebuffer class.

Definition at line 184 of file katetextline.h.

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

Universal text manipulation methoda.

They can be used to insert or delete text

Definition at line 37 of file katetextline.cpp.

References QString::insert(), QString::length(), and QMemArray< uchar >::resize().

Referenced by append().

void TextLine::append const QChar s,
uint  l
 

Appends a string of length l to the textline.

Definition at line 100 of file katetextline.cpp.

References insertText(), and QString::length().

void TextLine::truncate uint  newLen  ) 
 

Truncates the textline to the new length.

Definition at line 105 of file katetextline.cpp.

References QString::length(), QMemArray< uchar >::truncate(), and QString::truncate().

QString TextLine::withoutTrailingSpaces  ) 
 

Removes trailing spaces.

Definition at line 149 of file katetextline.cpp.

References lastChar(), and QString::left().

void TextLine::setHlLineContinue bool  cont  )  [inline]
 

Sets some flags.

Definition at line 218 of file katetextline.h.

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

Sets the attributes from start to end -1.

Definition at line 210 of file katetextline.cpp.

References QString::length().

void TextLine::setContext short *  newctx,
uint  len
[inline]
 

Sets the syntax highlight context number.

Definition at line 244 of file katetextline.h.

References QMemArray< short >::duplicate().

uint TextLine::dumpSize  )  const
 

Dumpsize in bytes.

Definition at line 257 of file katetextline.cpp.

References QMemArray< uchar >::isEmpty(), QString::length(), QMemArray< unsigned short >::size(), QMemArray< signed char >::size(), and QMemArray< short >::size().

char * TextLine::dump char *  buf  )  const
 

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

Definition at line 280 of file katetextline.cpp.

References QMemArray< unsigned short >::data(), QMemArray< signed char >::data(), QMemArray< short >::data(), QMemArray< uchar >::isEmpty(), QString::length(), QMemArray< unsigned short >::size(), QMemArray< signed char >::size(), QMemArray< short >::size(), and QString::unicode().

char * TextLine::restore char *  buf  ) 
 

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

Definition at line 364 of file katetextline.cpp.

References QMemArray< uchar >::data(), QMemArray< unsigned short >::duplicate(), QMemArray< signed char >::duplicate(), QMemArray< short >::duplicate(), QMemArray< uchar >::fill(), QMemArray< uchar >::resize(), QString::setUnicode(), and QMemArray< uchar >::size().


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.2.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Mar 4 22:46:01 2004 by doxygen 1.3.6-20040222 written by Dimitri van Heesch, © 1997-2003