File indexing completed on 2024-04-21 03:58:08
0001 /* 0002 SPDX-FileCopyrightText: KDE Developers 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KATEVI_REGISTERS_H 0008 #define KATEVI_REGISTERS_H 0009 0010 #include "definitions.h" 0011 0012 #include <QChar> 0013 #include <QList> 0014 #include <QString> 0015 #include <map> 0016 0017 class KConfigGroup; 0018 0019 namespace KateVi 0020 { 0021 const QChar BlackHoleRegister = QLatin1Char('_'); 0022 const QChar SmallDeleteRegister = QLatin1Char('-'); 0023 const QChar ZeroRegister = QLatin1Char('0'); 0024 const QChar PrependNumberedRegister = QLatin1Char('!'); 0025 const QChar FirstNumberedRegister = QLatin1Char('1'); 0026 const QChar LastNumberedRegister = QLatin1Char('9'); 0027 const QChar SystemSelectionRegister = QLatin1Char('*'); 0028 const QChar SystemClipboardRegister = QLatin1Char('+'); 0029 const QChar UnnamedRegister = QLatin1Char('"'); 0030 const QChar InsertStoppedRegister = QLatin1Char('^'); 0031 0032 class Registers 0033 { 0034 public: 0035 void writeConfig(KConfigGroup &config) const; 0036 void readConfig(const KConfigGroup &config); 0037 0038 void setInsertStopped(const QString &text); 0039 0040 void set(const QChar ®, const QString &text, OperationMode flag = CharWise); 0041 QString getContent(const QChar ®) const; 0042 OperationMode getFlag(const QChar ®) const; 0043 0044 private: 0045 typedef QPair<QString, OperationMode> Register; 0046 0047 private: 0048 void setNumberedRegister(const QChar ®, const QString &text, OperationMode flag = CharWise); 0049 Register getRegister(const QChar ®) const; 0050 0051 private: 0052 QList<Register> m_numbered; 0053 std::map<QChar, Register> m_registers; 0054 QChar m_default; 0055 }; 0056 0057 } 0058 0059 #endif // KATEVI_REGISTERS_H