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
13namespace KSyntaxHighlighting
14{
15class Context;
16class DefinitionData;
17
18class ContextSwitch
19{
20public:
21 using ContextList = QVarLengthArray<Context *, 2>;
22
23 ContextSwitch() = default;
24 ~ContextSwitch() = default;
25
26 bool isStay() const
27 {
28 return m_isStay;
29 }
30
31 int popCount() const
32 {
33 return m_popCount;
34 }
35
36 const ContextList &contexts() const
37 {
38 return m_contexts;
39 }
40
41 void resolve(DefinitionData &def, QStringView context);
42
43private:
44 bool m_isStay = true;
45 int m_popCount = 0;
46 ContextList m_contexts;
47};
48}
49
50#endif // KSYNTAXHIGHLIGHTING_CONTEXTSWITCH_P_H
51

source code of syntax-highlighting/src/lib/contextswitch_p.h