Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

TextLine Class Reference

#include </home/clem/local/src/opie/noncore/apps/tinykate/libkate/document/katetextline.h>

Inheritance diagram for TextLine:

Inheritance graph
[legend]
Collaboration diagram for TextLine:

Collaboration graph
[legend]
List of all members.

Public Types

typedef KSharedPtr< TextLinePtr
typedef FastValueList< PtrList

Public Member Functions

 TextLine (uchar attribute=0, int context=0)
 ~TextLine ()
uint length () const
void replace (uint pos, uint delLen, const QChar *insText, uint insLen, uchar *insAttribs=0L)
void append (const QChar *s, uint l)
void wrap (TextLine::Ptr nextLine, uint pos)
void unWrap (uint pos, TextLine::Ptr nextLine, uint len)
void truncate (uint newLen)
int firstChar () const
int lastChar () const
void removeSpaces ()
QChar getChar (uint pos) const
const QChargetText () const
const QString getString ()
const QCharfirstNonSpace ()
int cursorX (uint pos, uint tabChars) const
bool startingWith (QString &match)
bool endingWith (QString &match)
void setAttribs (uchar attribute, uint start, uint end)
void setAttr (uchar attribute)
uchar getAttr (uint pos) const
uchar getAttr () const
uchar getRawAttr (uint pos) const
uchar getRawAttr () const
void setContext (int context)
int getContext () const
void select (bool sel, uint start, uint end)
void selectEol (bool sel, uint pos)
void toggleSelect (uint start, uint end)
void toggleSelectEol (uint pos)
int numSelected () const
bool isSelected (uint pos) const
bool isSelected () const
int findSelected (uint pos) const
int findUnselected (uint pos) const
int findRevSelected (uint pos) const
int findRevUnselected (uint pos) const
void clearMark ()
void addMark (uint m)
void delMark (uint m)
uint mark ()
uchargetAttribs ()

Protected Attributes

QString text
QArray< ucharattributes
uchar attr
int ctx
uint myMark

Friends

class KWBuffer
class KWBufBlock

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 155 of file katetextline.h.


Member Typedef Documentation

typedef FastValueList<Ptr> TextLine::List
 

Definition at line 162 of file katetextline.h.

typedef KSharedPtr<TextLine> TextLine::Ptr
 

Definition at line 161 of file katetextline.h.


Constructor & Destructor Documentation

TextLine::TextLine uchar  attribute = 0,
int  context = 0
 

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

Definition at line 26 of file katetextline.cpp.

References attributes, and text.

TextLine::~TextLine  ) 
 

Definition at line 31 of file katetextline.cpp.


Member Function Documentation

void TextLine::addMark uint  m  ) 
 

Definition at line 281 of file katetextline.cpp.

References myMark.

Referenced by KateIconBorder::mousePressEvent().

void TextLine::append const QChar s,
uint  l
[inline]
 

Appends a string of length l to the textline

Definition at line 185 of file katetextline.h.

References QString::length(), replace(), and text.

void TextLine::clearMark  )  [inline]
 

Definition at line 324 of file katetextline.h.

References myMark.

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 154 of file katetextline.cpp.

References l, QString::length(), text, and Opie::MM::x.

void TextLine::delMark uint  m  ) 
 

Definition at line 286 of file katetextline.cpp.

References myMark.

Referenced by KateIconBorder::mousePressEvent().

bool TextLine::endingWith QString match  ) 
 

Is the line ending with the given string

Definition at line 144 of file katetextline.cpp.

References QString::right(), and text.

Referenced by KateDocument::doComment().

int TextLine::findRevSelected uint  pos  )  const
 

Finds the previous selected character, starting at the given position

Definition at line 271 of file katetextline.cpp.

References attributes, and taSelected.

int TextLine::findRevUnselected uint  pos  )  const
 

Finds the previous unselected character, starting at the given position

Definition at line 276 of file katetextline.cpp.

References attributes, and taSelected.

int TextLine::findSelected uint  pos  )  const
 

Finds the next selected character, starting at the given position

