File indexing completed on 2024-12-08 10:25:56

0001 /*
0002    SPDX-FileCopyrightText: 2018-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <KSyntaxHighlighting/Definition>
0010 #include <KSyntaxHighlighting/Repository>
0011 #include <QObject>
0012 
0013 class SyntaxHighlightingManager : public QObject
0014 {
0015     Q_OBJECT
0016 public:
0017     explicit SyntaxHighlightingManager(QObject *parent = nullptr);
0018     ~SyntaxHighlightingManager() override = default;
0019 
0020     static SyntaxHighlightingManager *self();
0021 
0022     [[nodiscard]] bool syntaxHighlightingInitialized() const;
0023 
0024     [[nodiscard]] KSyntaxHighlighting::Definition def(const QString &name) const;
0025     [[nodiscard]] KSyntaxHighlighting::Definition defaultDef() const;
0026 
0027     KSyntaxHighlighting::Repository &repo() const;
0028 
0029 private:
0030     Q_DISABLE_COPY(SyntaxHighlightingManager)
0031     void initialize();
0032     mutable KSyntaxHighlighting::Repository mRepo;
0033     KSyntaxHighlighting::Definition mDefaultDef;
0034     QVector<QString> mDefinitions;
0035     bool mSyntaxHighlightingInitialized = false;
0036 };