KSyntaxHighlighting::FoldingRegion

Search for usage in LXR

KSyntaxHighlighting::FoldingRegion Class Reference

#include <foldingregion.h>

Public Types

enum  Type { None, Begin, End }
 

Public Member Functions

 FoldingRegion ()
 
quint16 id () const
 
bool isValid () const
 
bool operator== (const FoldingRegion &other) const
 
Type type () const
 

Detailed Description

Represents a begin or end of a folding region.

Since
5.28

Definition at line 18 of file foldingregion.h.

Member Enumeration Documentation

Defines whether a FoldingRegion starts or ends a folding region.

Enumerator
None 

Used internally as indicator for invalid FoldingRegions.

Begin 

Indicates the start of a FoldingRegion.

End 

Indicates the end of a FoldingRegion.

Definition at line 24 of file foldingregion.h.

Constructor & Destructor Documentation

FoldingRegion::FoldingRegion ( )

Constructs an invalid folding region, meaning that isValid() returns false.

To obtain valid instances, see AbstractHighlighter::applyFolding().

Definition at line 13 of file foldingregion.cpp.

Member Function Documentation

quint16 FoldingRegion::id ( ) const

Returns a unique identifier for this folding region.

As example, the C/C++ highlighter starts and ends a folding region for scopes, e.g.:

void foo() { // '{' starts a folding region
if (bar()) { // '{' starts a (nested) folding region
} // '}' ends the (nested) folding region
} // '}' ends the outer folding region

In this example, all braces '{' and '}' have the same id(), meaning that if you want to find the matching closing region for the first opening brace, you need to do kind of a reference counting to find the correct closing brace.

Definition at line 35 of file foldingregion.cpp.

bool FoldingRegion::isValid ( ) const

Returns true if this is a valid folding region.

A valid FoldingRegion is defined by a type() other than Type::None.

Note
The FoldingRegions passed in AbstractHighlighter::applyFolding() are always valid.

Definition at line 30 of file foldingregion.cpp.

bool FoldingRegion::operator== ( const FoldingRegion other) const

Compares two FoldingRegion instances for equality.

Definition at line 25 of file foldingregion.cpp.

FoldingRegion::Type FoldingRegion::type ( ) const

Returns whether this is the begin or end of a region.

Note
The FoldingRegions passed in AbstractHighlighter::applyFolding() are always valid, i.e. either Type::Begin or Type::End.

Definition at line 40 of file foldingregion.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 Sun Jun 20 2021 22:58:54 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.