Search for usage in LXR

KSyntaxHighlighting::FoldingRegion Class Reference

#include <foldingregion.h>

Public Types

enum  Type { None , Begin , End }

Public Member Functions

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

Detailed Description

Represents a begin or end of a folding region.


Definition at line 18 of file foldingregion.h.

Member Enumeration Documentation

◆ Type

Defines whether a FoldingRegion starts or ends a folding region.


Used internally as indicator for an invalid FoldingRegion.


Indicates the start of a FoldingRegion.


Indicates the end of a FoldingRegion.

Definition at line 24 of file foldingregion.h.

Constructor & Destructor Documentation

◆ FoldingRegion()

FoldingRegion::FoldingRegion ( )

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

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

Member Function Documentation

◆ id()

int 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 30 of file foldingregion.cpp.

◆ isValid()

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.

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

Definition at line 25 of file foldingregion.cpp.

◆ operator==()

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

Compares two FoldingRegion instances for equality.

Definition at line 20 of file foldingregion.cpp.

◆ sibling()

FoldingRegion FoldingRegion::sibling ( ) const

Returns the matching start or end region.

Will return invalid region for an invalid region.

Definition at line 43 of file foldingregion.cpp.

◆ type()

FoldingRegion::Type FoldingRegion::type ( ) const

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

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

Definition at line 35 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-2024 The KDE developers.
Generated on Fri Jun 14 2024 11:49:44 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.