KTextEditor

include/ktexteditor/command.h
1 /*
2  SPDX-FileCopyrightText: 2005 Christoph Cullmann <[email protected]>
3  SPDX-FileCopyrightText: 2005-2006 Dominik Haumann <[email protected]>
4  SPDX-FileCopyrightText: 2008 Erlend Hamberg <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #ifndef KTEXTEDITOR_COMMAND_H
10 #define KTEXTEDITOR_COMMAND_H
11 
12 #include <KCompletion>
13 #include <ktexteditor/range.h>
14 #include <ktexteditor_export.h>
15 
16 #include <QObject>
17 
18 class QStringList;
19 class KCompletion;
20 
21 namespace KTextEditor
22 {
23 class View;
24 
70 class KTEXTEDITOR_EXPORT Command : public QObject
71 {
72  Q_OBJECT
73 
74 public:
79  Command(const QStringList &cmds, QObject *parent = nullptr);
80 
85  virtual ~Command();
86 
87 public:
96  inline const QStringList &cmds() const
97  {
98  return m_cmds;
99  }
100 
109  virtual bool supportsRange(const QString &cmd);
110 
124  virtual bool exec(KTextEditor::View *view, const QString &cmd, QString &msg, const KTextEditor::Range &range = KTextEditor::Range::invalid()) = 0;
125 
133  virtual bool help(KTextEditor::View *view, const QString &cmd, QString &msg) = 0;
134 
152  virtual KCompletion *completionObject(KTextEditor::View *view, const QString &cmdname);
153 
168  virtual bool wantsToProcessText(const QString &cmdname);
169 
177  virtual void processText(KTextEditor::View *view, const QString &text);
178 
179 private:
183  const QStringList m_cmds;
184 
188  class CommandPrivate *const d;
189 };
190 
191 }
192 
193 #endif
const QStringList & cmds() const
Return a list of strings a command may begin with.
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
An object representing a section of text, from one Cursor to another.
An Editor command line command.
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.