• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kate
 

kate

Public Types | Public Member Functions | List of all members
KateTextLine Class Reference

#include <katetextline.h>

Inheritance diagram for KateTextLine:
TDEShared

Public Types

enum  Flags {
  flagNoOtherData = 1 , flagHlContinue = 2 , flagAutoWrapped = 4 , flagFoldingColumnsOutdated = 8 ,
  flagNoIndentationBasedFolding = 16 , flagNoIndentationBasedFoldingAtStart = 32
}
 
typedef TDESharedPtr< KateTextLine > Ptr
 

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
 
TQChar getChar (uint pos) const
 
const TQChar * text () const
 
uchar * attributes () const
 
const TQString & string () const
 
TQString string (uint startCol, uint length) const
 
const TQChar * firstNonSpace () const
 
uint indentDepth (uint tabwidth) const
 
int cursorX (uint pos, uint tabChars) const
 
uint lengthWithTabs (uint tabChars) const
 
bool stringAtPos (uint pos, const TQString &match) const
 
bool startingWith (const TQString &match) const
 
bool endingWith (const TQString &match) const
 
bool searchText (uint startCol, const TQString &text, uint *foundAtCol, uint *matchLen, bool casesensitive=true, bool backwards=false)
 
bool searchText (uint startCol, const TQRegExp &regexp, uint *foundAtCol, uint *matchLen, bool backwards=false)
 
uchar attribute (uint pos) const
 
const TQMemArray< short > & ctxArray () const
 
const bool noIndentBasedFolding () const
 
const bool noIndentBasedFoldingAtStart () const
 
const TQMemArray< uint > & foldingListArray () const
 
const TQMemArray< unsigned short > & indentationDepthArray () const
 
void insertText (uint pos, uint insLen, const TQChar *insText, uchar *insAttribs=0)
 
void removeText (uint pos, uint delLen)
 
void truncate (uint newLen)
 
void setHlLineContinue (bool cont)
 
void setAutoWrapped (bool wrapped)
 
void setContext (TQMemArray< short > &val)
 
void setNoIndentBasedFolding (bool val)
 
void setNoIndentBasedFoldingAtStart (bool val)
 
void setFoldingList (TQMemArray< uint > &val)
 
void setIndentationDepth (TQMemArray< unsigned short > &val)
 
uint dumpSize (bool withHighlighting) const
 
char * dump (char *buf, bool withHighlighting) const
 
char * restore (char *buf)
 
- Public Member Functions inherited from TDEShared
 TDEShared (const TDEShared &)
 
TDEShared & operator= (const TDEShared &)
 
void _TDEShared_ref () const
 
void _TDEShared_unref () const
 
int _TDEShared_count () const
 

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

◆ Ptr

typedef TDESharedPtr<KateTextLine> KateTextLine::Ptr

Define a Shared-Pointer type.

Definition at line 47 of file katetextline.h.

Member Enumeration Documentation

◆ Flags

enum KateTextLine::Flags

Used Flags.

Definition at line 53 of file katetextline.h.

Constructor & Destructor Documentation

◆ KateTextLine()

KateTextLine::KateTextLine ( )

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

Definition at line 30 of file katetextline.cpp.

◆ ~KateTextLine()

KateTextLine::~KateTextLine ( )

Destructor.

Definition at line 35 of file katetextline.cpp.

Member Function Documentation

◆ attribute()

uchar KateTextLine::attribute ( uint  pos) const
inline

Gets the attribute at the given position use KRenderer::attributes to get the KTextAttribute for this.

Parameters
posposition of attribute requested
Returns
value of attribute
See also
attributes

Definition at line 271 of file katetextline.h.

◆ attributes()

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

◆ ctxArray()

const TQMemArray< short > & KateTextLine::ctxArray ( ) const
inline

context stack

Returns
context stack

Definition at line 281 of file katetextline.h.

◆ cursorX()

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
posposition in chars
tabCharstabulator width in chars
Returns
position with tabulators calculated

Definition at line 237 of file katetextline.cpp.

◆ dump()

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

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

Parameters
bufbuffer to dump to
withHighlightingdump hl data, too?
Returns
buffer index after dumping

