diff options
| author | 2023-04-30 18:31:18 -0400 | |
|---|---|---|
| committer | 2023-04-30 18:31:18 -0400 | |
| commit | 4de57f628bc74f00ba1885e91c84ea07c5405d8f (patch) | |
| tree | 5d91900751e826d491ff1b2ebc571a787e84f864 /SQLiteStudio3/guiSQLiteStudio/sqlitesyntaxhighlighter.h | |
| parent | 74d881cefa9097e58e129e37b9c44d680d8c7dfe (diff) | |
| parent | 3565aad630864ecdbe53fdaa501ea708555b3c7c (diff) | |
Update upstream source from tag 'upstream/3.4.4+dfsg'
Update to upstream version '3.4.4+dfsg'
with Debian dir 482614bd23f0ef52dabc9803477204ad88e917ed
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); |
