File indexing completed on 2024-06-23 05:48:50

0001 /*
0002     This file is part of the Okteta Kasten module, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2009 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 KASTEN_CHAR8CODEC_HPP
0010 #define KASTEN_CHAR8CODEC_HPP
0011 
0012 // tool
0013 #include "../abstracttypecodec.hpp"
0014 
0015 namespace Okteta {
0016 class CharCodec;
0017 
0018 class Char8Codec : public AbstractTypeCodec
0019 {
0020 public:
0021     explicit Char8Codec(CharCodec* charCodec);
0022 
0023     ~Char8Codec() override;
0024 
0025 public: // AbstractTypeCodec API
0026     QVariant value(const PODData& data, int* byteCount) const override;
0027     QByteArray valueToBytes(const QVariant& value) const override;
0028 
0029     bool areEqual(const QVariant& value, QVariant& otherValue) const override;
0030 
0031 public:
0032     void setCharCodec(CharCodec* charCodec);
0033 
0034 private:
0035     CharCodec* mCharCodec;
0036     QChar mUndefinedChar;
0037 };
0038 
0039 inline void Char8Codec::setCharCodec(CharCodec* charCodec) { mCharCodec = charCodec; }
0040 
0041 }
0042 
0043 #endif