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

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_BINARY8_HPP
0010 #define KASTEN_BINARY8_HPP
0011 
0012 // Qt
0013 #include <QMetaType>
0014 #include <QString>
0015 
0016 struct Binary8
0017 {
0018 public:
0019     Binary8(quint8 v);
0020     Binary8(const Binary8&) = default;
0021     Binary8();
0022 
0023     ~Binary8() = default;
0024 
0025     Binary8& operator=(const Binary8&) = default;
0026 
0027 public:
0028     QString toString() const;
0029 
0030 public:
0031     quint8 value = 0;
0032 };
0033 
0034 inline Binary8::Binary8() = default;
0035 inline Binary8::Binary8(quint8 v) : value(v) {}
0036 
0037 inline QString Binary8::toString() const
0038 {
0039     return QStringLiteral("%1").arg(value, 8, 2, QChar::fromLatin1('0'));
0040 }
0041 
0042 Q_DECLARE_METATYPE(Binary8)
0043 
0044 #endif