1 | /* |
2 | SPDX-FileCopyrightText: KDE Developers |
3 | |
4 | SPDX-License-Identifier: LGPL-2.0-or-later |
5 | */ |
6 | |
7 | #ifndef KATEVI_REGISTERS_H |
8 | #define KATEVI_REGISTERS_H |
9 | |
10 | #include "definitions.h" |
11 | |
12 | #include <QChar> |
13 | #include <QList> |
14 | #include <QString> |
15 | #include <map> |
16 | |
17 | class KConfigGroup; |
18 | |
19 | namespace KateVi |
20 | { |
21 | const QChar BlackHoleRegister = QLatin1Char('_'); |
22 | const QChar SmallDeleteRegister = QLatin1Char('-'); |
23 | const QChar ZeroRegister = QLatin1Char('0'); |
24 | const QChar PrependNumberedRegister = QLatin1Char('!'); |
25 | const QChar FirstNumberedRegister = QLatin1Char('1'); |
26 | const QChar LastNumberedRegister = QLatin1Char('9'); |
27 | const QChar SystemSelectionRegister = QLatin1Char('*'); |
28 | const QChar SystemClipboardRegister = QLatin1Char('+'); |
29 | const QChar UnnamedRegister = QLatin1Char('"'); |
30 | const QChar InsertStoppedRegister = QLatin1Char('^'); |
31 | |
32 | class Registers |
33 | { |
34 | public: |
35 | void writeConfig(KConfigGroup &config) const; |
36 | void readConfig(const KConfigGroup &config); |
37 | |
38 | void setInsertStopped(const QString &text); |
39 | |
40 | void set(const QChar ®, const QString &text, OperationMode flag = CharWise); |
41 | QString getContent(const QChar ®) const; |
42 | OperationMode getFlag(const QChar ®) const; |
43 | |
44 | private: |
45 | typedef QPair<QString, OperationMode> Register; |
46 | |
47 | private: |
48 | void setNumberedRegister(const QChar ®, const QString &text, OperationMode flag = CharWise); |
49 | Register getRegister(const QChar ®) const; |
50 | |
51 | private: |
52 | QList<Register> m_numbered; |
53 | std::map<QChar, Register> m_registers; |
54 | QChar m_default; |
55 | }; |
56 | |
57 | } |
58 | |
59 | #endif // KATEVI_REGISTERS_H |
60 | |