KTextEditor

katecmds.h
1 /*
2  SPDX-FileCopyrightText: 2003-2005 Anders Lund <[email protected]>
3  SPDX-FileCopyrightText: 2001-2010 Christoph Cullmann <[email protected]>
4  SPDX-FileCopyrightText: 2001 Charles Samuels <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #ifndef KATE_CMDS_H
10 #define KATE_CMDS_H
11 
12 #include <KTextEditor/Command>
13 
14 #include <QStringList>
15 
16 class KCompletion;
17 
22 namespace KateCommands
23 {
31 {
32  CoreCommands()
33  : KTextEditor::Command({QStringLiteral("indent"),
34  QStringLiteral("unindent"),
35  QStringLiteral("cleanindent"),
36  QStringLiteral("fold"),
37  QStringLiteral("tfold"),
38  QStringLiteral("unfold"),
39  QStringLiteral("comment"),
40  QStringLiteral("uncomment"),
41  QStringLiteral("goto"),
42  QStringLiteral("kill-line"),
43  QStringLiteral("set-tab-width"),
44  QStringLiteral("set-replace-tabs"),
45  QStringLiteral("set-show-tabs"),
46  QStringLiteral("set-indent-width"),
47  QStringLiteral("set-indent-mode"),
48  QStringLiteral("set-auto-indent"),
49  QStringLiteral("set-line-numbers"),
50  QStringLiteral("set-folding-markers"),
51  QStringLiteral("set-icon-border"),
52  QStringLiteral("set-indent-pasted-text"),
53  QStringLiteral("set-word-wrap"),
54  QStringLiteral("set-word-wrap-column"),
55  QStringLiteral("set-replace-tabs-save"),
56  QStringLiteral("set-remove-trailing-spaces"),
57  QStringLiteral("set-highlight"),
58  QStringLiteral("set-mode"),
59  QStringLiteral("set-show-indent"),
60  QStringLiteral("print")})
61  {
62  }
63 
64  static CoreCommands *m_instance;
65 
66 public:
67  ~CoreCommands() override
68  {
69  m_instance = nullptr;
70  }
71 
79  bool exec(class KTextEditor::View *view, const QString &cmd, QString &errorMsg);
80 
89  bool exec(class KTextEditor::View *view, const QString &cmd, QString &errorMsg, const KTextEditor::Range &range = KTextEditor::Range(-1, -0, -1, 0)) override;
90 
91  bool supportsRange(const QString &range) override;
92 
94  bool help(class KTextEditor::View *, const QString &, QString &) override;
95 
98 
99  static CoreCommands *self()
100  {
101  if (m_instance == nullptr) {
102  m_instance = new CoreCommands();
103  }
104  return m_instance;
105  }
106 };
107 
117 {
118  Character()
119  : KTextEditor::Command({QStringLiteral("char")})
120  {
121  }
122 
123  static Character *m_instance;
124 
125 public:
126  ~Character() override
127  {
128  m_instance = nullptr;
129  }
130 
138  bool exec(class KTextEditor::View *view, const QString &cmd, QString &errorMsg, const KTextEditor::Range &range = KTextEditor::Range(-1, -0, -1, 0)) override;
139 
141  bool help(class KTextEditor::View *, const QString &, QString &) override;
142 
143  static Character *self()
144  {
145  if (m_instance == nullptr) {
146  m_instance = new Character();
147  }
148  return m_instance;
149  }
150 };
151 
156 {
157  Date()
158  : KTextEditor::Command({QStringLiteral("date")})
159  {
160  }
161 
162  static Date *m_instance;
163 
164 public:
165  ~Date() override
166  {
167  m_instance = nullptr;
168  }
169 
177  bool exec(class KTextEditor::View *view, const QString &cmd, QString &errorMsg, const KTextEditor::Range &range = KTextEditor::Range(-1, -0, -1, 0)) override;
178 
180  bool help(class KTextEditor::View *, const QString &, QString &) override;
181 
182  static Date *self()
183  {
184  if (m_instance == nullptr) {
185  m_instance = new Date();
186  }
187  return m_instance;
188  }
189 };
190 
191 } // namespace KateCommands
192 #endif
This KTextEditor::Command provides access to a lot of the core functionality of kate part...
Definition: katecmds.h:30
insert the current date/time in the given format
Definition: katecmds.h:155
bool help(class KTextEditor::View *, const QString &, QString &) override
This command does not have help.
Definition: katecmds.cpp:48
KCompletion * completionObject(KTextEditor::View *, const QString &) override
override from KTextEditor::Command
Definition: katecmds.cpp:446
insert a unicode or ascii character base 9+1: 1234 hex: 0x1234 or x1234 octal: 01231 ...
Definition: katecmds.h:116
bool exec(class KTextEditor::View *view, const QString &cmd, QString &errorMsg)
execute command
An object representing a section of text, from one Cursor to another.
An Editor command line command.
The KateCommands namespace collects subclasses of KTextEditor::Command for specific use in kate...
A text widget with KXMLGUIClient that represents a Document.
Definition: view.h:143
bool supportsRange(const QString &range) override
Find out if a given command can act on a range.
Definition: katecmds.cpp:435
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Sep 23 2020 22:58:19 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.