ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/s10k/Vago/libs/BasicXMLSyntaxHighlighter/BasicXMLSyntaxHighlighter.h
Revision: 1092
Committed: Sat Dec 30 13:43:28 2017 UTC (7 years, 11 months ago) by s10k
Content type: text/x-chdr
File size: 1116 byte(s)
Log Message:
moved files to s10k directory since now vago uses the same libs structures as my other projects (e.g. XmlTools)

File Contents

# Content
1 #ifndef BASIC_XML_SYNTAX_HIGHLIGHTER_H
2 #define BASIC_XML_SYNTAX_HIGHLIGHTER_H
3
4 #include <QSyntaxHighlighter>
5 #include <QTextEdit>
6
7 class BasicXMLSyntaxHighlighter : public QSyntaxHighlighter
8 {
9 Q_OBJECT
10 public:
11 BasicXMLSyntaxHighlighter(QObject * parent);
12 BasicXMLSyntaxHighlighter(QTextDocument * parent);
13 BasicXMLSyntaxHighlighter(QTextEdit * parent);
14
15 protected:
16 virtual void highlightBlock(const QString & text);
17
18 private:
19 void highlightByRegex(const QTextCharFormat & format,
20 const QRegExp & regex, const QString & text);
21
22 void setRegexes();
23 void setFormats();
24
25 private:
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