source: s10k/Vago/libs/BasicXMLSyntaxHighlighter/BasicXMLSyntaxHighlighter.h@ 1092

Last change on this file since 1092 was 1058, checked in by s10k, 8 years ago

Vago 1.2

File size: 1.1 KB
Line 
1#ifndef BASIC_XML_SYNTAX_HIGHLIGHTER_H
2#define BASIC_XML_SYNTAX_HIGHLIGHTER_H
3
4#include <QSyntaxHighlighter>
5#include <QTextEdit>
6
7class BasicXMLSyntaxHighlighter : public QSyntaxHighlighter
8{
9 Q_OBJECT
10public:
11 BasicXMLSyntaxHighlighter(QObject * parent);
12 BasicXMLSyntaxHighlighter(QTextDocument * parent);
13 BasicXMLSyntaxHighlighter(QTextEdit * parent);
14
15protected:
16 virtual void highlightBlock(const QString & text);
17
18private:
19 void highlightByRegex(const QTextCharFormat & format,
20 const QRegExp & regex, const QString & text);
21
22 void setRegexes();
23 void setFormats();
24
25private:
26 QTextCharFormat m_xmlKeywordFormat;
27 QTextCharFormat m_xmlElementFormat;
28 QTextCharFormat m_xmlAttributeFormat;
29 QTextCharFormat m_xmlValueFormat;
30 QTextCharFormat m_xmlCommentFormat;
31
32 QList<QRegExp> m_xmlKeywordRegexes;
33 QRegExp m_xmlElementRegex;
34 QRegExp m_xmlAttributeRegex;
35 QRegExp m_xmlValueRegex;
36 QRegExp m_xmlCommentRegex;
37};
38
39#endif // BASIC_XML_SYNTAX_HIGHLIGHTER_H
Note: See TracBrowser for help on using the repository browser.