KSyntaxHighlighting

foldingregion.cpp
1/*
2 SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: MIT
5*/
6
7#include "foldingregion.h"
8
9using namespace KSyntaxHighlighting;
10
11static_assert(sizeof(FoldingRegion) == sizeof(int), "FoldingRegion is size-sensitive to frequent use in KTextEditor!");
12
14
15FoldingRegion::FoldingRegion(Type type, int id)
16 : m_idWithType((type == End) ? -id : id)
17{
18}
19
21{
22 return m_idWithType == other.m_idWithType;
23}
24
26{
27 return m_idWithType != 0;
28}
29
31{
32 return (m_idWithType < 0) ? -m_idWithType : m_idWithType;
33}
34
36{
37 if (isValid()) {
38 return (m_idWithType < 0) ? End : Begin;
39 }
40 return None;
41}
42
44{
45 return isValid() ? FoldingRegion(type() ? End : Begin, id()) : FoldingRegion();
46}
Represents a begin or end of a folding region.
FoldingRegion()
Constructs an invalid folding region, meaning that isValid() returns false.
Type
Defines whether a FoldingRegion starts or ends a folding region.
@ Begin
Indicates the start of a FoldingRegion.
@ None
Used internally as indicator for an invalid FoldingRegion.
@ End
Indicates the end of a FoldingRegion.
int id() const
Returns a unique identifier for this folding region.
bool isValid() const
Returns true if this is a valid folding region.
Type type() const
Returns whether this is the begin or end of a region.
FoldingRegion sibling() const
Returns the matching start or end region.
bool operator==(const FoldingRegion &other) const
Compares two FoldingRegion instances for equality.
Type type(const QSqlDatabase &db)
Syntax highlighting engine for Kate syntax definitions.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:03:33 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.