File indexing completed on 2024-04-21 15:25:28

0001 /*
0002     SPDX-FileCopyrightText: 2007 Piyush verma <piyush.verma@gmail.com>
0003     SPDX-FileCopyrightText: 2007 Andreas Pakulat <apaku@gmx.de>
0004     SPDX-FileCopyrightText: 2011 Sven Brauch <svenbrauch@gmail.com>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #ifndef KDEVPYTHONHIGHLIGHTING_H
0010 #define KDEVPYTHONHIGHLIGHTING_H
0011 
0012 #include <QObject>
0013 #include <QHash>
0014 #include <QModelIndex>
0015 
0016 #include <language/highlighting/codehighlighting.h>
0017 #include <language/duchain/topducontext.h>
0018 
0019 namespace Python
0020 {
0021     
0022 class Highlighting;
0023 
0024 class CodeHighlightingInstance : public KDevelop::CodeHighlightingInstance {
0025 public:
0026     CodeHighlightingInstance(const Highlighting* highlighting);
0027     void highlightUse(KDevelop::DUContext* context, int index, const QColor& color) override;
0028     bool useRainbowColor(KDevelop::Declaration* dec) const override;
0029 private:
0030     void checkHasBlocks(KDevelop::TopDUContext* top) const;
0031     mutable bool checked_blocks;
0032     mutable bool has_blocks;
0033 };
0034 
0035     
0036 class Highlighting : public KDevelop::CodeHighlighting
0037 {
0038 Q_OBJECT
0039 public:
0040     Highlighting( QObject* parent );
0041     CodeHighlightingInstance* createInstance() const override;
0042 };
0043 }
0044 #endif