KTextEditor

katecommandlinescript.h
1 /*
2  SPDX-FileCopyrightText: 2009-2018 Dominik Haumann <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef KATE_COMMANDLINE_SCRIPT_H
8 #define KATE_COMMANDLINE_SCRIPT_H
9 
10 #include "katescript.h"
11 #include "kateview.h"
12 
13 #include <KTextEditor/Command>
14 
15 #include <QJsonArray>
16 
17 class KateCommandLineScriptHeader
18 {
19 public:
20  KateCommandLineScriptHeader()
21  {
22  }
23 
24  inline void setFunctions(const QStringList &functions)
25  {
26  m_functions = functions;
27  }
28  inline const QStringList &functions() const
29  {
30  return m_functions;
31  }
32 
33  inline void setActions(const QJsonArray &actions)
34  {
35  m_actions = actions;
36  }
37  inline const QJsonArray &actions() const
38  {
39  return m_actions;
40  }
41 
42 private:
43  QStringList m_functions;
44  QJsonArray m_actions;
45 };
46 
51 {
52 public:
53  KateCommandLineScript(const QString &url, const KateCommandLineScriptHeader &header);
54  ~KateCommandLineScript() override;
55 
56  const KateCommandLineScriptHeader &commandHeader();
57 
58  bool callFunction(const QString &cmd, const QStringList &args, QString &errorMessage);
59 
60  //
61  // KTextEditor::Command interface
62  //
63 public:
64  bool help(KTextEditor::View *view, const QString &cmd, QString &msg) override;
65  bool exec(KTextEditor::View *view, const QString &cmd, QString &msg, const KTextEditor::Range &range = KTextEditor::Range::invalid()) override;
66  bool supportsRange(const QString &cmd) override;
67 
68 private:
69  KateCommandLineScriptHeader m_commandHeader;
70 };
71 
72 #endif
KateScript objects represent a script that can be executed and inspected.
Definition: katescript.h:106
A specialized class for scripts that are of type ScriptType::Indentation.
An object representing a section of text, from one Cursor to another.
An Editor command line command.
KCALUTILS_EXPORT QString errorMessage(const KCalendarCore::Exception &exception)
static constexpr Range invalid() Q_DECL_NOEXCEPT
Returns an invalid range.
A text widget with KXMLGUIClient that represents a Document.
Definition: view.h:143
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat Sep 19 2020 22:57:18 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.