| 1 | #pragma once |
| 2 | |
| 3 | #include "Library/Yaml/ByamlData.h" |
| 4 | #include "Library/Yaml/ByamlHeader.h" |
| 5 | |
| 6 | namespace al { |
| 7 | class ByamlIter { |
| 8 | public: |
| 9 | ByamlIter(); |
| 10 | ByamlIter(const u8* data); |
| 11 | ByamlIter(const u8* data, const u8* root_node); |
| 12 | |
| 13 | bool isValid() const; |
| 14 | bool isTypeHash() const; |
| 15 | bool isTypeArray() const; |
| 16 | bool isTypeContainer() const; |
| 17 | bool isExistKey(const char* key) const; |
| 18 | s32 getKeyIndex(const char* key) const; |
| 19 | bool isInvertOrder() const; |
| 20 | s32 getSize() const; |
| 21 | ByamlIter getIterByIndex(s32 index) const; |
| 22 | bool getByamlDataByIndex(ByamlData* data, s32 index) const; |
| 23 | ByamlIter getIterByKey(const char* key) const; |
| 24 | bool getByamlDataByKey(ByamlData* data, const char* key) const; |
| 25 | bool getByamlDataByKeyIndex(ByamlData* data, s32 index) const; |
| 26 | bool getByamlDataAndKeyName(ByamlData* data, const char** key, s32 index) const; |
| 27 | bool getKeyName(const char** key, s32 index) const; |
| 28 | bool tryGetIterByIndex(ByamlIter* iter, s32 index) const; |
| 29 | bool tryGetIterAndKeyNameByIndex(ByamlIter* iter, const char** key, s32 index) const; |
| 30 | bool tryGetIterByKey(ByamlIter* iter, const char* key) const; |
| 31 | bool tryGetStringByKey(const char** string, const char* key) const; |
| 32 | bool tryConvertString(const char** string, const ByamlData* data) const; |
| 33 | bool tryGetBinaryByKey(const u8** binary, s32* size, const char* key) const; |
| 34 | bool tryConvertBinary(const u8** binary, s32* size, const ByamlData* data) const; |
| 35 | bool tryGetBoolByKey(bool* val, const char* key) const; |
| 36 | bool tryConvertBool(bool* val, const ByamlData* data) const; |
| 37 | bool tryGetIntByKey(s32* val, const char* key) const; |
| 38 | bool tryConvertInt(s32* val, const ByamlData* data) const; |
| 39 | bool tryGetUIntByKey(u32* val, const char* key) const; |
| 40 | bool tryConvertUInt(u32* val, const ByamlData* data) const; |
| 41 | bool tryGetFloatByKey(f32* val, const char* key) const; |
| 42 | bool tryConvertFloat(f32* val, const ByamlData* data) const; |
| 43 | bool tryGetInt64ByKey(s64* val, const char* key) const; |
| 44 | bool tryConvertInt64(s64* val, const ByamlData* data) const; |
| 45 | bool tryGetUInt64ByKey(u64* val, const char* key) const; |
| 46 | bool tryConvertUInt64(u64* val, const ByamlData* data) const; |
| 47 | bool tryGetDoubleByKey(f64* val, const char* key) const; |
| 48 | bool tryConvertDouble(f64* val, const ByamlData* data) const; |
| 49 | bool tryGetStringByIndex(const char** string, s32 index) const; |
| 50 | bool tryGetBinaryByIndex(const u8** binary, s32* size, s32 index) const; |
| 51 | bool tryGetBoolByIndex(bool* val, s32 index) const; |
| 52 | bool tryGetIntByIndex(s32* val, s32 index) const; |
| 53 | bool tryGetUIntByIndex(u32* val, s32 index) const; |
| 54 | bool tryGetFloatByIndex(f32* val, s32 index) const; |
| 55 | bool tryGetInt64ByIndex(s64* val, s32 index) const; |
| 56 | bool tryGetUInt64ByIndex(u64* val, s32 index) const; |
| 57 | bool tryGetDoubleByIndex(f64* val, s32 index) const; |
| 58 | bool tryConvertIter(ByamlIter* iter, const ByamlData* data) const; |
| 59 | bool isEqualData(const ByamlIter& other) const; |
| 60 | |
| 61 | const ByamlHeader* () const { return mHeader; } |
| 62 | |
| 63 | private: |
| 64 | union { |
| 65 | const u8* mData; |
| 66 | const ByamlHeader* ; |
| 67 | }; |
| 68 | |
| 69 | const u8* mRootNode; |
| 70 | }; |
| 71 | } // namespace al |
| 72 | |