Definition at line 261 of file katetextline.cpp.

References attributes, QString::length(), taSelected, and text.

int TextLine::findUnselected uint  pos  )  const
 

Finds the next unselected character, starting at the given position

Definition at line 266 of file katetextline.cpp.

References attributes, QString::length(), taSelected, and text.

int TextLine::firstChar  )  const
 

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

Definition at line 105 of file katetextline.cpp.

References QString::length(), and text.

Referenced by Highlight::doHighlight(), and firstNonSpace().

const QChar * TextLine::firstNonSpace  ) 
 

Definition at line 132 of file katetextline.cpp.

References firstChar(), and getText().

Referenced by Highlight::doHighlight().

uchar TextLine::getAttr  )  const
 

Gets the attribute for the free space behind the last character

Definition at line 182 of file katetextline.cpp.

References attr, and taAttrMask.

uchar TextLine::getAttr uint  pos  )  const
 

Gets the attribute at the given position

Definition at line 177 of file katetextline.cpp.

References attr, attributes, QString::length(), taAttrMask, and text.

uchar* TextLine::getAttribs  )  [inline]
 

Definition at line 329 of file katetextline.h.

References attributes.

QChar TextLine::getChar uint  pos  )  const
 

Gets the char at the given position

Definition at line 128 of file katetextline.cpp.

References QString::constref(), QString::length(), and text.

int TextLine::getContext  )  const
 

Gets the syntax highlight context number

Definition at line 199 of file katetextline.cpp.

References ctx.

uchar TextLine::getRawAttr  )  const
 

Gets the attribute, including the select state, for the free space behind the last character

Definition at line 191 of file katetextline.cpp.

References attr.

uchar TextLine::getRawAttr uint  pos  )  const
 

Gets the attribute, including the select state, at the given position

Definition at line 186 of file katetextline.cpp.

References attr, attributes, QString::length(), taSelected, and text.

const QString TextLine::getString  )  [inline]
 

Gets a C-like null terminated string

Definition at line 222 of file katetextline.h.

References text.

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

Gets the text. WARNING: it is not null terminated

Definition at line 218 of file katetextline.h.

References text, and QString::unicode().

Referenced by Highlight::doHighlight(), and firstNonSpace().

bool TextLine::isSelected  )  const
 

Returns true if the free space behind the last character is selected

Definition at line 257 of file katetextline.cpp.

References attr.

bool TextLine::isSelected uint  pos  )  const
 

Returns if the character at the given position is selected

Definition at line 252 of file katetextline.cpp.

References attr, attributes, QString::length(), taSelected, and text.

int TextLine::lastChar  )  const
 

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

Definition at line 116 of file katetextline.cpp.

References isSpace(), QString::length(), and text.

uint TextLine::length  )  const [inline]
 

Returns the length

Definition at line 175 of file katetextline.h.

References QString::length(), and text.

Referenced by KateDocument::doComment(), and Highlight::doHighlight().

uint TextLine::mark  )  [inline]
 

Definition at line 327 of file katetextline.h.

References myMark.

Referenced by KateIconBorder::mousePressEvent(), and KateIconBorder::paintLine().

int TextLine::numSelected  )  const
 

Returns the number of selected characters

Definition at line 244 of file katetextline.cpp.

References attributes, QString::length(), taSelected, and text.

void TextLine::removeSpaces  ) 
 

Removes trailing spaces

Definition at line 123 of file katetextline.cpp.

References QString::length(), text, and QString::truncate().

void TextLine::replace uint  pos,
uint  delLen,
const QChar insText,
uint  insLen,
uchar insAttribs = 0L
 

Universal text manipulation method. It can be used to insert, delete or replace text.

Definition at line 36 of file katetextline.cpp.

References attributes, QString::insert(), QString::length(), QString::remove(), t, and text.

Referenced by append(), and unWrap().

void TextLine::select bool  sel,
uint  start,
uint  end
 

Sets the select state from start to end -1

Definition at line 204 of file katetextline.cpp.

References attributes, QString::length(), taSelected, and text.

