2017-02-07 21:39:45 +01:00
|
|
|
|
#ifndef SQLSYNTAXHIGHLIGHTER_H
|
|
|
|
|
|
#define SQLSYNTAXHIGHLIGHTER_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <QSyntaxHighlighter>
|
|
|
|
|
|
#include <QTextFormat>
|
2018-12-16 10:17:59 +01:00
|
|
|
|
#include "catalog/PgKeywordList.h"
|
2017-02-07 21:39:45 +01:00
|
|
|
|
#include "util.h"
|
|
|
|
|
|
|
|
|
|
|
|
class PgTypeContainer;
|
|
|
|
|
|
|
|
|
|
|
|
class SqlSyntaxHighlighter : public QSyntaxHighlighter
|
|
|
|
|
|
{
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
SqlSyntaxHighlighter(QTextDocument *parent = nullptr);
|
2019-08-23 09:43:48 +02:00
|
|
|
|
~SqlSyntaxHighlighter() override;
|
2017-02-07 21:39:45 +01:00
|
|
|
|
|
2017-12-09 20:21:22 +01:00
|
|
|
|
void setTypes(const PgTypeContainer& types);
|
2017-02-07 21:39:45 +01:00
|
|
|
|
protected:
|
|
|
|
|
|
void highlightBlock(const QString &text) override;
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
QTextCharFormat m_keywordFormat;
|
|
|
|
|
|
QTextCharFormat m_commentFormat;
|
|
|
|
|
|
QTextCharFormat m_quotedStringFormat;
|
|
|
|
|
|
QTextCharFormat m_typeFormat;
|
2017-02-09 21:54:31 +01:00
|
|
|
|
QTextCharFormat m_quotedIdentifierFormat;
|
2017-09-10 10:13:58 +02:00
|
|
|
|
QTextCharFormat m_parameterFormat;
|
2017-02-07 21:39:45 +01:00
|
|
|
|
|
|
|
|
|
|
t_SymbolSet m_typeNames;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // SQLSYNTAXHIGHLIGHTER_H
|