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