diff options
Diffstat (limited to 'examples/monster_verifier.h')
-rw-r--r-- | examples/monster_verifier.h | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/examples/monster_verifier.h b/examples/monster_verifier.h new file mode 100644 index 0000000..f1b49a4 --- /dev/null +++ b/examples/monster_verifier.h @@ -0,0 +1,106 @@ +#ifndef MONSTER_VERIFIER_H +#define MONSTER_VERIFIER_H + +/* Generated by flatcc 0.6.2 FlatBuffers schema compiler for C by dvide.com */ + +#ifndef MONSTER_READER_H +#include "monster_reader.h" +#endif +#include "flatcc/flatcc_verifier.h" +#include "flatcc/flatcc_prologue.h" + +static int MyGame_Sample_Monster_verify_table(flatcc_table_verifier_descriptor_t *td); +static int MyGame_Sample_Weapon_verify_table(flatcc_table_verifier_descriptor_t *td); + +static int MyGame_Sample_Equipment_union_verifier(flatcc_union_verifier_descriptor_t *ud) +{ + switch (ud->type) { + case 1: return flatcc_verify_union_table(ud, MyGame_Sample_Weapon_verify_table); /* Weapon */ + default: return flatcc_verify_ok; + } +} + +static inline int MyGame_Sample_Vec3_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_root(buf, bufsiz, MyGame_Sample_Vec3_identifier, 12, 4); +} + +static inline int MyGame_Sample_Vec3_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_struct_as_typed_root(buf, bufsiz, MyGame_Sample_Vec3_type_hash, 12, 4); +} + +static inline int MyGame_Sample_Vec3_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_struct_as_typed_root(buf, bufsiz, thash, 12, 4); +} + +static inline int MyGame_Sample_Vec3_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_struct_as_root(buf, bufsiz, fid, 12, 4); +} + +static int MyGame_Sample_Monster_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_field(td, 0, 12, 4) /* pos */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 2, 2) /* mana */)) return ret; + if ((ret = flatcc_verify_field(td, 2, 2, 2) /* hp */)) return ret; + if ((ret = flatcc_verify_string_field(td, 3, 0) /* name */)) return ret; + if ((ret = flatcc_verify_vector_field(td, 5, 0, 1, 1, INT64_C(4294967295)) /* inventory */)) return ret; + if ((ret = flatcc_verify_field(td, 6, 1, 1) /* color */)) return ret; + if ((ret = flatcc_verify_table_vector_field(td, 7, 0, &MyGame_Sample_Weapon_verify_table) /* weapons */)) return ret; + if ((ret = flatcc_verify_union_field(td, 9, 0, &MyGame_Sample_Equipment_union_verifier) /* equipped */)) return ret; + return flatcc_verify_ok; +} + +static inline int MyGame_Sample_Monster_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, MyGame_Sample_Monster_identifier, &MyGame_Sample_Monster_verify_table); +} + +static inline int MyGame_Sample_Monster_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, MyGame_Sample_Monster_type_identifier, &MyGame_Sample_Monster_verify_table); +} + +static inline int MyGame_Sample_Monster_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &MyGame_Sample_Monster_verify_table); +} + +static inline int MyGame_Sample_Monster_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &MyGame_Sample_Monster_verify_table); +} + +static int MyGame_Sample_Weapon_verify_table(flatcc_table_verifier_descriptor_t *td) +{ + int ret; + if ((ret = flatcc_verify_string_field(td, 0, 0) /* name */)) return ret; + if ((ret = flatcc_verify_field(td, 1, 2, 2) /* damage */)) return ret; + return flatcc_verify_ok; +} + +static inline int MyGame_Sample_Weapon_verify_as_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, MyGame_Sample_Weapon_identifier, &MyGame_Sample_Weapon_verify_table); +} + +static inline int MyGame_Sample_Weapon_verify_as_typed_root(const void *buf, size_t bufsiz) +{ + return flatcc_verify_table_as_root(buf, bufsiz, MyGame_Sample_Weapon_type_identifier, &MyGame_Sample_Weapon_verify_table); +} + +static inline int MyGame_Sample_Weapon_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid) +{ + return flatcc_verify_table_as_root(buf, bufsiz, fid, &MyGame_Sample_Weapon_verify_table); +} + +static inline int MyGame_Sample_Weapon_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash) +{ + return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &MyGame_Sample_Weapon_verify_table); +} + +#include "flatcc/flatcc_epilogue.h" +#endif /* MONSTER_VERIFIER_H */ |