| 1 | #pragma once |
| 2 | |
| 3 | #include <gfx/seadColor.h> |
| 4 | #include <math/seadBoundBox.h> |
| 5 | #include <math/seadVector.h> |
| 6 | |
| 7 | #include "Library/Yaml/ByamlData.h" |
| 8 | #include "Library/Yaml/ByamlIter.h" |
| 9 | |
| 10 | namespace sead { |
| 11 | class WriteStream; |
| 12 | } |
| 13 | |
| 14 | namespace al { |
| 15 | bool tryGetByamlU8(u8*, const ByamlIter&, const char*); |
| 16 | bool tryGetByamlU16(u16*, const ByamlIter&, const char*); |
| 17 | bool tryGetByamlS16(s16*, const ByamlIter&, const char*); |
| 18 | bool tryGetByamlS32(s32*, const ByamlIter&, const char*); |
| 19 | bool tryGetByamlU32(u32*, const ByamlIter&, const char*); |
| 20 | bool tryGetByamlS64(s64*, const ByamlIter&, const char*); |
| 21 | bool tryGetByamlU64(u64*, const ByamlIter&, const char*); |
| 22 | bool tryGetByamlF32(f32*, const ByamlIter&, const char*); |
| 23 | bool tryGetByamlV2f(sead::Vector2f*, const ByamlIter&); |
| 24 | bool tryGetByamlV3f(sead::Vector3f*, const ByamlIter&); |
| 25 | bool tryGetByamlV4f(sead::Vector4f*, const ByamlIter&); |
| 26 | bool tryGetByamlScale(sead::Vector3f*, const ByamlIter&); |
| 27 | bool tryGetByamlV2s32(sead::Vector2i*, const ByamlIter&); |
| 28 | bool tryGetByamlV3s32(sead::Vector3i*, const ByamlIter&); |
| 29 | bool tryGetByamlBox3f(sead::BoundBox3f*, const ByamlIter&); |
| 30 | bool tryGetByamlV3f(sead::Vector3f*, const ByamlIter&, const char*); |
| 31 | bool tryGetByamlV2f(sead::Vector2f*, const ByamlIter&, const char*); |
| 32 | bool tryGetByamlV4f(sead::Vector4f*, const ByamlIter&, const char*); |
| 33 | bool tryGetByamlScale(sead::Vector3f*, const ByamlIter&, const char*); |
| 34 | bool tryGetByamlV2s32(sead::Vector2i*, const ByamlIter&, const char*); |
| 35 | bool tryGetByamlV3s32(sead::Vector3i*, const ByamlIter&, const char*); |
| 36 | bool tryGetByamlBox3f(sead::BoundBox3f*, const ByamlIter&, const char*); |
| 37 | bool tryGetByamlString(const char**, const ByamlIter&, const char*); |
| 38 | bool tryGetByamlColor(sead::Color4f*, const ByamlIter&); |
| 39 | bool tryGetByamlColor(sead::Color4f*, const ByamlIter&, const char*); |
| 40 | bool tryGetByamlBool(bool*, const ByamlIter&, const char*); |
| 41 | const char* tryGetByamlKeyStringOrNULL(const ByamlIter&, const char*); |
| 42 | s32 tryGetByamlKeyIntOrZero(const ByamlIter&, const char*); |
| 43 | u32 tryGetByamlKeyU32OrZero(const ByamlIter&, const char*); |
| 44 | f32 tryGetByamlKeyFloatOrZero(const ByamlIter&, const char*); |
| 45 | bool tryGetByamlKeyBoolOrFalse(const ByamlIter&, const char*); |
| 46 | bool tryGetByamlIterByKey(ByamlIter*, const ByamlIter&, const char*); |
| 47 | bool tryGetByamlKeyAndIntByIndex(const char**, s32*, const ByamlIter&, s32); |
| 48 | |
| 49 | const char* getByamlKeyString(const ByamlIter&, const char*); |
| 50 | s32 getByamlKeyInt(const ByamlIter&, const char*); |
| 51 | f32 getByamlKeyFloat(const ByamlIter&, const char*); |
| 52 | bool getByamlKeyBool(const ByamlIter&, const char*); |
| 53 | void getByamlIterByKey(ByamlIter*, const ByamlIter&, const char*); |
| 54 | void getByamlIterByIndex(ByamlIter*, const ByamlIter&, s32); |
| 55 | |
| 56 | template <ByamlDataType T> |
| 57 | bool isTypeByIndex(const ByamlIter& rIter, s32 index) { |
| 58 | ByamlData data; |
| 59 | if (rIter.getByamlDataByIndex(data: &data, index)) |
| 60 | return data.getType() == T; |
| 61 | return false; |
| 62 | } |
| 63 | |
| 64 | template <ByamlDataType T> |
| 65 | bool isTypeByKey(const ByamlIter& rIter, const char* key) { |
| 66 | ByamlData data; |
| 67 | if (rIter.getByamlDataByKey(data: &data, key)) |
| 68 | return data.getType() == T; |
| 69 | return false; |
| 70 | } |
| 71 | |
| 72 | bool isTypeBoolByIndex(const ByamlIter&, s32); |
| 73 | bool isTypeBoolByKey(const ByamlIter&, const char*); |
| 74 | bool isTypeIntByIndex(const ByamlIter&, s32); |
| 75 | bool isTypeIntByKey(const ByamlIter&, const char*); |
| 76 | bool isTypeFloatByIndex(const ByamlIter&, s32); |
| 77 | bool isTypeFloatByKey(const ByamlIter&, const char*); |
| 78 | bool isTypeStringByIndex(const ByamlIter&, s32); |
| 79 | bool isTypeStringByKey(const ByamlIter&, const char*); |
| 80 | bool isTypeArrayByIndex(const ByamlIter&, s32); |
| 81 | bool isTypeArrayByKey(const ByamlIter&, const char*); |
| 82 | bool isTypeHashByIndex(const ByamlIter&, s32); |
| 83 | bool isTypeHashByKey(const ByamlIter&, const char*); |
| 84 | |
| 85 | s32 getByamlIterDataNum(const ByamlIter&); |
| 86 | |
| 87 | struct PrintParams { |
| 88 | s32 depth; |
| 89 | u32 offset; |
| 90 | PrintParams* parent; |
| 91 | }; |
| 92 | |
| 93 | void printByamlIter(const u8*); |
| 94 | void printByamlIter(const ByamlIter&); |
| 95 | void printByamlIter_(const ByamlIter&, PrintParams*); |
| 96 | } // namespace al |
| 97 | |