pythonhighlighting.h 2.28 KB
Newer Older
1 2
/*****************************************************************************
 * Copyright (c) 2007 Piyush verma <piyush.verma@gmail.com>                  *
3 4
 * Copyright (c) 2007 Andreas Pakulat <apaku@gmx.de>                         *
 * Copyright (c) 2011 Sven Brauch <svenbrauch@gmail.com>                     *
5
 *                                                                           *
6 7 8 9
 * This program is free software; you can redistribute it and/or             *
 * modify it under the terms of the GNU General Public License as            *
 * published by the Free Software Foundation; either version 2 of            *
 * the License, or (at your option) any later version.                       *
10
 *                                                                           *
11 12 13 14
 * This program is distributed in the hope that it will be useful,           *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
 * GNU General Public License for more details.                              *
15
 *                                                                           *
16 17 18 19
 * You should have received a copy of the GNU General Public License         *
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.     *
 *****************************************************************************
 */
20 21
#ifndef KDEVPYTHONHIGHLIGHTING_H
#define KDEVPYTHONHIGHLIGHTING_H
22 23 24 25 26

#include <QObject>
#include <QHash>
#include <QModelIndex>

27
#include <language/highlighting/codehighlighting.h>
28
#include <language/duchain/topducontext.h>
29

Andreas Pakulat's avatar
Andreas Pakulat committed
30
namespace Python
31
{
32 33
    
class Highlighting;
34

35 36 37
class CodeHighlightingInstance : public KDevelop::CodeHighlightingInstance {
public:
    CodeHighlightingInstance(const Highlighting* highlighting);
38 39
    void highlightUse(KDevelop::DUContext* context, int index, const QColor& color) override;
    bool useRainbowColor(KDevelop::Declaration* dec) const override;
40 41 42 43
private:
    void checkHasBlocks(KDevelop::TopDUContext* top) const;
    mutable bool checked_blocks;
    mutable bool has_blocks;
44 45 46
};

    
47
class Highlighting : public KDevelop::CodeHighlighting
48
{
49
Q_OBJECT
50
public:
Andreas Pakulat's avatar
Andreas Pakulat committed
51
    Highlighting( QObject* parent );
52
    CodeHighlightingInstance* createInstance() const override;
53
};
54
}
55
#endif