KSyntaxHighlighting

repositorywrapper.h
1 /*
2  SPDX-FileCopyrightText: 2021 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: MIT
5 */
6 
7 #ifndef REPOSITORYWRAPPER_H
8 #define REPOSITORYWRAPPER_H
9 
10 #include <QObject>
11 
12 namespace KSyntaxHighlighting
13 {
14 class Definition;
15 class Repository;
16 class Theme;
17 }
18 
19 // TODO KF6: merge this into KSyntaxHighlighting::Repository
20 class RepositoryWrapper : public QObject
21 {
22  Q_OBJECT
23  // TODO KF6: NOTIFY on reload
24  Q_PROPERTY(QVector<KSyntaxHighlighting::Definition> definitions READ definitions CONSTANT)
25  Q_PROPERTY(QVector<KSyntaxHighlighting::Theme> themes READ themes CONSTANT)
26 public:
27  explicit RepositoryWrapper(QObject *parent = nullptr);
28 
29  Q_INVOKABLE KSyntaxHighlighting::Definition definitionForName(const QString &defName) const;
30  Q_INVOKABLE KSyntaxHighlighting::Definition definitionForFileName(const QString &fileName) const;
31  Q_INVOKABLE QVector<KSyntaxHighlighting::Definition> definitionsForFileName(const QString &fileName) const;
32  Q_INVOKABLE KSyntaxHighlighting::Definition definitionForMimeType(const QString &mimeType) const;
33  Q_INVOKABLE QVector<KSyntaxHighlighting::Definition> definitionsForMimeType(const QString &mimeType) const;
34  QVector<KSyntaxHighlighting::Definition> definitions() const;
35 
37  Q_INVOKABLE KSyntaxHighlighting::Theme theme(const QString &themeName) const;
38  enum DefaultTheme { LightTheme, DarkTheme };
39  Q_ENUM(DefaultTheme)
40  Q_INVOKABLE KSyntaxHighlighting::Theme defaultTheme(DefaultTheme t = LightTheme) const;
41 
42  KSyntaxHighlighting::Repository *m_repository = nullptr;
43 };
44 
45 #endif // REPOSITORYWRAPPER_H
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_ENUM(...)
Syntax highlighting repository.
Definition: repository.h:127
Q_INVOKABLEQ_INVOKABLE
Represents a syntax definition.
Definition: definition.h:86
Color theme definition used for highlighting.
Definition: theme.h:64
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Mar 26 2023 04:09:17 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.