![]() |
|
|
00001 /*************************************************************************** 00002 * inspectorJ - java profiler * 00003 * Copyright (C) 2007 by James May 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 00027 #ifndef BYTECODE_HIGHLIGHTER_H 00028 #define BYTECODE_HIGHLIGHTER_H 00029 00030 #include <QSyntaxHighlighter> 00031 #include <QHash> 00032 #include <QTextCharFormat> 00033 00034 class QTextDocument; 00035 00036 namespace inspectorj { 00037 namespace model { 00038 00043 class BytecodeHighlighter : public QSyntaxHighlighter 00044 { 00045 Q_OBJECT 00046 00047 public: 00048 BytecodeHighlighter(QTextDocument *parent = 0); 00049 00050 protected: 00051 void highlightBlock(const QString &text); 00052 00053 private: 00058 struct HighlightingRule 00059 { 00060 QRegExp pattern; 00061 QTextCharFormat format; 00062 }; 00063 QVector<HighlightingRule> highlightingRules; 00064 00065 QRegExp commentStartExpression; 00066 QRegExp commentEndExpression; 00067 00068 QTextCharFormat keywordFormat; 00069 QTextCharFormat headerFormat; 00070 QTextCharFormat classFormat; 00071 QTextCharFormat singleLineCommentFormat; 00072 QTextCharFormat multiLineCommentFormat; 00073 QTextCharFormat quotationFormat; 00074 QTextCharFormat functionFormat; 00075 QTextCharFormat numberFormat; 00076 QTextCharFormat errFormat; 00077 }; 00078 00079 } // end namespace model 00080 } // end namespace inspectorj 00081 00082 #endif