File indexing completed on 2024-04-21 16:33:51

0001 /*
0002     This file is part of the Okteta Core library, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2004 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_CHARCODEC_HPP
0010 #define OKTETA_CHARCODEC_HPP
0011 
0012 // lib
0013 #include "oktetacore_export.hpp"
0014 #include "oktetacore.hpp"
0015 #include "byte.hpp"
0016 
0017 class QStringList;
0018 class QChar;
0019 
0020 namespace Okteta {
0021 
0022 class Character;
0023 
0024 class OKTETACORE_EXPORT CharCodec
0025 {
0026 public:
0027     virtual ~CharCodec();
0028 
0029 public:
0030     /** */
0031     static CharCodec* createCodec(CharCoding charCoding);
0032     /** */
0033     static CharCodec* createCodec(const QString& name);
0034 
0035     static const QStringList& codecNames();
0036 
0037 public: // API to be implemented
0038     virtual Character decode(Byte byte) const = 0;
0039     virtual bool encode(Byte* byte, const QChar& _char) const = 0;
0040     virtual bool canEncode(const QChar& _char) const = 0;
0041     virtual const QString& name() const = 0;
0042 };
0043 
0044 inline CharCodec::~CharCodec() = default;
0045 
0046 }
0047 
0048 #endif