| 1 | /* |
| 2 | SPDX-FileCopyrightText: 2014 Christoph Rüßler <christoph.ruessler@mailbox.org> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 | */ |
| 6 | |
| 7 | #ifndef KATE_HIGHLIGHTING_CMDS_H |
| 8 | #define KATE_HIGHLIGHTING_CMDS_H |
| 9 | |
| 10 | #include <KTextEditor/Command> |
| 11 | |
| 12 | namespace KateCommands |
| 13 | { |
| 14 | class Highlighting : public KTextEditor::Command |
| 15 | { |
| 16 | Highlighting() |
| 17 | : KTextEditor::Command({QStringLiteral("reload-highlighting" ), QStringLiteral("edit-highlighting" )}) |
| 18 | { |
| 19 | } |
| 20 | |
| 21 | static Highlighting *m_instance; |
| 22 | |
| 23 | public: |
| 24 | ~Highlighting() override |
| 25 | { |
| 26 | m_instance = nullptr; |
| 27 | } |
| 28 | |
| 29 | static Highlighting *self() |
| 30 | { |
| 31 | if (m_instance == nullptr) { |
| 32 | m_instance = new Highlighting(); |
| 33 | } |
| 34 | return m_instance; |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * execute command |
| 39 | * @param view view to use for execution |
| 40 | * @param cmd cmd string |
| 41 | * @param errorMsg error to return if no success |
| 42 | * @return success |
| 43 | */ |
| 44 | bool exec(class KTextEditor::View *view, const QString &cmd, QString &errorMsg, const KTextEditor::Range &range = KTextEditor::Range::invalid()) override; |
| 45 | |
| 46 | /** This command does not have help. @see KTextEditor::Command::help */ |
| 47 | bool help(class KTextEditor::View *, const QString &, QString &) override; |
| 48 | }; |
| 49 | |
| 50 | } |
| 51 | |
| 52 | #endif |
| 53 | |