File indexing completed on 2024-05-05 17:57:59

0001 /*
0002     This file is part of the Okteta Core library, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2014 Friedrich W. H. Kossebau <kossebau@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef OKTETA_USASCIICHARCODEC_HPP
0010 #define OKTETA_USASCIICHARCODEC_HPP
0011 
0012 // lib
0013 #include <charcodec.hpp>
0014 
0015 namespace Okteta {
0016 
0017 //
0018 class USASCIICharCodec : public CharCodec
0019 {
0020 public:
0021     USASCIICharCodec(const USASCIICharCodec&) = delete;
0022     USASCIICharCodec& operator=(const USASCIICharCodec&) = delete;
0023 
0024 protected:
0025     USASCIICharCodec();
0026 
0027 public: // CharCodec API
0028     Character decode(Byte byte) const override;
0029     bool encode(Byte* byte, const QChar& _char) const override;
0030     bool canEncode(const QChar& _char) const override;
0031     const QString& name() const override;
0032 
0033 public:
0034     static USASCIICharCodec* create();
0035     static const QString& codecName();
0036 };
0037 
0038 inline USASCIICharCodec::USASCIICharCodec() = default;
0039 
0040 inline USASCIICharCodec* USASCIICharCodec::create() { return new USASCIICharCodec(); }
0041 
0042 }
0043 
0044 #endif