Kate::TextLine

Search for usage in LXR

Kate::TextLine Class Reference

#include <katetextline.h>

Classes

class  Attribute
 

Public Types

enum  Flags {
  flagAutoWrapped = 1 , flagFoldingStartAttribute = 2 , flagFoldingEndAttribute = 4 , flagLineModified = 8 ,
  flagLineSavedOnDisk = 16
}
 

Public Member Functions

 TextLine ()=default
 
 TextLine (const QString &text)
 
void addAttribute (const Attribute &attribute)
 
QChar at (int column) const
 
int attribute (int pos) const
 
const QList< Attribute > & attributesList () const
 
void clearAttributes ()
 
void clearMarkedAsFoldingStartAndEnd ()
 
bool endsWith (const QString &match) const
 
int firstChar () const
 
int fromVirtualColumn (int column, int tabWidth) const
 
const KSyntaxHighlighting::StatehighlightingState () const
 
int indentDepth (int tabWidth) const
 
bool isAutoWrapped () const
 
int lastChar () const
 
QString leadingWhitespace () const
 
int length () const
 
void markAsFoldingEndAttribute ()
 
void markAsFoldingStartAttribute ()
 
void markAsModified (bool modified)
 
void markAsSavedOnDisk (bool savedOnDisk)
 
bool markedAsFoldingEndAttribute () const
 
bool markedAsFoldingStartAttribute () const
 
bool markedAsModified () const
 
bool markedAsSavedOnDisk () const
 
bool matchesAt (int column, const QString &match) const
 
int nextNonSpaceChar (int pos) const
 
int previousNonSpaceChar (int pos) const
 
void setAutoWrapped (bool wrapped)
 
void setHighlightingState (const KSyntaxHighlighting::State &val)
 
bool startsWith (const QString &match) const
 
QString string (int column, int length) const
 
QStringtext ()
 
const QStringtext () const
 
int toVirtualColumn (int column, int tabWidth) const
 
int virtualLength (int tabWidth) const
 

Detailed Description

Class representing a single text line.

For efficiency reasons, not only pure text is stored here, but also additional data.

Definition at line 21 of file katetextline.h.

Member Enumeration Documentation

◆ Flags

Flags of TextLine.

Definition at line 62 of file katetextline.h.

Constructor & Destructor Documentation

◆ TextLine() [1/2]

Kate::TextLine::TextLine ( )
default

Construct an empty text line.

◆ TextLine() [2/2]

Kate::TextLine::TextLine ( const QString & text)
inlineexplicit

Construct an text line with given text.

Parameters
texttext to use for this line

Definition at line 79 of file katetextline.h.

Member Function Documentation

◆ addAttribute()

void Kate::TextLine::addAttribute ( const Attribute & attribute)

Add attribute to this line.

Parameters
attributenew attribute to append

Definition at line 169 of file katetextline.cpp.

◆ at()

QChar Kate::TextLine::at ( int column) const
inline

Returns the character at the given column.

If column is out of range, the return value is QChar().

Parameters
columncolumn you want char for
Returns
char at given column or QChar()

Definition at line 137 of file katetextline.h.

◆ attribute()

int Kate::TextLine::attribute ( int pos) const

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

Definition at line 181 of file katetextline.cpp.

◆ attributesList()

const QList< Attribute > & Kate::TextLine::attributesList ( ) const
inline

Accessor to attributes.

Returns
attributes of this line

Definition at line 333 of file katetextline.h.

◆ clearAttributes()

void Kate::TextLine::clearAttributes ( )
inline

Clear attributes and foldings of this line.

Definition at line 324 of file katetextline.h.

◆ clearMarkedAsFoldingStartAndEnd()

void Kate::TextLine::clearMarkedAsFoldingStartAndEnd ( )
inline

Clear folding start and end status.

Definition at line 179 of file katetextline.h.

◆ endsWith()

bool Kate::TextLine::endsWith ( const QString & match) const
inline

Returns true, if the line ends with match, otherwise returns false.

Definition at line 292 of file katetextline.h.

◆ firstChar()

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

◆ fromVirtualColumn()

int Kate::TextLine::fromVirtualColumn ( int column,
int tabWidth ) const

Returns the "real" column where each tab only counts one character.

The conversion calculates with tabWidth characters for each tab.

Definition at line 126 of file katetextline.cpp.

◆ highlightingState()

const KSyntaxHighlighting::State & Kate::TextLine::highlightingState ( ) const
inline

context stack

Returns
context stack

Definition at line 301 of file katetextline.h.

◆ indentDepth()

int Kate::TextLine::indentDepth ( int tabWidth) const

