1 | /* |
2 | SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> |
3 | |
4 | SPDX-License-Identifier: MIT |
5 | */ |
6 | |
7 | #ifndef KSYNTAXHIGHLIGHTING_REPOSITORY_P_H |
8 | #define KSYNTAXHIGHLIGHTING_REPOSITORY_P_H |
9 | |
10 | #include <QHash> |
11 | #include <QList> |
12 | #include <QString> |
13 | |
14 | #include <map> |
15 | |
16 | #include "dynamicregexpcache_p.h" |
17 | |
18 | namespace KSyntaxHighlighting |
19 | { |
20 | class Definition; |
21 | class Repository; |
22 | class Theme; |
23 | |
24 | class RepositoryPrivate |
25 | { |
26 | public: |
27 | RepositoryPrivate() = default; |
28 | |
29 | static RepositoryPrivate *get(Repository *repo); |
30 | |
31 | void load(Repository *repo); |
32 | void loadSyntaxFolder(Repository *repo, const QString &path); |
33 | bool loadSyntaxFolderFromIndex(Repository *repo, const QString &path); |
34 | void computeAlternativeDefLists(); |
35 | |
36 | void addDefinition(Definition &&def); |
37 | |
38 | void loadThemeFolder(const QString &path); |
39 | void addTheme(const Theme &theme); |
40 | |
41 | int foldingRegionId(const QString &defName, const QString &foldName); |
42 | int nextFormatId(); |
43 | |
44 | QList<QString> m_customSearchPaths; |
45 | |
46 | // sorted map to have deterministic iteration order |
47 | std::map<QString, Definition> m_defs; |
48 | // flat version of m_defs for speed up iterations for e.g. definitionsForFileName |
49 | QList<Definition> m_flatDefs; |
50 | |
51 | // map relating all names and alternative names, case insensitively to the correct definition. |
52 | QHash<QString, Definition> m_fullDefs; |
53 | |
54 | // this vector is sorted by translated sections/names |
55 | QList<Definition> m_sortedDefs; |
56 | |
57 | QList<Theme> m_themes; |
58 | |
59 | QHash<QPair<QString, QString>, int> m_foldingRegionIds; |
60 | int m_foldingRegionId = 0; |
61 | int m_formatId = 0; |
62 | |
63 | DynamicRegexpCache m_dynamicRegexpCache; |
64 | }; |
65 | } |
66 | |
67 | #endif |
68 | |