fw4spl
PythonHighlighter.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_PYTHONHIGHLIGHTER_HPP__
8 #define __FWGUIQT_HIGHLIGHTER_PYTHONHIGHLIGHTER_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 PythonHighlighter : public QSyntaxHighlighter
25 {
26 Q_OBJECT
27 
28 public:
29  FWGUIQT_API PythonHighlighter(QTextDocument *parent = 0);
30 
31 protected:
32 
33  FWGUIQT_API void highlightBlock(const QString &text);
34 
35 private:
36 
37  class HighlightingRule
38  {
39  public:
40  HighlightingRule() : nth(0)
41  {
42  }
43  int nth;
44  QRegExp pattern;
45  QTextCharFormat format;
46  };
47 
48  QVector<HighlightingRule> highlightingRules;
49 
50  QRegExp commentStartExpression;
51  QRegExp commentEndExpression;
52  QTextCharFormat multiLineCommentFormat;
53 
54 };
55 
56 } //namespace fwGuiQt
57 } //namespace highlighter
58 
59 #endif // __FWGUIQT_HIGHLIGHTER_PYTHONHIGHLIGHTER_HPP__
The namespace fwGuiQt contains classes which provide the implementation of the Gui using Qt library...
Definition: WindowLevel.hpp:32