File indexing completed on 2024-04-21 03:57:43

0001 /*
0002     SPDX-FileCopyrightText: 2014 Christoph Rüßler <christoph.ruessler@mailbox.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KATE_HIGHLIGHTING_CMDS_H
0008 #define KATE_HIGHLIGHTING_CMDS_H
0009 
0010 #include <KTextEditor/Command>
0011 
0012 namespace KateCommands
0013 {
0014 class Highlighting : public KTextEditor::Command
0015 {
0016     Highlighting()
0017         : KTextEditor::Command({QStringLiteral("reload-highlighting"), QStringLiteral("edit-highlighting")})
0018     {
0019     }
0020 
0021     static Highlighting *m_instance;
0022 
0023 public:
0024     ~Highlighting() override
0025     {
0026         m_instance = nullptr;
0027     }
0028 
0029     static Highlighting *self()
0030     {
0031         if (m_instance == nullptr) {
0032             m_instance = new Highlighting();
0033         }
0034         return m_instance;
0035     }
0036 
0037     /**
0038      * execute command
0039      * @param view view to use for execution
0040      * @param cmd cmd string
0041      * @param errorMsg error to return if no success
0042      * @return success
0043      */
0044     bool exec(class KTextEditor::View *view, const QString &cmd, QString &errorMsg, const KTextEditor::Range &range = KTextEditor::Range::invalid()) override;
0045 
0046     /** This command does not have help. @see KTextEditor::Command::help */
0047     bool help(class KTextEditor::View *, const QString &, QString &) override;
0048 };
0049 
0050 }
0051 
0052 #endif