1 /*
2     SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org>
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 
FoldingRegion()13 FoldingRegion::FoldingRegion()
14     : m_type(None)
15     , m_id(0)
16 {
17 }
18 
FoldingRegion(Type type,quint16 id)19 FoldingRegion::FoldingRegion(Type type, quint16 id)
20     : m_type(type)
21     , m_id(id)
22 {
23 }
24 
operator ==(const FoldingRegion & other) const25 bool FoldingRegion::operator==(const FoldingRegion &other) const
26 {
27     return m_id == other.m_id && m_type == other.m_type;
28 }
29 
isValid() const30 bool FoldingRegion::isValid() const
31 {
32     return type() != None;
33 }
34 
id() const35 quint16 FoldingRegion::id() const
36 {
37     return m_id;
38 }
39 
type() const40 FoldingRegion::Type FoldingRegion::type() const
41 {
42     return static_cast<FoldingRegion::Type>(m_type);
43 }
44