1/*
2 SPDX-FileCopyrightText: 2001, 2002 Joseph Wenninger <jowenn@kde.org>
3 SPDX-FileCopyrightText: 2001 Christoph Cullmann <cullmann@kde.org>
4 SPDX-FileCopyrightText: 1999 Jochen Wilhelmy <digisnap@cs.tu-berlin.de>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#ifndef KATE_SYNTAX_MANAGER_H
10#define KATE_SYNTAX_MANAGER_H
11
12#include <KSyntaxHighlighting/Definition>
13#include <KSyntaxHighlighting/Repository>
14#include <KSyntaxHighlighting/Theme>
15
16#include <QObject>
17
18#include <memory>
19#include <unordered_map>
20
21class KateHighlighting;
22
23class KateHlManager : public QObject
24{
25 Q_OBJECT
26
27public:
28 KateHlManager() = default;
29
30 static KateHlManager *self();
31
32 KateHighlighting *getHl(int n);
33 int nameFind(const QString &name) const;
34
35 void reload();
36
37Q_SIGNALS:
38 void changed();
39
40 //
41 // methods to get the default style count + names
42 //
43public:
44 /**
45 * Get the mode list
46 * @return mode list
47 */
48 QList<KSyntaxHighlighting::Definition> modeList() const
49 {
50 return m_repository.definitions();
51 }
52
53 /**
54 * Get repository.
55 * @return repository
56 */
57 KSyntaxHighlighting::Repository &repository()
58 {
59 return m_repository;
60 }
61
62 /**
63 * Get repository (const).
64 * @return repository
65 */
66 const KSyntaxHighlighting::Repository &repository() const
67 {
68 return m_repository;
69 }
70
71 /**
72 * Sorted list of KSyntaxHighlighting themes.
73 * @return list sorted by translated names for e.g. menus/...
74 */
75 QList<KSyntaxHighlighting::Theme> sortedThemes() const;
76
77private:
78 /**
79 * Syntax highlighting definitions.
80 */
81 KSyntaxHighlighting::Repository m_repository;
82
83 /**
84 * All loaded highlightings.
85 */
86 std::unordered_map<QString, std::unique_ptr<KateHighlighting>> m_hlDict;
87};
88#endif
89

source code of ktexteditor/src/syntax/katesyntaxmanager.h