KSyntaxHighlighting

foldingregion.cpp
1 /*
2  SPDX-FileCopyrightText: 2016 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: MIT
5 */
6 
7 #include "foldingregion.h"
8 
9 using namespace KSyntaxHighlighting;
10 
11 static_assert(sizeof(FoldingRegion) == 2, "FoldingRegion is size-sensitive to frequent use in KTextEditor!");
12 
14  : m_type(None)
15  , m_id(0)
16 {
17 }
18 
19 FoldingRegion::FoldingRegion(Type type, quint16 id)
20  : m_type(type)
21  , m_id(id)
22 {
23 }
24 
25 bool FoldingRegion::operator==(const FoldingRegion &other) const
26 {
27  return m_id == other.m_id && m_type == other.m_type;
28 }
29 
31 {
32  return type() != None;
33 }
34 
35 quint16 FoldingRegion::id() const
36 {
37  return m_id;
38 }
39 
41 {
42  return static_cast<FoldingRegion::Type>(m_type);
43 }
Represents a begin or end of a folding region.
Definition: foldingregion.h:18
bool isValid() const
Returns true if this is a valid folding region.
@ None
Used internally as indicator for invalid FoldingRegions.
Definition: foldingregion.h:26
FoldingRegion()
Constructs an invalid folding region, meaning that isValid() returns false.
bool operator==(const FoldingRegion &other) const
Compares two FoldingRegion instances for equality.
Type type() const
Returns whether this is the begin or end of a region.
quint16 id() const
Returns a unique identifier for this folding region.
Type
Defines whether a FoldingRegion starts or ends a folding region.
Definition: foldingregion.h:24
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Sep 23 2023 04:01:33 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.