qavrg 0.0.28
qavrghighlighter.h
Go to the documentation of this file.
00001 #ifndef QAVRGHIGHLIGHTER_H
00002 #define QAVRGHIGHLIGHTER_H
00003 
00004 #include <QSyntaxHighlighter>
00005 
00006 #include <QHash>
00007 #include <QTextCharFormat>
00008 
00009 class QTextDocument;
00010 
00011 class QavrgHighlighter : public QSyntaxHighlighter
00012 {
00013   Q_OBJECT
00014 
00015 public:
00016   QavrgHighlighter(QTextDocument *parent = 0);
00017 
00018 protected:
00019   void highlightBlock(const QString &text);
00020 
00021 private:
00022   struct HighlightingRule
00023   {
00024     QRegExp pattern;
00025     QTextCharFormat format;
00026   };
00027   QVector<HighlightingRule> highlightingRules;
00028 
00029   QRegExp commentStartExpression;
00030   QRegExp commentEndExpression;
00031 
00032   QTextCharFormat keywordFormat;
00033   QTextCharFormat classFormat;
00034   QTextCharFormat singleLineCommentFormat;
00035   QTextCharFormat multiLineCommentFormat;
00036   QTextCharFormat quotationFormat;
00037   QTextCharFormat functionFormat;
00038 };
00039 
00040 #endif