File indexing completed on 2024-04-28 05:50:42
0001 /* 0002 This source file is part of Konsole, a terminal emulator. 0003 0004 SPDX-FileCopyrightText: 2007-2008 Robert Knight <robertknight@gmail.com> 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef KEYBOARDTRANSLATORWRITER_H 0010 #define KEYBOARDTRANSLATORWRITER_H 0011 0012 #include "KeyboardTranslator.h" 0013 0014 namespace Konsole 0015 { 0016 /** Writes a keyboard translation to disk. */ 0017 class KeyboardTranslatorWriter 0018 { 0019 public: 0020 /** 0021 * Constructs a new writer which saves data into @p destination. 0022 * The caller is responsible for closing the device when writing is complete. 0023 */ 0024 explicit KeyboardTranslatorWriter(QIODevice *destination); 0025 ~KeyboardTranslatorWriter(); 0026 0027 KeyboardTranslatorWriter(const KeyboardTranslatorWriter &) = delete; 0028 KeyboardTranslatorWriter &operator=(const KeyboardTranslatorWriter &) = delete; 0029 0030 /** 0031 * Writes the header for the keyboard translator. 0032 * @param description Description of the keyboard translator. 0033 */ 0034 void writeHeader(const QString &description); 0035 /** Writes a translator entry. */ 0036 void writeEntry(const KeyboardTranslator::Entry &entry); 0037 0038 private: 0039 QIODevice *_destination; 0040 QTextStream *_writer; 0041 }; 0042 } 0043 0044 #endif