Definition at line 335 of file katetextline.cpp.

◆ dumpSize()

uint KateTextLine::dumpSize ( bool  withHighlighting) const
inline

Methodes for dump/restore of the line in the buffer.

Dumpsize in bytes

Parameters
withHighlightingshould we dump the hl, too?
Returns
size of line for dumping

Definition at line 384 of file katetextline.h.

◆ endingWith()

bool KateTextLine::endingWith ( const TQString &  match) const

Is the line ending with the given string.

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

Definition at line 219 of file katetextline.cpp.

◆ firstChar()

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

◆ firstNonSpace()

const TQChar * 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 152 of file katetextline.cpp.

◆ foldingColumnsOutdated()

bool KateTextLine::foldingColumnsOutdated ( )
inline

folding columns outdated ?

Returns
folding columns outdated?

Definition at line 90 of file katetextline.h.

◆ foldingListArray()

const TQMemArray< uint > & KateTextLine::foldingListArray ( ) const
inline

folding list

Returns
folding array

Definition at line 292 of file katetextline.h.

◆ getChar()

TQChar KateTextLine::getChar ( uint  pos) const
inline

Gets the char at the given position.

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

Definition at line 145 of file katetextline.h.

◆ hlLineContinue()

bool KateTextLine::hlLineContinue ( ) const
inline

has the line the hl continue flag set

Returns
hl continue set?

Definition at line 103 of file katetextline.h.

◆ indentationDepthArray()

const TQMemArray< unsigned short > & KateTextLine::indentationDepthArray ( ) const
inline

indentation stack

Returns
indentation array

Definition at line 298 of file katetextline.h.

◆ indentDepth()

uint KateTextLine::indentDepth ( uint  tabwidth) const

indentation depth of this line

Parameters
tabwidthwidth of the tabulators
Returns
indentation width

Definition at line 158 of file katetextline.cpp.

◆ insertText()

void KateTextLine::insertText ( uint  pos,
uint  insLen,
const TQChar *  insText,
uchar *  insAttribs = 0 
)

insert text into line

Parameters
posinsert position
insLeninsert length
insTexttext to insert
insAttribsattributes for the insert text

Definition at line 39 of file katetextline.cpp.

◆ isAutoWrapped()

bool KateTextLine::isAutoWrapped ( ) const
inline

was this line automagically wrapped

Returns
line auto-wrapped

Definition at line 109 of file katetextline.h.

◆ lastChar()

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

◆ length()

uint KateTextLine::length ( ) const
inline

Returns the length.

Returns
length of text in line

Definition at line 97 of file katetextline.h.

◆ lengthWithTabs()

uint KateTextLine::lengthWithTabs ( uint  tabChars) const

Returns the text length with tabs calced in.

Parameters
tabCharstabulator width in chars
Returns
text length

Definition at line 256 of file katetextline.cpp.

◆ nextNonSpaceChar()

int KateTextLine::nextNonSpaceChar ( uint  pos) const

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

Parameters
posColumn 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 110 of file katetextline.cpp.

◆ noIndentBasedFolding()

const bool KateTextLine::noIndentBasedFolding ( ) const
inline
Returns
true if any context at the line end has the noIndentBasedFolding flag set

Definition at line 286 of file katetextline.h.

◆ noIndentBasedFoldingAtStart()

const bool KateTextLine::noIndentBasedFoldingAtStart ( ) const
inline

Definition at line 287 of file katetextline.h.

◆ previousNonSpaceChar()

int KateTextLine::previousNonSpaceChar ( uint  pos) const

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

Parameters
posColumn 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 124 of file katetextline.cpp.

◆ removeText()

void KateTextLine::removeText ( uint  pos,
uint  delLen 
)

remove text at given position

Parameters
posstart position of remove
delLenlength to remove

Definition at line 76 of file katetextline.cpp.

◆ restore()

char * KateTextLine::restore ( char *  buf)

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

Parameters
bufbuffer to restore from
Returns
buffer index after restoring

Definition at line 383 of file katetextline.cpp.

◆ searchText() [1/2]

