File indexing completed on 2024-04-14 05:45:45

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 QString;
0019 class QChar;
0020 
0021 namespace Okteta {
0022 
0023 class Character;
0024 
0025 class OKTETACORE_EXPORT CharCodec
0026 {
0027 public:
0028     virtual ~CharCodec();
0029 
0030 public:
0031     /** */
0032     static CharCodec* createCodec(CharCoding charCoding);
0033     /** */
0034     static CharCodec* createCodec(const QString& name);
0035 
0036     static QStringList codecNames();
0037 
0038 public: // API to be implemented
0039     virtual Character decode(Byte byte) const = 0;
0040     virtual bool encode(Byte* byte, QChar _char) const = 0;
0041     virtual bool canEncode(QChar _char) const = 0;
0042     virtual QString name() const = 0;
0043 };
0044 
0045 inline CharCodec::~CharCodec() = default;
0046 
0047 }
0048 
0049 #endif