1/*
2 SPDX-FileCopyrightText: KDE Developers
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KATEVI_MACROS_H
8#define KATEVI_MACROS_H
9
10#include "completion.h"
11#include "keyevent.h"
12#include "ktexteditor_export.h"
13
14#include <QKeyEvent>
15
16class KConfigGroup;
17
18namespace KateVi
19{
20class Macros
21{
22public:
23 explicit Macros();
24 ~Macros();
25
26 void writeConfig(KConfigGroup &config) const;
27 void readConfig(const KConfigGroup &config);
28
29 void store(const QChar &reg, const QList<KeyEvent> &macroKeyEventLog, const CompletionList &completions);
30 void remove(const QChar &reg);
31 KTEXTEDITOR_EXPORT void clear();
32
33 QString get(const QChar &reg) const;
34 CompletionList getCompletions(const QChar &reg) const;
35
36private:
37 int readMacroCompletions(const QChar &reg, const QStringList &encodedMacroCompletions, int macroCompletionIndex);
38 static QString encodeMacroCompletionForConfig(const Completion &completionForMacro);
39 static Completion decodeMacroCompletionFromConfig(const QString &encodedMacroCompletion);
40
41private:
42 QHash<QChar, QString> m_macros;
43 QHash<QChar, QList<Completion>> m_completions;
44};
45
46}
47
48#endif // KATEVI_MACROS_H
49

source code of ktexteditor/src/vimode/macros.h