| # kate Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# KateTextLine Class Reference

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

`#include <katetextline.h>`

Inheritance diagram for KateTextLine:

[legend]
Collaboration diagram for KateTextLine:

[legend]
List of all members.

## Public Types
typedef KSharedPtr< KateTextLine > | Ptr
enum | Flags { flagNoOtherData = 0x1, flagHlContinue = 0x2, flagAutoWrapped = 0x4, flagFoldingColumnsOutdated = 0x8 }
## Public Member Functions
| KateTextLine ()
| ~KateTextLine ()
void | setFoldingColumnsOutdated (bool set)
bool | foldingColumnsOutdated ()
uint | length () const
bool | hlLineContinue () 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
void | stringAsHtml (uint startCol, uint length, KateRenderer *renderer, QTextStream *outputStream) const
void | stringAsHtml (KateRenderer *renderer, QTextStream *outputStream) const
const QChar * | firstNonSpace () const
uint | indentDepth (uint tabwidth) const
int | cursorX (uint pos, uint tabChars) const
uint | lengthWithTabs (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< uint > & | 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 | setAutoWrapped (bool wrapped)
void | setContext (QMemArray< short > &val)
void | setFoldingList (QMemArray< uint > &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 41 of file katetextline.h.

## Member Typedef Documentation

typedef KSharedPtr<KateTextLine> KateTextLine::Ptr

| Define a Shared-Pointer type. Definition at line 47 of file katetextline.h.

## Member Enumeration Documentation

enum KateTextLine::Flags

| Used Flags. Definition at line 53 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 31 of file katetextline.cpp.

KateTextLine::~KateTextLine | ( |  | ) |

| Destructor. Definition at line 36 of file katetextline.cpp.

## Member Function Documentation

void KateTextLine::setFoldingColumnsOutdated | ( | bool | set | ) | `[inline]`

| Set the flag that only positions have changed, not folding region begins/ends themselve. Definition at line 81 of file katetextline.h.

bool KateTextLine::foldingColumnsOutdated | ( |  | ) | `[inline]`

| folding columns outdated ? Returns: folding columns outdated? Definition at line 88 of file katetextline.h.

uint KateTextLine::length | ( |  | ) | const`[inline]`

| Returns the length. Returns: length of text in line Definition at line 95 of file katetextline.h. References QString::length().

bool KateTextLine::hlLineContinue | ( |  | ) | const`[inline]`

| has the line the hl continue flag set Returns: hl continue set? Definition at line 101 of file katetextline.h.

bool KateTextLine::isAutoWrapped | ( |  | ) | const`[inline]`

| was this line automagically wrapped Returns: line auto-wrapped Definition at line 107 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 136 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 141 of file katetextline.cpp. References QString::length(), and 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 111 of file katetextline.cpp. References QString::length(). 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 122 of file katetextline.cpp. References QString::length(). 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 143 of file katetextline.h. Referenced by stringAsHtml().

const QChar* KateTextLine::text | ( |  | ) | const`[inline]`

| Gets the text as a unicode representation. Returns: text of this line as QChar array Definition at line 149 of file katetextline.h. References QString::unicode(). Referenced by searchText().

uchar* KateTextLine::attributes | ( |  | ) | const`[inline]`

| Highlighting array The size of this is string().length(). This contains the index for the attributes (so you can only have a maximum of 2^8 different highlighting styles in a document) To turn this into actual attributes (bold, green, etc), you need to feed these values into KRenderer::attributes e.g: m_renderer->attributes(attributes[3]); Returns: hl-attributes array Definition at line 165 of file katetextline.h. References QMemArray::data().

const QString& KateTextLine::string | ( |  | ) | const`[inline]`

| Gets a QString. Returns: text of line as QString reference Definition at line 171 of file katetextline.h.

QString KateTextLine::string | ( | uint | startCol,
|  | uint | length
| ) | const`[inline]`

  | Gets a substring. Parameters:
  | startCol | start column of substring
  | length | length of substring
Returns: wanted substring Definition at line 179 of file katetextline.h. References QString::mid().

void KateTextLine::stringAsHtml | ( | uint | startCol,
|  | uint | length,
|  | KateRenderer * | renderer,
|  | QTextStream * | outputStream
| ) | const

  | Gets a substring in valid-xml html. Example: "<b>const</b> b = <i>34</i>" It won't contain or <body> or <html> or anything like that. Parameters:
  | startCol | start column of substring
  | length | length of substring
  | renderer | The katerenderer. This will have the schema information that describes how to render the attributes.
  | outputStream | A stream to write the html to
Definition at line 411 of file katetextline.cpp. References attribute(), KateAttribute::bold(), QStyleSheet::escape(), getChar(), KateAttribute::italic(), QString::number(), QColor::rgb(), and KateAttribute::textColor(). Referenced by stringAsHtml().

void KateTextLine::stringAsHtml | ( | KateRenderer * | renderer,
|  | QTextStream * | outputStream
| ) | const`[inline]`

  | Gets the string a valid-xml html. Overloaded version of stringAsHtml Parameters:
  | renderer | The katerenderer. This will have the schema information that describes how to render the attributes.
  | outputStream | A stream to write the html to
Definition at line 205 of file katetextline.h. References QString::length(), and stringAsHtml().

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 146 of file katetextline.cpp. References firstChar(), and QString::unicode().

uint KateTextLine::indentDepth | ( | uint | tabwidth | ) | const

  | indentation depth of this line Parameters:
  | tabwidth | width of the tabulators
Returns: indentation width Definition at line 152 of file katetextline.cpp. References QString::length().

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 209 of file katetextline.cpp. References QString::length().

uint KateTextLine::lengthWithTabs | ( | uint | tabChars | ) | const

  | Returns the text length with tabs calced in. Parameters:
  | tabChars | tabulator width in chars
Returns: text length Definition at line 225 of file katetextline.cpp. References QString::length().

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 172 of file katetextline.cpp. References QString::length().

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 184 of file katetextline.cpp. References QString::length().

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 196 of file katetextline.cpp. References QString::length().

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 240 of file katetextline.cpp. References QString::find(), QString::findRev(), QString::length(), and text().

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 271 of file katetextline.cpp. References QString::length().

uchar KateTextLine::attribute | ( | uint | pos | ) | const`[inline]`

  | Gets the attribute at the given position use KRenderer::attributes to get the KTextAttribute for this. Parameters:
  | pos | position of attribute requested
Returns: value of attribute See also: attributes Definition at line 295 of file katetextline.h. References QMemArray::size(). Referenced by stringAsHtml().

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

| context stack Returns: context stack Definition at line 305 of file katetextline.h.

const QMemArray<uint>& KateTextLine::foldingListArray | ( |  | ) | const`[inline]`

| folding list Returns: folding array Definition at line 311 of file katetextline.h.

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

| indentation stack Returns: indentation array Definition at line 317 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 40 of file katetextline.cpp. References QString::insert(), QString::length(), and QMemArray::resize().

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 77 of file katetextline.cpp. References QString::length(), QString::remove(), and QMemArray::resize().

void KateTextLine::truncate | ( | uint | newLen | ) |

  | Truncates the textline to the new length. Parameters:
  | newLen | new length of line
Definition at line 102 of file katetextline.cpp. References QString::length(), QMemArray::truncate(), and QString::truncate().

void KateTextLine::setHlLineContinue | ( | bool | cont | ) | `[inline]`

  | set hl continue flag Parameters:
  | cont | continue flag?
Definition at line 345 of file katetextline.h.

void KateTextLine::setAutoWrapped | ( | bool | wrapped | ) | `[inline]`

  | auto-wrapped Parameters:
  | wrapped | line was wrapped?
Definition at line 355 of file katetextline.h.

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

  | Sets the syntax highlight context number. Parameters:
  | val | new context array
Definition at line 365 of file katetextline.h. References QMemArray::assign().

void KateTextLine::setFoldingList | ( | QMemArray< uint > & | val | ) | `[inline]`

  | update folding list Parameters:
  | val | new folding list
Definition at line 371 of file katetextline.h. References QMemArray::assign(), and QMemArray::detach().

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

  | update indentation stack Parameters:
  | val | new indentation stack
Definition at line 377 of file katetextline.h. References QMemArray::assign().

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 388 of file katetextline.h. References QString::length(), and QMemArray::size().

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 302 of file katetextline.cpp. References QMemArray::data(), QString::length(), QMemArray::size(), and QString::unicode().

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 350 of file katetextline.cpp. References QMemArray::duplicate(), QMemArray::fill(), and QString::setUnicode().

The documentation for this class was generated from the following files:

- katetextline.h
- katetextline.cpp

This file is part of the documentation for kate Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:36:55 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003