XX CMake Package
Loading...
Searching...
No Matches
XXByteFours.h
Go to the documentation of this file.
1#ifndef XXByteFoursH
2#define XXByteFoursH
3
4#include "XXCoreExportDef.h"
5
6#include <iostream>
7
8#include <cinttypes>
9#include <QDebug>
10
11namespace XX
12{
15
17 {
18 public:
19 enum FoursValue : uint8_t
20 {
21 O = 0,
22 I = 1,
23 Z = 2,
24 T = 3
25 };
26
27 public:
29 ByteFours(uint8_t byte = 0);
30
31 public:
32 FoursValue value(const FoursValue& index) const;
33 operator uint8_t() const;
34 QString toString() const;
35
36 private:
37 friend XXCORE_DECLSPEC std::ostream& operator<<(std::ostream& out, const ByteFours& bf);
38 friend XXCORE_DECLSPEC QDebug operator<<(QDebug stream, const ByteFours& bf);
39
40 private:
41 static const uint8_t mask[4];
42 FoursValue fours[4];
43 };
44
45 XXCORE_DECLSPEC std::ostream& operator<<(std::ostream& out, const ByteFours& bf);
46 XXCORE_DECLSPEC QDebug operator<<(QDebug stream, const ByteFours& bf);
47
48} // namespace XX
49
50#endif // NOT XXByteFoursH
#define XXCORE_DECLSPEC
Definition XXCoreExportDef.h:11
convert a byte into a base 4 representation
Definition XXByteFours.h:17
FoursValue
Definition XXByteFours.h:20
@ I
Definition XXByteFours.h:22
@ O
Definition XXByteFours.h:21
@ Z
Definition XXByteFours.h:23
@ T
Definition XXByteFours.h:24
friend QDebug operator<<(QDebug stream, const ByteFours &bf)
FoursValue value(const FoursValue &index) const
QString toString() const
ByteFours(FoursValue a, FoursValue b, FoursValue c, FoursValue d)
friend std::ostream & operator<<(std::ostream &out, const ByteFours &bf)
ByteFours(uint8_t byte=0)
Definition XXPopulatedAbstract.h:11
std::ostream & operator<<(std::ostream &out, const ByteFours &bf)