pgLab/pglab/SqlSyntaxHighlighter.h
eelke 97d4e2a1a4 Created IndexModel for displaying the indexes on a table. Constraints can now show the SQL to drop and create them.
The keyword list is now directly based of the official keyword list from postgresql.
2018-01-06 21:22:22 +01:00

34 lines
751 B
C++

#ifndef SQLSYNTAXHIGHLIGHTER_H
#define SQLSYNTAXHIGHLIGHTER_H
#include <QSyntaxHighlighter>
#include <QTextFormat>
#include "PgKeywordList.h"
#include "util.h"
class PgTypeContainer;
class SqlSyntaxHighlighter : public QSyntaxHighlighter
{
Q_OBJECT
public:
SqlSyntaxHighlighter(QTextDocument *parent = nullptr);
~SqlSyntaxHighlighter();
void setTypes(const PgTypeContainer& types);
protected:
void highlightBlock(const QString &text) override;
private:
QTextCharFormat m_keywordFormat;
QTextCharFormat m_commentFormat;
QTextCharFormat m_quotedStringFormat;
QTextCharFormat m_typeFormat;
QTextCharFormat m_quotedIdentifierFormat;
QTextCharFormat m_parameterFormat;
t_SymbolSet m_typeNames;
};
#endif // SQLSYNTAXHIGHLIGHTER_H