Returns the indentation depth with each tab expanded into tabWidth characters.

Definition at line 59 of file katetextline.cpp.

◆ isAutoWrapped()

bool Kate::TextLine::isAutoWrapped ( ) const
inline

Returns true, if the line was automagically wrapped, otherwise returns false.

Returns
was this line auto-wrapped?

Definition at line 232 of file katetextline.h.

◆ lastChar()

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

◆ leadingWhitespace()

QString Kate::TextLine::leadingWhitespace ( ) const

Leading whitespace of this line.

Returns
leading whitespace of this line

Definition at line 50 of file katetextline.cpp.

◆ length()

int Kate::TextLine::length ( ) const
inline

Returns the line's length.

Definition at line 222 of file katetextline.h.

◆ markAsFoldingEndAttribute()

void Kate::TextLine::markAsFoldingEndAttribute ( )
inline

Mark as folding end line of an attribute based folding.

Definition at line 214 of file katetextline.h.

◆ markAsFoldingStartAttribute()

void Kate::TextLine::markAsFoldingStartAttribute ( )
inline

Mark as folding start line of an attribute based folding.

Definition at line 197 of file katetextline.h.

◆ markAsModified()

void Kate::TextLine::markAsModified ( bool modified)
inline

Definition at line 146 of file katetextline.h.

◆ markAsSavedOnDisk()

void Kate::TextLine::markAsSavedOnDisk ( bool savedOnDisk)
inline

Definition at line 161 of file katetextline.h.

◆ markedAsFoldingEndAttribute()

bool Kate::TextLine::markedAsFoldingEndAttribute ( ) const
inline

Is on this line a folding end per attribute?

Returns
folding end line per attribute? or not?

Definition at line 206 of file katetextline.h.

◆ markedAsFoldingStartAttribute()

bool Kate::TextLine::markedAsFoldingStartAttribute ( ) const
inline

Is on this line a folding start per attribute?

Returns
folding start line per attribute? or not?

Definition at line 189 of file katetextline.h.

◆ markedAsModified()

bool Kate::TextLine::markedAsModified ( ) const
inline

Definition at line 156 of file katetextline.h.

◆ markedAsSavedOnDisk()

bool Kate::TextLine::markedAsSavedOnDisk ( ) const
inline

Definition at line 171 of file katetextline.h.

◆ matchesAt()

bool Kate::TextLine::matchesAt ( int column,
const QString & match ) const

Returns true, if match equals to the text at position column, otherwise returns false.

Definition at line 80 of file katetextline.cpp.

◆ nextNonSpaceChar()

int Kate::TextLine::nextNonSpaceChar ( int 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 22 of file katetextline.cpp.

◆ previousNonSpaceChar()

int Kate::TextLine::previousNonSpaceChar ( int 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 non-whitespace character preceding pos, or -1 if none is found.

Definition at line 35 of file katetextline.cpp.

◆ setAutoWrapped()

void Kate::TextLine::setAutoWrapped ( bool wrapped)
inline

set auto-wrapped property

Parameters
wrappedline was wrapped?

Definition at line 351 of file katetextline.h.

◆ setHighlightingState()

void Kate::TextLine::setHighlightingState ( const KSyntaxHighlighting::State & val)
inline

Sets the syntax highlight context number.

Parameters
valnew context array

Definition at line 310 of file katetextline.h.

◆ startsWith()

bool Kate::TextLine::startsWith ( const QString & match) const
inline

Returns true, if the line starts with match, otherwise returns false.

Definition at line 284 of file katetextline.h.

◆ string()

QString Kate::TextLine::string ( int column,
int length ) const
inline

Returns the substring with length beginning at the given column.

Parameters
columnstart column of text to return
lengthlength of text to return
Returns
wanted part of text

Definition at line 243 of file katetextline.h.

◆ text() [1/2]

QString & Kate::TextLine::text ( )
inline

Accessor to the text contained in this line.

Returns
text of this line as reference

Definition at line 98 of file katetextline.h.

◆ text() [2/2]

const QString & Kate::TextLine::text ( ) const
inline

Accessor to the text contained in this line.

Returns
text of this line as constant reference

Definition at line 89 of file katetextline.h.

◆ toVirtualColumn()

int Kate::TextLine::toVirtualColumn ( int column,
int tabWidth ) const

Returns the column with each tab expanded into tabWidth characters.

Definition at line 105 of file katetextline.cpp.

◆ virtualLength()

int Kate::TextLine::virtualLength ( int tabWidth) const

Returns the text length with each tab expanded into tabWidth characters.

Definition at line 152 of file katetextline.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:11:28 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.