void TextLine::selectEol bool  sel,
uint  pos
 

Sets the select state from the given position to the end, including the free space behind the last character

Definition at line 215 of file katetextline.cpp.

References attr, attributes, QString::length(), taSelected, and text.

void TextLine::setAttr uchar  attribute  ) 
 

Sets the attribute for the free space behind the last character

Definition at line 173 of file katetextline.cpp.

References attr, and taSelected.

Referenced by Highlight::doHighlight().

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

Sets the attributes from start to end -1

Definition at line 166 of file katetextline.cpp.

References attributes, QString::length(), taSelected, and text.

Referenced by Highlight::doHighlight().

void TextLine::setContext int  context  ) 
 

Sets the syntax highlight context number

Definition at line 195 of file katetextline.cpp.

References ctx.

bool TextLine::startingWith QString match  ) 
 

Is the line starting with the given string

Definition at line 139 of file katetextline.cpp.

References QString::startsWith(), and text.

Referenced by KateDocument::doComment().

void TextLine::toggleSelect uint  start,
uint  end
 

Toggles the select state from start to end -1

Definition at line 228 of file katetextline.cpp.

References attributes, QString::length(), taSelected, and text.

void TextLine::toggleSelectEol uint  pos  ) 
 

Toggles the select state from the given position to the end, including the free space behind the last character

Definition at line 236 of file katetextline.cpp.

References attr, attributes, QString::length(), taSelected, and text.

void TextLine::truncate uint  newLen  )  [inline]
 

Truncates the textline to the new length

Definition at line 198 of file katetextline.h.

References attributes, QString::length(), text, and QString::truncate().

Referenced by wrap().

void TextLine::unWrap uint  pos,
TextLine::Ptr  nextLine,
uint  len
 

Wraps the text of given length from the beginning of the next line to this line at the given position

Definition at line 98 of file katetextline.cpp.

References attr, KSharedPtr< T >::data(), and replace().

void TextLine::wrap TextLine::Ptr  nextLine,
uint  pos
 

Wraps the text from the given position to the end to the next line

Definition at line 86 of file katetextline.cpp.

References attr, attributes, l, QString::length(), text, truncate(), and QString::unicode().


Friends And Related Function Documentation

friend class KWBufBlock [friend]
 

Definition at line 158 of file katetextline.h.

friend class KWBuffer [friend]
 

Definition at line 157 of file katetextline.h.


Member Data Documentation

uchar TextLine::attr [protected]
 

The attribute of the free space behind the end

Definition at line 343 of file katetextline.h.

Referenced by getAttr(), getRawAttr(), isSelected(), selectEol(), setAttr(), toggleSelectEol(), unWrap(), and wrap().

QArray<uchar> TextLine::attributes [protected]
 

The attributes

Definition at line 339 of file katetextline.h.

Referenced by findRevSelected(), findRevUnselected(), findSelected(), findUnselected(), getAttr(), getAttribs(), getRawAttr(), isSelected(), numSelected(), replace(), select(), selectEol(), setAttribs(), toggleSelect(), toggleSelectEol(), truncate(), and wrap().

int TextLine::ctx [protected]
 

The syntax highlight context

Definition at line 347 of file katetextline.h.

Referenced by getContext(), and setContext().

uint TextLine::myMark [protected]
 

The marks of the current line

Definition at line 351 of file katetextline.h.

Referenced by addMark(), clearMark(), delMark(), and mark().

QString TextLine::text [protected]
 

The text

Definition at line 335 of file katetextline.h.

Referenced by append(), cursorX(), endingWith(), findSelected(), findUnselected(), firstChar(), getAttr(), getChar(), getRawAttr(), getString(), getText(), isSelected(), lastChar(), length(), numSelected(), removeSpaces(), replace(), select(), selectEol(), setAttribs(), startingWith(), toggleSelect(), toggleSelectEol(), truncate(), and wrap().


The documentation for this class was generated from the following files:
Generated on Sat Nov 5 17:53:43 2005 for OPIE by  doxygen 1.4.2