bool KateTextLine::searchText ( uint  startCol,
const TQRegExp &  regexp,
uint *  foundAtCol,
uint *  matchLen,
bool  backwards = false 
)

search given regexp

Parameters
startColcolumn to start search
regexpregex to search for
foundAtColcolumn where text was found
matchLenlength of matching
backwardssearch backwards?
Returns
regexp found?

Definition at line 304 of file katetextline.cpp.

◆ searchText() [2/2]

bool KateTextLine::searchText ( uint  startCol,
const TQString &  text,
uint *  foundAtCol,
uint *  matchLen,
bool  casesensitive = true,
bool  backwards = false 
)

search given string

Parameters
startColcolumn to start search
textstring to search for
foundAtColcolumn where text was found
matchLenlength of matching
casesensitiveshould search be case-sensitive
backwardssearch backwards?
Returns
string found?

Definition at line 273 of file katetextline.cpp.

◆ setAutoWrapped()

void KateTextLine::setAutoWrapped ( bool  wrapped)
inline

auto-wrapped

Parameters
wrappedline was wrapped?

Definition at line 336 of file katetextline.h.

◆ setContext()

void KateTextLine::setContext ( TQMemArray< short > &  val)
inline

Sets the syntax highlight context number.

Parameters
valnew context array

Definition at line 346 of file katetextline.h.

◆ setFoldingColumnsOutdated()

void KateTextLine::setFoldingColumnsOutdated ( bool  set)
inline

Methods to get data.

Set the flag that only positions have changed, not folding region begins/ends themselve

Definition at line 83 of file katetextline.h.

◆ setFoldingList()

void KateTextLine::setFoldingList ( TQMemArray< uint > &  val)
inline

update folding list

Parameters
valnew folding list

Definition at line 367 of file katetextline.h.

◆ setHlLineContinue()

void KateTextLine::setHlLineContinue ( bool  cont)
inline

set hl continue flag

Parameters
contcontinue flag?

Definition at line 326 of file katetextline.h.

◆ setIndentationDepth()

void KateTextLine::setIndentationDepth ( TQMemArray< unsigned short > &  val)
inline

update indentation stack

Parameters
valnew indentation stack

Definition at line 373 of file katetextline.h.

◆ setNoIndentBasedFolding()

void KateTextLine::setNoIndentBasedFolding ( bool  val)
inline

sets if for the next line indent based folding should be disabled

Definition at line 351 of file katetextline.h.

◆ setNoIndentBasedFoldingAtStart()

void KateTextLine::setNoIndentBasedFoldingAtStart ( bool  val)
inline

Definition at line 357 of file katetextline.h.

◆ startingWith()

bool KateTextLine::startingWith ( const TQString &  match) const

Is the line starting with the given string.

Parameters
matchstring to test
Returns
does line start with given string?

Definition at line 202 of file katetextline.cpp.

◆ string() [1/2]

const TQString & KateTextLine::string ( ) const
inline

Gets a TQString.

Returns
text of line as TQString reference

Definition at line 173 of file katetextline.h.

◆ string() [2/2]

TQString KateTextLine::string ( uint  startCol,
uint  length 
) const
inline

Gets a substring.

Parameters
startColstart column of substring
lengthlength of substring
Returns
wanted substring

Definition at line 181 of file katetextline.h.

◆ stringAtPos()

bool KateTextLine::stringAtPos ( uint  pos,
const TQString &  match 
) const

Can we find the given string at the given position.

Parameters
posstartpostion of given string
matchstring to match at given pos
Returns
did the string match?

Definition at line 180 of file katetextline.cpp.

◆ text()

const TQChar * KateTextLine::text ( ) const
inline

Gets the text as a unicode representation.

Returns
text of this line as TQChar array

Definition at line 151 of file katetextline.h.

◆ truncate()

void KateTextLine::truncate ( uint  newLen)

Truncates the textline to the new length.

Parameters
newLennew length of line

Definition at line 101 of file katetextline.cpp.


The documentation for this class was generated from the following files:
  • katetextline.h
  • katetextline.cpp

kate

Skip menu "kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kate

Skip menu "kate"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for kate by doxygen 1.9.4
This website is maintained by Timothy Pearson.