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_CHARACTER_HPP
0010 #define OKTETA_CHARACTER_HPP
0011 
0012 // lib
0013 #include "oktetacore_export.hpp"
0014 // Qt
0015 #include <QChar>
0016 
0017 namespace Okteta {
0018 
0019 class OKTETACORE_EXPORT Character : public QChar
0020 {
0021 public:
0022     constexpr Character(QChar qchar);   // krazy:exclude=explicit
0023     constexpr Character(QChar qchar, bool isUndefined);
0024     Character(const Character&) = default;
0025 
0026     ~Character() = default;
0027 
0028     Character& operator=(const Character&) = default;
0029 
0030 public:
0031     constexpr bool isUndefined() const;
0032 
0033 private:
0034     // the byte is not defined
0035     bool mIsUndefined : 1;
0036 };
0037 
0038 
0039 inline constexpr Character::Character(QChar qchar)
0040     : QChar(qchar)
0041     , mIsUndefined(false)
0042 {}
0043 
0044 inline constexpr Character::Character(QChar qchar, bool isUndefined)
0045     : QChar(qchar)
0046     , mIsUndefined(isUndefined)
0047 {}
0048 
0049 inline constexpr bool Character::isUndefined() const { return mIsUndefined; }
0050 
0051 }
0052 
0053 #endif