/src/syntax-highlighting/src/lib/contextswitch_p.h
Line | Count | Source |
1 | | /* |
2 | | SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> |
3 | | |
4 | | SPDX-License-Identifier: MIT |
5 | | */ |
6 | | |
7 | | #ifndef KSYNTAXHIGHLIGHTING_CONTEXTSWITCH_P_H |
8 | | #define KSYNTAXHIGHLIGHTING_CONTEXTSWITCH_P_H |
9 | | |
10 | | #include <QStringView> |
11 | | #include <QVarLengthArray> |
12 | | |
13 | | namespace KSyntaxHighlighting |
14 | | { |
15 | | class Context; |
16 | | class DefinitionData; |
17 | | |
18 | | class ContextSwitch |
19 | | { |
20 | | public: |
21 | | using ContextList = QVarLengthArray<Context *, 2>; |
22 | | |
23 | 2.17k | ContextSwitch() = default; |
24 | 2.17k | ~ContextSwitch() = default; |
25 | | |
26 | | bool isStay() const |
27 | 2.53k | { |
28 | 2.53k | return m_isStay; |
29 | 2.53k | } |
30 | | |
31 | | int popCount() const |
32 | 0 | { |
33 | 0 | return m_popCount; |
34 | 0 | } |
35 | | |
36 | | const ContextList &contexts() const |
37 | 36 | { |
38 | 36 | return m_contexts; |
39 | 36 | } |
40 | | |
41 | | void resolve(DefinitionData &def, QStringView context); |
42 | | |
43 | | private: |
44 | | bool m_isStay = true; |
45 | | int m_popCount = 0; |
46 | | ContextList m_contexts; |
47 | | }; |
48 | | } |
49 | | |
50 | | #endif // KSYNTAXHIGHLIGHTING_CONTEXTSWITCH_P_H |