41 lines
917 B
C
41 lines
917 B
C
|
|
#pragma once
|
|||
|
|
|
|||
|
|
#include <QSyntaxHighlighter>
|
|||
|
|
#include <QRegularExpression>
|
|||
|
|
|
|||
|
|
#include <vector>
|
|||
|
|
|
|||
|
|
class SqlHighlighter : public QSyntaxHighlighter
|
|||
|
|
{
|
|||
|
|
Q_OBJECT
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
SqlHighlighter(QTextDocument *parent = 0);
|
|||
|
|
|
|||
|
|
protected:
|
|||
|
|
void highlightBlock(const QString &text) Q_DECL_OVERRIDE;
|
|||
|
|
|
|||
|
|
private:
|
|||
|
|
// struct HighlightingRule
|
|||
|
|
// {
|
|||
|
|
// QRegExp pattern;
|
|||
|
|
// QTextCharFormat format;
|
|||
|
|
|
|||
|
|
// HighlightingRule(const QRegExp ®ex, const QTextCharFormat &f)
|
|||
|
|
// : pattern(regex), format(f)
|
|||
|
|
// {}
|
|||
|
|
// };
|
|||
|
|
//QVector<HighlightingRule> highlightingRules;
|
|||
|
|
// std::vector<HighlightingRule> highlightingRules;
|
|||
|
|
|
|||
|
|
// QRegExp commentStartExpression;
|
|||
|
|
// QRegExp commentEndExpression;
|
|||
|
|
|
|||
|
|
// QTextCharFormat keywordFormat;
|
|||
|
|
// QTextCharFormat classFormat;
|
|||
|
|
// QTextCharFormat singleLineCommentFormat;
|
|||
|
|
// QTextCharFormat multiLineCommentFormat;
|
|||
|
|
// QTextCharFormat quotationFormat;
|
|||
|
|
// QTextCharFormat functionFormat;
|
|||
|
|
};
|