Kate::TextLineData

Kate::TextLineData Class Reference

#include <katetextline.h>

Classes

class  Attribute
 
class  Folding
 

Public Types

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

Public Member Functions

 TextLineData ()
 
 TextLineData (const QString &text)
 
 ~TextLineData ()
 
void addAttribute (const Attribute &attribute)
 
void addFolding (int offset, int folding)
 
QChar at (int column) const
 
short attribute (int pos) const
 
const QVector< Attribute > & attributesList () const
 
void clearAttributesAndFoldings ()
 
void clearMarkedAsFoldingStart ()
 
bool endsWith (const QString &match) const
 
int firstChar () const
 
const std::vector< Folding > & foldings () 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 markAsFoldingStartAttribute ()
 
void markAsFoldingStartIndentation ()
 
void markAsModified (bool modified)
 
void markAsSavedOnDisk (bool savedOnDisk)
 
bool markedAsFoldingStart () const
 
bool markedAsFoldingStartAttribute () const
 
bool markedAsFoldingStartIndentation () const
 
bool markedAsModified () const
 
bool markedAsSavedOnDisk () const
 
bool matchesAt (int column, const QString &match) const
 
int nextNonSpaceChar (int pos) const
 
QChar operator[] (int column) const
 
int previousNonSpaceChar (int pos) const
 
void setAutoWrapped (bool wrapped)
 
void setHighlightingState (const KSyntaxHighlighting::State &val)
 
bool startsWith (const QString &match) const
 
const QStringstring () const
 
QString string (int column, int length) const
 
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. Will be only accessed over shared pointers.

Definition at line 25 of file katetextline.h.

Member Enumeration Documentation

Flags of TextLineData.

Definition at line 99 of file katetextline.h.

Constructor & Destructor Documentation

Kate::TextLineData::TextLineData ( )

Construct an empty text line.

Definition at line 11 of file katetextline.cpp.

Kate::TextLineData::TextLineData ( const QString text)
explicit

Construct an text line with given text.

Parameters
texttext to use for this line

Definition at line 15 of file katetextline.cpp.

Kate::TextLineData::~TextLineData ( )

Destruct the text line.

Definition at line 21 of file katetextline.cpp.

Member Function Documentation

void Kate::TextLineData::addAttribute ( const Attribute attribute)

Add attribute to this line.

Parameters
attributenew attribute to append

Definition at line 179 of file katetextline.cpp.

void Kate::TextLineData::addFolding ( int  offset,
int  folding 
)
inline

Add new folding at end of foldings stored in this line.

Parameters
offsetoffset of folding start
foldingfolding to add, positive to open, negative to close

Definition at line 409 of file katetextline.h.

QChar Kate::TextLineData::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 160 of file katetextline.h.

short Kate::TextLineData::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 191 of file katetextline.cpp.

const QVector<Attribute>& Kate::TextLineData::attributesList ( ) const
inline

Accessor to attributes.

Returns
attributes of this line

Definition at line 390 of file katetextline.h.

void Kate::TextLineData::clearAttributesAndFoldings ( )
inline

Clear attributes and foldings of this line.

Definition at line 380 of file katetextline.h.

void Kate::TextLineData::clearMarkedAsFoldingStart ( )
inline

Clear folding start status.

Definition at line 225 of file katetextline.h.

bool Kate::TextLineData::endsWith ( const QString match) const
inline

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

Definition at line 348 of file katetextline.h.

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

const std::vector<Folding>& Kate::TextLineData::foldings ( ) const
inline

Accessor to foldings.

Returns
foldings of this line

Definition at line 399 of file katetextline.h.

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

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

context stack

Returns
context stack

Definition at line 357 of file katetextline.h.

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

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

Definition at line 70 of file katetextline.cpp.

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

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

Returns
was this line auto-wrapped?

Definition at line 279 of file katetextline.h.

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

QString Kate::TextLineData::leadingWhitespace ( ) const

Leading whitespace of this line.

Returns
leading whitespace of this line

Definition at line 61 of file katetextline.cpp.

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

Returns the line's length.

Definition at line 269 of file katetextline.h.

void Kate::TextLineData::markAsFoldingStartAttribute ( )
inline

Mark as folding start line of an attribute based folding.

Definition at line 251 of file katetextline.h.

void Kate::TextLineData::markAsFoldingStartIndentation ( )
inline

Mark as folding start line of an indentation based folding.

Definition at line 260 of file katetextline.h.

bool Kate::TextLineData::markedAsFoldingStart ( ) const
inline

Is on this line a folding start?

Returns
folding start line or not?

Definition at line 217 of file katetextline.h.

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

Is on this line a folding start per attribute?

Returns
folding start line per attribute? or not?

Definition at line 234 of file katetextline.h.

bool Kate::TextLineData::markedAsFoldingStartIndentation ( ) const
inline

Is on this line a folding start per indentation?

Returns
folding start line per indentation? or not?

Definition at line 243 of file katetextline.h.

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

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

Definition at line 91 of file katetextline.cpp.

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

QChar Kate::TextLineData::operator[] ( int  column) const
inline

Same as at().

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

Definition at line 174 of file katetextline.h.

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

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

set auto-wrapped property

Parameters
wrappedline was wrapped?

Definition at line 427 of file katetextline.h.

void Kate::TextLineData::setHighlightingState ( const KSyntaxHighlighting::State val)
inline

Sets the syntax highlight context number.

Parameters
valnew context array

Definition at line 366 of file katetextline.h.

bool Kate::TextLineData::startsWith ( const QString match) const
inline

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

Definition at line 340 of file katetextline.h.

const QString& Kate::TextLineData::string ( ) const
inline

Returns the complete text line (as a QString reference).

Returns
text of this line, read-only

Definition at line 288 of file katetextline.h.

QString Kate::TextLineData::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 299 of file katetextline.h.

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

Accessor to the text contained in this line.

Returns
text of this line as constant reference

Definition at line 121 of file katetextline.h.

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

Returns the column with each tab expanded into tabWidth characters.

Definition at line 115 of file katetextline.cpp.

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

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

Definition at line 162 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-2021 The KDE developers.
Generated on Sat Jan 16 2021 22:59:51 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.