blob: 8a9747f287e5643a6e550789e827adc9145baf12 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#pragma once
#include <basis/seadTypes.h>
#include "KingSystem/Utils/Byaml/Byaml.h"
#include "KingSystem/Utils/Byaml/ByamlHashIter.h"
namespace al {
struct ByamlData {
ByamlData();
explicit ByamlData(const ByamlHashPair* pair) : ByamlData{} { set(pair); }
template <typename T = u32>
T getValue() const {
return *reinterpret_cast<const T*>(&mValue);
}
ByamlType getType() const { return mType; }
void set(const ByamlHashPair* pair) {
mType = pair->getType();
mValue = pair->getValue();
}
template <typename T = u32>
void set(const ByamlType& type, const T& value) {
mType = type;
mValue = *reinterpret_cast<const u32*>(&value);
}
void setType(const ByamlType& type) { mType = type; }
template <typename T = u32>
void setValue(const T& value) {
mValue = *reinterpret_cast<const u32*>(&value);
}
void clear() {
mValue = 0;
mType = ByamlType::Invalid;
}
private:
u32 mValue = 0;
sead::SizedEnum<ByamlType, u8> mType = ByamlType::Invalid;
};
} // namespace al
|