FAST  3.2.0
Framework for Heterogeneous Medical Image Computing and Visualization
PipelineEditor.hpp
Go to the documentation of this file.
1 #ifndef FAST_PIPELINE_EDITOR_HPP_
2 #define FAST_PIPELINE_EDITOR_HPP_
3 
4 #include <QWidget>
5 #include <string>
6 #include "FASTExport.hpp"
7 #include <QSyntaxHighlighter>
8 #include <QSyntaxHighlighter>
9 #include <QTextCharFormat>
10 #include <QRegularExpression>
11 
12 class QTextEdit;
13 
14 namespace fast {
15 
16 class PipelineHighlighter;
17 
18 class FAST_EXPORT PipelineEditor : public QWidget {
19  Q_OBJECT
20  public:
21  PipelineEditor(std::string filename);
22  void save();
23  private:
24  std::string mFilename;
25  QTextEdit* mEditor;
26  std::string m_memory;
27  PipelineHighlighter* highlighter;
28  signals:
32  void saved();
33 };
34 
35 
36 class FAST_EXPORT PipelineHighlighter : public QSyntaxHighlighter {
37  Q_OBJECT
38 
39  public:
40  PipelineHighlighter(QTextDocument* parent = 0);
41 
42  protected:
43  void highlightBlock(const QString& text) override;
44 
45  private:
46  struct HighlightingRule {
47  QRegularExpression pattern;
48  QTextCharFormat format;
49  };
50  QVector<HighlightingRule> highlightingRules;
51 
52  QTextCharFormat keywordFormat;
53  QTextCharFormat singleLineCommentFormat;
54  QTextCharFormat quotationFormat;
55 };
56 
57 }
58 
59 #endif
fast
Definition: AffineTransformation.hpp:7
fast::format
std::string format(std::string format, Args &&... args)
Definition: Utility.hpp:33
fast::PipelineHighlighter
Definition: PipelineEditor.hpp:36
fast::PipelineEditor
Definition: PipelineEditor.hpp:18