fw4spl
CppHighlighter.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2015.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __FWGUIQT_HIGHLIGHTER_CPPHIGHLIGHTER_HPP__
8 #define __FWGUIQT_HIGHLIGHTER_CPPHIGHLIGHTER_HPP__
9 
10 #include <QSyntaxHighlighter>
11 
12 #include <QHash>
13 #include <QTextCharFormat>
14 
15 #include "fwGuiQt/config.hpp"
16 
17 class QTextDocument;
18 
19 namespace fwGuiQt
20 {
21 namespace highlighter
22 {
23 
24 class FWGUIQT_CLASS_API CppHighlighter : public QSyntaxHighlighter
25 {
26 Q_OBJECT
27 
28 public:
29  FWGUIQT_API CppHighlighter(QTextDocument *parent = 0);
30 
31 protected:
32  FWGUIQT_API void highlightBlock(const QString &text);
33 
34 private:
35  struct HighlightingRule
36  {
37  QRegExp pattern;
38  QTextCharFormat format;
39  };
40  QVector<HighlightingRule> highlightingRules;
41 
42  QRegExp commentStartExpression;
43  QRegExp commentEndExpression;
44  QTextCharFormat multiLineCommentFormat;
45 
46 };
47 
48 } //namespace fwGuiQt
49 } //namespace highlighter
50 
51 #endif // __FWGUIQT_HIGHLIGHTER_CPPHIGHLIGHTER_HPP__
The namespace fwGuiQt contains classes which provide the implementation of the Gui using Qt library...
Definition: WindowLevel.hpp:32