Eneboo - Documentación para desarrolladores
|
00001 /********************************************************************** 00002 ** 00003 ** Copyright (C) 2005-2007 Trolltech ASA. All rights reserved. 00004 ** 00005 ** This file is part of Qt Designer. 00006 ** 00007 ** This file may be distributed and/or modified under the terms of the 00008 ** GNU General Public License version 2 as published by the Free Software 00009 ** Foundation and appearing in the file LICENSE.GPL included in the 00010 ** packaging of this file. 00011 ** 00012 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 00013 ** licenses may use this file in accordance with the Qt Commercial License 00014 ** Agreement provided with the Software. 00015 ** 00016 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00017 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00018 ** 00019 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00020 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00021 ** information about Qt Commercial License Agreements. 00022 ** 00023 ** Contact info@trolltech.com if any conditions of this licensing are 00024 ** not clear to you. 00025 ** 00026 **********************************************************************/ 00027 00028 #ifndef QCPPSYNTAXHIGHLIGHTER_H 00029 #define QCPPSYNTAXHIGHLIGHTER_H 00030 00031 #include <private/qrichtext_p.h> 00032 #include <conf.h> 00033 00034 class SyntaxHighlighter_CPP : public QTextPreProcessor 00035 { 00036 public: 00037 enum CppIds { 00038 Comment = 1, 00039 Number, 00040 String, 00041 Type, 00042 Keyword, 00043 PreProcessor, 00044 Label 00045 }; 00046 00047 SyntaxHighlighter_CPP(); 00048 virtual ~SyntaxHighlighter_CPP(); 00049 void process( QTextDocument *doc, QTextParagraph *string, int start, bool invalidate = TRUE ); 00050 void updateStyles( const QMap<QString, ConfigStyle> &styles ); 00051 00052 static const char * const keywords[]; 00053 00054 QTextFormat *format( int id ); 00055 00056 private: 00057 void addFormat( int id, QTextFormat *f ); 00058 void removeFormat( int id ); 00059 00060 QTextFormat *lastFormat; 00061 int lastFormatId; 00062 QIntDict<QTextFormat> formats; 00063 00064 }; 00065 00066 #endif