diff options
| author | 2023-04-30 18:30:36 -0400 | |
|---|---|---|
| committer | 2023-04-30 18:30:36 -0400 | |
| commit | 3565aad630864ecdbe53fdaa501ea708555b3c7c (patch) | |
| tree | c743e4ad0bad39ebdb2f514c7cc52d34a257ebbe /SQLiteStudio3/guiSQLiteStudio/sqlitesyntaxhighlighter.h | |
| parent | 1fdc150116cad39aae5c5da407c3312b47a59e3a (diff) | |
New upstream version 3.4.4+dfsg.upstream/3.4.4+dfsg
Diffstat (limited to 'SQLiteStudio3/guiSQLiteStudio/sqlitesyntaxhighlighter.h')
| -rw-r--r-- | SQLiteStudio3/guiSQLiteStudio/sqlitesyntaxhighlighter.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/SQLiteStudio3/guiSQLiteStudio/sqlitesyntaxhighlighter.h b/SQLiteStudio3/guiSQLiteStudio/sqlitesyntaxhighlighter.h index b17c45f..c11ab7d 100644 --- a/SQLiteStudio3/guiSQLiteStudio/sqlitesyntaxhighlighter.h +++ b/SQLiteStudio3/guiSQLiteStudio/sqlitesyntaxhighlighter.h @@ -52,11 +52,9 @@ class GUI_API_EXPORT SqliteSyntaxHighlighter : public QSyntaxHighlighter NUMBER }; + SqliteSyntaxHighlighter(QTextDocument *parent, const QHash<State,QTextCharFormat>* formats); explicit SqliteSyntaxHighlighter(QTextDocument *parent); - void setFormat(State state, QTextCharFormat format); - QTextCharFormat getFormat(State state) const; - void addError(int from, int to, bool limitedDamage = false); void clearErrors(); bool haveErrors(); @@ -107,6 +105,8 @@ class GUI_API_EXPORT SqliteSyntaxHighlighter : public QSyntaxHighlighter int to; }; + void init(const QHash<State,QTextCharFormat>* formats); + void setupMapping(); /** @@ -155,15 +155,13 @@ class GUI_API_EXPORT SqliteSyntaxHighlighter : public QSyntaxHighlighter void handleParenthesis(TokenPtr token, TextBlockData* data); static const int regulartTextBlockState = static_cast<int>(TextBlockState::REGULAR); - QHash<State,QTextCharFormat> formats; + QHash<Token::Type,State> tokenTypeMapping; QList<Error> errors; QList<DbObject> dbObjects; bool objectLinksEnabled = false; bool createTriggerContext = false; - - private slots: - void setupFormats(); + const QHash<State,QTextCharFormat>* formats = nullptr; }; class GUI_API_EXPORT SqliteHighlighterPlugin : public BuiltInPlugin, public SyntaxHighlighterPlugin @@ -172,12 +170,19 @@ class GUI_API_EXPORT SqliteHighlighterPlugin : public BuiltInPlugin, public Synt SQLITESTUDIO_PLUGIN_TITLE("SQL highlighter") SQLITESTUDIO_PLUGIN_DESC("SQL (SQLite) syntax highlighter.") - SQLITESTUDIO_PLUGIN_VERSION(10000) + SQLITESTUDIO_PLUGIN_VERSION(10100) SQLITESTUDIO_PLUGIN_AUTHOR("sqlitestudio.pl") public: + bool init(); QString getLanguageName() const; QSyntaxHighlighter* createSyntaxHighlighter(QWidget* textEdit) const; + void refreshFormats(); + QString previewSampleCode() const; + const QHash<SqliteSyntaxHighlighter::State,QTextCharFormat>* getFormats() const; + + private: + QHash<SqliteSyntaxHighlighter::State,QTextCharFormat> formats; }; GUI_API_EXPORT int qHash(SqliteSyntaxHighlighter::State state); |
