damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

reflection_verifier.h (14766B)


      1 #ifndef REFLECTION_VERIFIER_H
      2 #define REFLECTION_VERIFIER_H
      3 
      4 /* Generated by flatcc 0.6.1 FlatBuffers schema compiler for C by dvide.com */
      5 
      6 #ifndef REFLECTION_READER_H
      7 #include "reflection_reader.h"
      8 #endif
      9 #include "flatcc/flatcc_verifier.h"
     10 #include "flatcc/flatcc_prologue.h"
     11 
     12 static int reflection_Type_verify_table(flatcc_table_verifier_descriptor_t *td);
     13 static int reflection_KeyValue_verify_table(flatcc_table_verifier_descriptor_t *td);
     14 static int reflection_EnumVal_verify_table(flatcc_table_verifier_descriptor_t *td);
     15 static int reflection_Enum_verify_table(flatcc_table_verifier_descriptor_t *td);
     16 static int reflection_Field_verify_table(flatcc_table_verifier_descriptor_t *td);
     17 static int reflection_Object_verify_table(flatcc_table_verifier_descriptor_t *td);
     18 static int reflection_RPCCall_verify_table(flatcc_table_verifier_descriptor_t *td);
     19 static int reflection_Service_verify_table(flatcc_table_verifier_descriptor_t *td);
     20 static int reflection_Schema_verify_table(flatcc_table_verifier_descriptor_t *td);
     21 
     22 static int reflection_Type_verify_table(flatcc_table_verifier_descriptor_t *td)
     23 {
     24     int ret;
     25     if ((ret = flatcc_verify_field(td, 0, 1, 1) /* base_type */)) return ret;
     26     if ((ret = flatcc_verify_field(td, 1, 1, 1) /* element */)) return ret;
     27     if ((ret = flatcc_verify_field(td, 2, 4, 4) /* index */)) return ret;
     28     if ((ret = flatcc_verify_field(td, 3, 2, 2) /* fixed_length */)) return ret;
     29     return flatcc_verify_ok;
     30 }
     31 
     32 static inline int reflection_Type_verify_as_root(const void *buf, size_t bufsiz)
     33 {
     34     return flatcc_verify_table_as_root(buf, bufsiz, reflection_Type_identifier, &reflection_Type_verify_table);
     35 }
     36 
     37 static inline int reflection_Type_verify_as_typed_root(const void *buf, size_t bufsiz)
     38 {
     39     return flatcc_verify_table_as_root(buf, bufsiz, reflection_Type_type_identifier, &reflection_Type_verify_table);
     40 }
     41 
     42 static inline int reflection_Type_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
     43 {
     44     return flatcc_verify_table_as_root(buf, bufsiz, fid, &reflection_Type_verify_table);
     45 }
     46 
     47 static inline int reflection_Type_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
     48 {
     49     return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &reflection_Type_verify_table);
     50 }
     51 
     52 static int reflection_KeyValue_verify_table(flatcc_table_verifier_descriptor_t *td)
     53 {
     54     int ret;
     55     if ((ret = flatcc_verify_string_field(td, 0, 1) /* key */)) return ret;
     56     if ((ret = flatcc_verify_string_field(td, 1, 0) /* value */)) return ret;
     57     return flatcc_verify_ok;
     58 }
     59 
     60 static inline int reflection_KeyValue_verify_as_root(const void *buf, size_t bufsiz)
     61 {
     62     return flatcc_verify_table_as_root(buf, bufsiz, reflection_KeyValue_identifier, &reflection_KeyValue_verify_table);
     63 }
     64 
     65 static inline int reflection_KeyValue_verify_as_typed_root(const void *buf, size_t bufsiz)
     66 {
     67     return flatcc_verify_table_as_root(buf, bufsiz, reflection_KeyValue_type_identifier, &reflection_KeyValue_verify_table);
     68 }
     69 
     70 static inline int reflection_KeyValue_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
     71 {
     72     return flatcc_verify_table_as_root(buf, bufsiz, fid, &reflection_KeyValue_verify_table);
     73 }
     74 
     75 static inline int reflection_KeyValue_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
     76 {
     77     return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &reflection_KeyValue_verify_table);
     78 }
     79 
     80 static int reflection_EnumVal_verify_table(flatcc_table_verifier_descriptor_t *td)
     81 {
     82     int ret;
     83     if ((ret = flatcc_verify_string_field(td, 0, 1) /* name */)) return ret;
     84     if ((ret = flatcc_verify_field(td, 1, 8, 8) /* value */)) return ret;
     85     if ((ret = flatcc_verify_table_field(td, 2, 0, &reflection_Object_verify_table) /* object */)) return ret;
     86     if ((ret = flatcc_verify_table_field(td, 3, 0, &reflection_Type_verify_table) /* union_type */)) return ret;
     87     if ((ret = flatcc_verify_string_vector_field(td, 4, 0) /* documentation */)) return ret;
     88     return flatcc_verify_ok;
     89 }
     90 
     91 static inline int reflection_EnumVal_verify_as_root(const void *buf, size_t bufsiz)
     92 {
     93     return flatcc_verify_table_as_root(buf, bufsiz, reflection_EnumVal_identifier, &reflection_EnumVal_verify_table);
     94 }
     95 
     96 static inline int reflection_EnumVal_verify_as_typed_root(const void *buf, size_t bufsiz)
     97 {
     98     return flatcc_verify_table_as_root(buf, bufsiz, reflection_EnumVal_type_identifier, &reflection_EnumVal_verify_table);
     99 }
    100 
    101 static inline int reflection_EnumVal_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
    102 {
    103     return flatcc_verify_table_as_root(buf, bufsiz, fid, &reflection_EnumVal_verify_table);
    104 }
    105 
    106 static inline int reflection_EnumVal_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
    107 {
    108     return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &reflection_EnumVal_verify_table);
    109 }
    110 
    111 static int reflection_Enum_verify_table(flatcc_table_verifier_descriptor_t *td)
    112 {
    113     int ret;
    114     if ((ret = flatcc_verify_string_field(td, 0, 1) /* name */)) return ret;
    115     if ((ret = flatcc_verify_table_vector_field(td, 1, 1, &reflection_EnumVal_verify_table) /* values */)) return ret;
    116     if ((ret = flatcc_verify_field(td, 2, 1, 1) /* is_union */)) return ret;
    117     if ((ret = flatcc_verify_table_field(td, 3, 1, &reflection_Type_verify_table) /* underlying_type */)) return ret;
    118     if ((ret = flatcc_verify_table_vector_field(td, 4, 0, &reflection_KeyValue_verify_table) /* attributes */)) return ret;
    119     if ((ret = flatcc_verify_string_vector_field(td, 5, 0) /* documentation */)) return ret;
    120     return flatcc_verify_ok;
    121 }
    122 
    123 static inline int reflection_Enum_verify_as_root(const void *buf, size_t bufsiz)
    124 {
    125     return flatcc_verify_table_as_root(buf, bufsiz, reflection_Enum_identifier, &reflection_Enum_verify_table);
    126 }
    127 
    128 static inline int reflection_Enum_verify_as_typed_root(const void *buf, size_t bufsiz)
    129 {
    130     return flatcc_verify_table_as_root(buf, bufsiz, reflection_Enum_type_identifier, &reflection_Enum_verify_table);
    131 }
    132 
    133 static inline int reflection_Enum_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
    134 {
    135     return flatcc_verify_table_as_root(buf, bufsiz, fid, &reflection_Enum_verify_table);
    136 }
    137 
    138 static inline int reflection_Enum_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
    139 {
    140     return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &reflection_Enum_verify_table);
    141 }
    142 
    143 static int reflection_Field_verify_table(flatcc_table_verifier_descriptor_t *td)
    144 {
    145     int ret;
    146     if ((ret = flatcc_verify_string_field(td, 0, 1) /* name */)) return ret;
    147     if ((ret = flatcc_verify_table_field(td, 1, 1, &reflection_Type_verify_table) /* type */)) return ret;
    148     if ((ret = flatcc_verify_field(td, 2, 2, 2) /* id */)) return ret;
    149     if ((ret = flatcc_verify_field(td, 3, 2, 2) /* offset */)) return ret;
    150     if ((ret = flatcc_verify_field(td, 4, 8, 8) /* default_integer */)) return ret;
    151     if ((ret = flatcc_verify_field(td, 5, 8, 8) /* default_real */)) return ret;
    152     if ((ret = flatcc_verify_field(td, 6, 1, 1) /* deprecated */)) return ret;
    153     if ((ret = flatcc_verify_field(td, 7, 1, 1) /* required */)) return ret;
    154     if ((ret = flatcc_verify_field(td, 8, 1, 1) /* key */)) return ret;
    155     if ((ret = flatcc_verify_table_vector_field(td, 9, 0, &reflection_KeyValue_verify_table) /* attributes */)) return ret;
    156     if ((ret = flatcc_verify_string_vector_field(td, 10, 0) /* documentation */)) return ret;
    157     if ((ret = flatcc_verify_field(td, 11, 1, 1) /* optional */)) return ret;
    158     return flatcc_verify_ok;
    159 }
    160 
    161 static inline int reflection_Field_verify_as_root(const void *buf, size_t bufsiz)
    162 {
    163     return flatcc_verify_table_as_root(buf, bufsiz, reflection_Field_identifier, &reflection_Field_verify_table);
    164 }
    165 
    166 static inline int reflection_Field_verify_as_typed_root(const void *buf, size_t bufsiz)
    167 {
    168     return flatcc_verify_table_as_root(buf, bufsiz, reflection_Field_type_identifier, &reflection_Field_verify_table);
    169 }
    170 
    171 static inline int reflection_Field_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
    172 {
    173     return flatcc_verify_table_as_root(buf, bufsiz, fid, &reflection_Field_verify_table);
    174 }
    175 
    176 static inline int reflection_Field_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
    177 {
    178     return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &reflection_Field_verify_table);
    179 }
    180 
    181 static int reflection_Object_verify_table(flatcc_table_verifier_descriptor_t *td)
    182 {
    183     int ret;
    184     if ((ret = flatcc_verify_string_field(td, 0, 1) /* name */)) return ret;
    185     if ((ret = flatcc_verify_table_vector_field(td, 1, 1, &reflection_Field_verify_table) /* fields */)) return ret;
    186     if ((ret = flatcc_verify_field(td, 2, 1, 1) /* is_struct */)) return ret;
    187     if ((ret = flatcc_verify_field(td, 3, 4, 4) /* minalign */)) return ret;
    188     if ((ret = flatcc_verify_field(td, 4, 4, 4) /* bytesize */)) return ret;
    189     if ((ret = flatcc_verify_table_vector_field(td, 5, 0, &reflection_KeyValue_verify_table) /* attributes */)) return ret;
    190     if ((ret = flatcc_verify_string_vector_field(td, 6, 0) /* documentation */)) return ret;
    191     return flatcc_verify_ok;
    192 }
    193 
    194 static inline int reflection_Object_verify_as_root(const void *buf, size_t bufsiz)
    195 {
    196     return flatcc_verify_table_as_root(buf, bufsiz, reflection_Object_identifier, &reflection_Object_verify_table);
    197 }
    198 
    199 static inline int reflection_Object_verify_as_typed_root(const void *buf, size_t bufsiz)
    200 {
    201     return flatcc_verify_table_as_root(buf, bufsiz, reflection_Object_type_identifier, &reflection_Object_verify_table);
    202 }
    203 
    204 static inline int reflection_Object_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
    205 {
    206     return flatcc_verify_table_as_root(buf, bufsiz, fid, &reflection_Object_verify_table);
    207 }
    208 
    209 static inline int reflection_Object_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
    210 {
    211     return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &reflection_Object_verify_table);
    212 }
    213 
    214 static int reflection_RPCCall_verify_table(flatcc_table_verifier_descriptor_t *td)
    215 {
    216     int ret;
    217     if ((ret = flatcc_verify_string_field(td, 0, 1) /* name */)) return ret;
    218     if ((ret = flatcc_verify_table_field(td, 1, 1, &reflection_Object_verify_table) /* request */)) return ret;
    219     if ((ret = flatcc_verify_table_field(td, 2, 1, &reflection_Object_verify_table) /* response */)) return ret;
    220     if ((ret = flatcc_verify_table_vector_field(td, 3, 0, &reflection_KeyValue_verify_table) /* attributes */)) return ret;
    221     if ((ret = flatcc_verify_string_vector_field(td, 4, 0) /* documentation */)) return ret;
    222     return flatcc_verify_ok;
    223 }
    224 
    225 static inline int reflection_RPCCall_verify_as_root(const void *buf, size_t bufsiz)
    226 {
    227     return flatcc_verify_table_as_root(buf, bufsiz, reflection_RPCCall_identifier, &reflection_RPCCall_verify_table);
    228 }
    229 
    230 static inline int reflection_RPCCall_verify_as_typed_root(const void *buf, size_t bufsiz)
    231 {
    232     return flatcc_verify_table_as_root(buf, bufsiz, reflection_RPCCall_type_identifier, &reflection_RPCCall_verify_table);
    233 }
    234 
    235 static inline int reflection_RPCCall_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
    236 {
    237     return flatcc_verify_table_as_root(buf, bufsiz, fid, &reflection_RPCCall_verify_table);
    238 }
    239 
    240 static inline int reflection_RPCCall_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
    241 {
    242     return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &reflection_RPCCall_verify_table);
    243 }
    244 
    245 static int reflection_Service_verify_table(flatcc_table_verifier_descriptor_t *td)
    246 {
    247     int ret;
    248     if ((ret = flatcc_verify_string_field(td, 0, 1) /* name */)) return ret;
    249     if ((ret = flatcc_verify_table_vector_field(td, 1, 0, &reflection_RPCCall_verify_table) /* calls */)) return ret;
    250     if ((ret = flatcc_verify_table_vector_field(td, 2, 0, &reflection_KeyValue_verify_table) /* attributes */)) return ret;
    251     if ((ret = flatcc_verify_string_vector_field(td, 3, 0) /* documentation */)) return ret;
    252     return flatcc_verify_ok;
    253 }
    254 
    255 static inline int reflection_Service_verify_as_root(const void *buf, size_t bufsiz)
    256 {
    257     return flatcc_verify_table_as_root(buf, bufsiz, reflection_Service_identifier, &reflection_Service_verify_table);
    258 }
    259 
    260 static inline int reflection_Service_verify_as_typed_root(const void *buf, size_t bufsiz)
    261 {
    262     return flatcc_verify_table_as_root(buf, bufsiz, reflection_Service_type_identifier, &reflection_Service_verify_table);
    263 }
    264 
    265 static inline int reflection_Service_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
    266 {
    267     return flatcc_verify_table_as_root(buf, bufsiz, fid, &reflection_Service_verify_table);
    268 }
    269 
    270 static inline int reflection_Service_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
    271 {
    272     return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &reflection_Service_verify_table);
    273 }
    274 
    275 static int reflection_Schema_verify_table(flatcc_table_verifier_descriptor_t *td)
    276 {
    277     int ret;
    278     if ((ret = flatcc_verify_table_vector_field(td, 0, 1, &reflection_Object_verify_table) /* objects */)) return ret;
    279     if ((ret = flatcc_verify_table_vector_field(td, 1, 1, &reflection_Enum_verify_table) /* enums */)) return ret;
    280     if ((ret = flatcc_verify_string_field(td, 2, 0) /* file_ident */)) return ret;
    281     if ((ret = flatcc_verify_string_field(td, 3, 0) /* file_ext */)) return ret;
    282     if ((ret = flatcc_verify_table_field(td, 4, 0, &reflection_Object_verify_table) /* root_table */)) return ret;
    283     if ((ret = flatcc_verify_table_vector_field(td, 5, 0, &reflection_Service_verify_table) /* services */)) return ret;
    284     return flatcc_verify_ok;
    285 }
    286 
    287 static inline int reflection_Schema_verify_as_root(const void *buf, size_t bufsiz)
    288 {
    289     return flatcc_verify_table_as_root(buf, bufsiz, reflection_Schema_identifier, &reflection_Schema_verify_table);
    290 }
    291 
    292 static inline int reflection_Schema_verify_as_typed_root(const void *buf, size_t bufsiz)
    293 {
    294     return flatcc_verify_table_as_root(buf, bufsiz, reflection_Schema_type_identifier, &reflection_Schema_verify_table);
    295 }
    296 
    297 static inline int reflection_Schema_verify_as_root_with_identifier(const void *buf, size_t bufsiz, const char *fid)
    298 {
    299     return flatcc_verify_table_as_root(buf, bufsiz, fid, &reflection_Schema_verify_table);
    300 }
    301 
    302 static inline int reflection_Schema_verify_as_root_with_type_hash(const void *buf, size_t bufsiz, flatbuffers_thash_t thash)
    303 {
    304     return flatcc_verify_table_as_typed_root(buf, bufsiz, thash, &reflection_Schema_verify_table);
    305 }
    306 
    307 #include "flatcc/flatcc_epilogue.h"
    308 #endif /* REFLECTION_VERIFIER_H */