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< TextLine > Ptr
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 QChar * text () const
uchar * attributes () const
const QString & string () const
QString string (uint startCol, uint length) const
QConstString constString (uint startCol, uint length) const
const QChar * firstNonSpace () 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 QString & textArray () 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().

Referenced by dump(), and restore().

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(), and nextNonSpaceChar().

Referenced by firstChar(), and nextNonSpaceChar().

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(), and previousNonSpaceChar().

Referenced by lastChar(), and previousNonSpaceChar().

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 cursorX(), and QString::length().

Referenced by cursorX().

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(), QString::mid(), and stringAtPos().

Referenced by stringAtPos().

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(), QString::length(), and startingWith().

Referenced by startingWith().

bool TextLine::endingWith (  const QString &  match  )  const
 

Is the line ending with the given string.

Definition at line 190 of file katetextline.cpp.

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

Referenced by endingWith().

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 attribute(), and QString::length().

Referenced by attribute().

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(), insertText(), QString::length(), and QMemArray< uchar >::resize().

Referenced by append(), and insertText().

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 append(), insertText(), and QString::length().

Referenced by append().

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(), QString::truncate(), and truncate().

Referenced by 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.

References setHlLineContinue().

Referenced by setHlLineContinue().

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(), and setAttribs().

Referenced by setAttribs().

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(), and setContext().

Referenced by setContext().

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(), dump(), QMemArray< uchar >::isEmpty(), length(), QString::length(), QMemArray< unsigned short >::size(), QMemArray< signed char >::size(), QMemArray< short >::size(), and QString::unicode().

Referenced by dump().

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(), length(), QMemArray< uchar >::resize(), restore(), QString::setUnicode(), and QMemArray< uchar >::size().

Referenced by restore().


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.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 20 09:50:54 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003