...

Text file src/github.com/google/flatbuffers/tests/cpp17/generated_cpp17/optional_scalars2_generated.h

Documentation: github.com/google/flatbuffers/tests/cpp17/generated_cpp17

     1// automatically generated by the FlatBuffers compiler, do not modify
     2
     3
     4#ifndef FLATBUFFERS_GENERATED_OPTIONALSCALARS2_OPTIONAL_SCALARS_H_
     5#define FLATBUFFERS_GENERATED_OPTIONALSCALARS2_OPTIONAL_SCALARS_H_
     6
     7#include "flatbuffers/flatbuffers.h"
     8
     9namespace optional_scalars {
    10
    11struct ScalarStuff;
    12struct ScalarStuffBuilder;
    13struct ScalarStuffT;
    14
    15inline const flatbuffers::TypeTable *ScalarStuffTypeTable();
    16
    17enum class OptionalByte : int8_t {
    18  None = 0,
    19  One = 1,
    20  Two = 2,
    21  MIN = None,
    22  MAX = Two
    23};
    24
    25inline const OptionalByte (&EnumValuesOptionalByte())[3] {
    26  static const OptionalByte values[] = {
    27    OptionalByte::None,
    28    OptionalByte::One,
    29    OptionalByte::Two
    30  };
    31  return values;
    32}
    33
    34inline const char * const *EnumNamesOptionalByte() {
    35  static const char * const names[4] = {
    36    "None",
    37    "One",
    38    "Two",
    39    nullptr
    40  };
    41  return names;
    42}
    43
    44inline const char *EnumNameOptionalByte(OptionalByte e) {
    45  if (flatbuffers::IsOutRange(e, OptionalByte::None, OptionalByte::Two)) return "";
    46  const size_t index = static_cast<size_t>(e);
    47  return EnumNamesOptionalByte()[index];
    48}
    49
    50struct ScalarStuffT : public flatbuffers::NativeTable {
    51  typedef ScalarStuff TableType;
    52  int8_t just_i8 = 0;
    53  flatbuffers::Optional<int8_t> maybe_i8 = flatbuffers::nullopt;
    54  int8_t default_i8 = 42;
    55  uint8_t just_u8 = 0;
    56  flatbuffers::Optional<uint8_t> maybe_u8 = flatbuffers::nullopt;
    57  uint8_t default_u8 = 42;
    58  int16_t just_i16 = 0;
    59  flatbuffers::Optional<int16_t> maybe_i16 = flatbuffers::nullopt;
    60  int16_t default_i16 = 42;
    61  uint16_t just_u16 = 0;
    62  flatbuffers::Optional<uint16_t> maybe_u16 = flatbuffers::nullopt;
    63  uint16_t default_u16 = 42;
    64  int32_t just_i32 = 0;
    65  flatbuffers::Optional<int32_t> maybe_i32 = flatbuffers::nullopt;
    66  int32_t default_i32 = 42;
    67  uint32_t just_u32 = 0;
    68  flatbuffers::Optional<uint32_t> maybe_u32 = flatbuffers::nullopt;
    69  uint32_t default_u32 = 42;
    70  int64_t just_i64 = 0;
    71  flatbuffers::Optional<int64_t> maybe_i64 = flatbuffers::nullopt;
    72  int64_t default_i64 = 42LL;
    73  uint64_t just_u64 = 0;
    74  flatbuffers::Optional<uint64_t> maybe_u64 = flatbuffers::nullopt;
    75  uint64_t default_u64 = 42ULL;
    76  float just_f32 = 0.0f;
    77  flatbuffers::Optional<float> maybe_f32 = flatbuffers::nullopt;
    78  float default_f32 = 42.0f;
    79  double just_f64 = 0.0;
    80  flatbuffers::Optional<double> maybe_f64 = flatbuffers::nullopt;
    81  double default_f64 = 42.0;
    82  bool just_bool = false;
    83  flatbuffers::Optional<bool> maybe_bool = flatbuffers::nullopt;
    84  bool default_bool = true;
    85  optional_scalars::OptionalByte just_enum = optional_scalars::OptionalByte::None;
    86  flatbuffers::Optional<optional_scalars::OptionalByte> maybe_enum = flatbuffers::nullopt;
    87  optional_scalars::OptionalByte default_enum = optional_scalars::OptionalByte::One;
    88};
    89
    90struct ScalarStuff FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
    91  typedef ScalarStuffT NativeTableType;
    92  typedef ScalarStuffBuilder Builder;
    93  struct Traits;
    94  static const flatbuffers::TypeTable *MiniReflectTypeTable() {
    95    return ScalarStuffTypeTable();
    96  }
    97  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
    98    VT_JUST_I8 = 4,
    99    VT_MAYBE_I8 = 6,
   100    VT_DEFAULT_I8 = 8,
   101    VT_JUST_U8 = 10,
   102    VT_MAYBE_U8 = 12,
   103    VT_DEFAULT_U8 = 14,
   104    VT_JUST_I16 = 16,
   105    VT_MAYBE_I16 = 18,
   106    VT_DEFAULT_I16 = 20,
   107    VT_JUST_U16 = 22,
   108    VT_MAYBE_U16 = 24,
   109    VT_DEFAULT_U16 = 26,
   110    VT_JUST_I32 = 28,
   111    VT_MAYBE_I32 = 30,
   112    VT_DEFAULT_I32 = 32,
   113    VT_JUST_U32 = 34,
   114    VT_MAYBE_U32 = 36,
   115    VT_DEFAULT_U32 = 38,
   116    VT_JUST_I64 = 40,
   117    VT_MAYBE_I64 = 42,
   118    VT_DEFAULT_I64 = 44,
   119    VT_JUST_U64 = 46,
   120    VT_MAYBE_U64 = 48,
   121    VT_DEFAULT_U64 = 50,
   122    VT_JUST_F32 = 52,
   123    VT_MAYBE_F32 = 54,
   124    VT_DEFAULT_F32 = 56,
   125    VT_JUST_F64 = 58,
   126    VT_MAYBE_F64 = 60,
   127    VT_DEFAULT_F64 = 62,
   128    VT_JUST_BOOL = 64,
   129    VT_MAYBE_BOOL = 66,
   130    VT_DEFAULT_BOOL = 68,
   131    VT_JUST_ENUM = 70,
   132    VT_MAYBE_ENUM = 72,
   133    VT_DEFAULT_ENUM = 74
   134  };
   135  int8_t just_i8() const {
   136    return GetField<int8_t>(VT_JUST_I8, 0);
   137  }
   138  bool mutate_just_i8(int8_t _just_i8) {
   139    return SetField<int8_t>(VT_JUST_I8, _just_i8, 0);
   140  }
   141  flatbuffers::Optional<int8_t> maybe_i8() const {
   142    return GetOptional<int8_t, int8_t>(VT_MAYBE_I8);
   143  }
   144  bool mutate_maybe_i8(int8_t _maybe_i8) {
   145    return SetField<int8_t>(VT_MAYBE_I8, _maybe_i8);
   146  }
   147  int8_t default_i8() const {
   148    return GetField<int8_t>(VT_DEFAULT_I8, 42);
   149  }
   150  bool mutate_default_i8(int8_t _default_i8) {
   151    return SetField<int8_t>(VT_DEFAULT_I8, _default_i8, 42);
   152  }
   153  uint8_t just_u8() const {
   154    return GetField<uint8_t>(VT_JUST_U8, 0);
   155  }
   156  bool mutate_just_u8(uint8_t _just_u8) {
   157    return SetField<uint8_t>(VT_JUST_U8, _just_u8, 0);
   158  }
   159  flatbuffers::Optional<uint8_t> maybe_u8() const {
   160    return GetOptional<uint8_t, uint8_t>(VT_MAYBE_U8);
   161  }
   162  bool mutate_maybe_u8(uint8_t _maybe_u8) {
   163    return SetField<uint8_t>(VT_MAYBE_U8, _maybe_u8);
   164  }
   165  uint8_t default_u8() const {
   166    return GetField<uint8_t>(VT_DEFAULT_U8, 42);
   167  }
   168  bool mutate_default_u8(uint8_t _default_u8) {
   169    return SetField<uint8_t>(VT_DEFAULT_U8, _default_u8, 42);
   170  }
   171  int16_t just_i16() const {
   172    return GetField<int16_t>(VT_JUST_I16, 0);
   173  }
   174  bool mutate_just_i16(int16_t _just_i16) {
   175    return SetField<int16_t>(VT_JUST_I16, _just_i16, 0);
   176  }
   177  flatbuffers::Optional<int16_t> maybe_i16() const {
   178    return GetOptional<int16_t, int16_t>(VT_MAYBE_I16);
   179  }
   180  bool mutate_maybe_i16(int16_t _maybe_i16) {
   181    return SetField<int16_t>(VT_MAYBE_I16, _maybe_i16);
   182  }
   183  int16_t default_i16() const {
   184    return GetField<int16_t>(VT_DEFAULT_I16, 42);
   185  }
   186  bool mutate_default_i16(int16_t _default_i16) {
   187    return SetField<int16_t>(VT_DEFAULT_I16, _default_i16, 42);
   188  }
   189  uint16_t just_u16() const {
   190    return GetField<uint16_t>(VT_JUST_U16, 0);
   191  }
   192  bool mutate_just_u16(uint16_t _just_u16) {
   193    return SetField<uint16_t>(VT_JUST_U16, _just_u16, 0);
   194  }
   195  flatbuffers::Optional<uint16_t> maybe_u16() const {
   196    return GetOptional<uint16_t, uint16_t>(VT_MAYBE_U16);
   197  }
   198  bool mutate_maybe_u16(uint16_t _maybe_u16) {
   199    return SetField<uint16_t>(VT_MAYBE_U16, _maybe_u16);
   200  }
   201  uint16_t default_u16() const {
   202    return GetField<uint16_t>(VT_DEFAULT_U16, 42);
   203  }
   204  bool mutate_default_u16(uint16_t _default_u16) {
   205    return SetField<uint16_t>(VT_DEFAULT_U16, _default_u16, 42);
   206  }
   207  int32_t just_i32() const {
   208    return GetField<int32_t>(VT_JUST_I32, 0);
   209  }
   210  bool mutate_just_i32(int32_t _just_i32) {
   211    return SetField<int32_t>(VT_JUST_I32, _just_i32, 0);
   212  }
   213  flatbuffers::Optional<int32_t> maybe_i32() const {
   214    return GetOptional<int32_t, int32_t>(VT_MAYBE_I32);
   215  }
   216  bool mutate_maybe_i32(int32_t _maybe_i32) {
   217    return SetField<int32_t>(VT_MAYBE_I32, _maybe_i32);
   218  }
   219  int32_t default_i32() const {
   220    return GetField<int32_t>(VT_DEFAULT_I32, 42);
   221  }
   222  bool mutate_default_i32(int32_t _default_i32) {
   223    return SetField<int32_t>(VT_DEFAULT_I32, _default_i32, 42);
   224  }
   225  uint32_t just_u32() const {
   226    return GetField<uint32_t>(VT_JUST_U32, 0);
   227  }
   228  bool mutate_just_u32(uint32_t _just_u32) {
   229    return SetField<uint32_t>(VT_JUST_U32, _just_u32, 0);
   230  }
   231  flatbuffers::Optional<uint32_t> maybe_u32() const {
   232    return GetOptional<uint32_t, uint32_t>(VT_MAYBE_U32);
   233  }
   234  bool mutate_maybe_u32(uint32_t _maybe_u32) {
   235    return SetField<uint32_t>(VT_MAYBE_U32, _maybe_u32);
   236  }
   237  uint32_t default_u32() const {
   238    return GetField<uint32_t>(VT_DEFAULT_U32, 42);
   239  }
   240  bool mutate_default_u32(uint32_t _default_u32) {
   241    return SetField<uint32_t>(VT_DEFAULT_U32, _default_u32, 42);
   242  }
   243  int64_t just_i64() const {
   244    return GetField<int64_t>(VT_JUST_I64, 0);
   245  }
   246  bool mutate_just_i64(int64_t _just_i64) {
   247    return SetField<int64_t>(VT_JUST_I64, _just_i64, 0);
   248  }
   249  flatbuffers::Optional<int64_t> maybe_i64() const {
   250    return GetOptional<int64_t, int64_t>(VT_MAYBE_I64);
   251  }
   252  bool mutate_maybe_i64(int64_t _maybe_i64) {
   253    return SetField<int64_t>(VT_MAYBE_I64, _maybe_i64);
   254  }
   255  int64_t default_i64() const {
   256    return GetField<int64_t>(VT_DEFAULT_I64, 42LL);
   257  }
   258  bool mutate_default_i64(int64_t _default_i64) {
   259    return SetField<int64_t>(VT_DEFAULT_I64, _default_i64, 42LL);
   260  }
   261  uint64_t just_u64() const {
   262    return GetField<uint64_t>(VT_JUST_U64, 0);
   263  }
   264  bool mutate_just_u64(uint64_t _just_u64) {
   265    return SetField<uint64_t>(VT_JUST_U64, _just_u64, 0);
   266  }
   267  flatbuffers::Optional<uint64_t> maybe_u64() const {
   268    return GetOptional<uint64_t, uint64_t>(VT_MAYBE_U64);
   269  }
   270  bool mutate_maybe_u64(uint64_t _maybe_u64) {
   271    return SetField<uint64_t>(VT_MAYBE_U64, _maybe_u64);
   272  }
   273  uint64_t default_u64() const {
   274    return GetField<uint64_t>(VT_DEFAULT_U64, 42ULL);
   275  }
   276  bool mutate_default_u64(uint64_t _default_u64) {
   277    return SetField<uint64_t>(VT_DEFAULT_U64, _default_u64, 42ULL);
   278  }
   279  float just_f32() const {
   280    return GetField<float>(VT_JUST_F32, 0.0f);
   281  }
   282  bool mutate_just_f32(float _just_f32) {
   283    return SetField<float>(VT_JUST_F32, _just_f32, 0.0f);
   284  }
   285  flatbuffers::Optional<float> maybe_f32() const {
   286    return GetOptional<float, float>(VT_MAYBE_F32);
   287  }
   288  bool mutate_maybe_f32(float _maybe_f32) {
   289    return SetField<float>(VT_MAYBE_F32, _maybe_f32);
   290  }
   291  float default_f32() const {
   292    return GetField<float>(VT_DEFAULT_F32, 42.0f);
   293  }
   294  bool mutate_default_f32(float _default_f32) {
   295    return SetField<float>(VT_DEFAULT_F32, _default_f32, 42.0f);
   296  }
   297  double just_f64() const {
   298    return GetField<double>(VT_JUST_F64, 0.0);
   299  }
   300  bool mutate_just_f64(double _just_f64) {
   301    return SetField<double>(VT_JUST_F64, _just_f64, 0.0);
   302  }
   303  flatbuffers::Optional<double> maybe_f64() const {
   304    return GetOptional<double, double>(VT_MAYBE_F64);
   305  }
   306  bool mutate_maybe_f64(double _maybe_f64) {
   307    return SetField<double>(VT_MAYBE_F64, _maybe_f64);
   308  }
   309  double default_f64() const {
   310    return GetField<double>(VT_DEFAULT_F64, 42.0);
   311  }
   312  bool mutate_default_f64(double _default_f64) {
   313    return SetField<double>(VT_DEFAULT_F64, _default_f64, 42.0);
   314  }
   315  bool just_bool() const {
   316    return GetField<uint8_t>(VT_JUST_BOOL, 0) != 0;
   317  }
   318  bool mutate_just_bool(bool _just_bool) {
   319    return SetField<uint8_t>(VT_JUST_BOOL, static_cast<uint8_t>(_just_bool), 0);
   320  }
   321  flatbuffers::Optional<bool> maybe_bool() const {
   322    return GetOptional<uint8_t, bool>(VT_MAYBE_BOOL);
   323  }
   324  bool mutate_maybe_bool(bool _maybe_bool) {
   325    return SetField<uint8_t>(VT_MAYBE_BOOL, static_cast<uint8_t>(_maybe_bool));
   326  }
   327  bool default_bool() const {
   328    return GetField<uint8_t>(VT_DEFAULT_BOOL, 1) != 0;
   329  }
   330  bool mutate_default_bool(bool _default_bool) {
   331    return SetField<uint8_t>(VT_DEFAULT_BOOL, static_cast<uint8_t>(_default_bool), 1);
   332  }
   333  optional_scalars::OptionalByte just_enum() const {
   334    return static_cast<optional_scalars::OptionalByte>(GetField<int8_t>(VT_JUST_ENUM, 0));
   335  }
   336  bool mutate_just_enum(optional_scalars::OptionalByte _just_enum) {
   337    return SetField<int8_t>(VT_JUST_ENUM, static_cast<int8_t>(_just_enum), 0);
   338  }
   339  flatbuffers::Optional<optional_scalars::OptionalByte> maybe_enum() const {
   340    return GetOptional<int8_t, optional_scalars::OptionalByte>(VT_MAYBE_ENUM);
   341  }
   342  bool mutate_maybe_enum(optional_scalars::OptionalByte _maybe_enum) {
   343    return SetField<int8_t>(VT_MAYBE_ENUM, static_cast<int8_t>(_maybe_enum));
   344  }
   345  optional_scalars::OptionalByte default_enum() const {
   346    return static_cast<optional_scalars::OptionalByte>(GetField<int8_t>(VT_DEFAULT_ENUM, 1));
   347  }
   348  bool mutate_default_enum(optional_scalars::OptionalByte _default_enum) {
   349    return SetField<int8_t>(VT_DEFAULT_ENUM, static_cast<int8_t>(_default_enum), 1);
   350  }
   351  bool Verify(flatbuffers::Verifier &verifier) const {
   352    return VerifyTableStart(verifier) &&
   353           VerifyField<int8_t>(verifier, VT_JUST_I8) &&
   354           VerifyField<int8_t>(verifier, VT_MAYBE_I8) &&
   355           VerifyField<int8_t>(verifier, VT_DEFAULT_I8) &&
   356           VerifyField<uint8_t>(verifier, VT_JUST_U8) &&
   357           VerifyField<uint8_t>(verifier, VT_MAYBE_U8) &&
   358           VerifyField<uint8_t>(verifier, VT_DEFAULT_U8) &&
   359           VerifyField<int16_t>(verifier, VT_JUST_I16) &&
   360           VerifyField<int16_t>(verifier, VT_MAYBE_I16) &&
   361           VerifyField<int16_t>(verifier, VT_DEFAULT_I16) &&
   362           VerifyField<uint16_t>(verifier, VT_JUST_U16) &&
   363           VerifyField<uint16_t>(verifier, VT_MAYBE_U16) &&
   364           VerifyField<uint16_t>(verifier, VT_DEFAULT_U16) &&
   365           VerifyField<int32_t>(verifier, VT_JUST_I32) &&
   366           VerifyField<int32_t>(verifier, VT_MAYBE_I32) &&
   367           VerifyField<int32_t>(verifier, VT_DEFAULT_I32) &&
   368           VerifyField<uint32_t>(verifier, VT_JUST_U32) &&
   369           VerifyField<uint32_t>(verifier, VT_MAYBE_U32) &&
   370           VerifyField<uint32_t>(verifier, VT_DEFAULT_U32) &&
   371           VerifyField<int64_t>(verifier, VT_JUST_I64) &&
   372           VerifyField<int64_t>(verifier, VT_MAYBE_I64) &&
   373           VerifyField<int64_t>(verifier, VT_DEFAULT_I64) &&
   374           VerifyField<uint64_t>(verifier, VT_JUST_U64) &&
   375           VerifyField<uint64_t>(verifier, VT_MAYBE_U64) &&
   376           VerifyField<uint64_t>(verifier, VT_DEFAULT_U64) &&
   377           VerifyField<float>(verifier, VT_JUST_F32) &&
   378           VerifyField<float>(verifier, VT_MAYBE_F32) &&
   379           VerifyField<float>(verifier, VT_DEFAULT_F32) &&
   380           VerifyField<double>(verifier, VT_JUST_F64) &&
   381           VerifyField<double>(verifier, VT_MAYBE_F64) &&
   382           VerifyField<double>(verifier, VT_DEFAULT_F64) &&
   383           VerifyField<uint8_t>(verifier, VT_JUST_BOOL) &&
   384           VerifyField<uint8_t>(verifier, VT_MAYBE_BOOL) &&
   385           VerifyField<uint8_t>(verifier, VT_DEFAULT_BOOL) &&
   386           VerifyField<int8_t>(verifier, VT_JUST_ENUM) &&
   387           VerifyField<int8_t>(verifier, VT_MAYBE_ENUM) &&
   388           VerifyField<int8_t>(verifier, VT_DEFAULT_ENUM) &&
   389           verifier.EndTable();
   390  }
   391  ScalarStuffT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
   392  void UnPackTo(ScalarStuffT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
   393  static flatbuffers::Offset<ScalarStuff> Pack(flatbuffers::FlatBufferBuilder &_fbb, const ScalarStuffT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
   394};
   395
   396struct ScalarStuffBuilder {
   397  typedef ScalarStuff Table;
   398  flatbuffers::FlatBufferBuilder &fbb_;
   399  flatbuffers::uoffset_t start_;
   400  void add_just_i8(int8_t just_i8) {
   401    fbb_.AddElement<int8_t>(ScalarStuff::VT_JUST_I8, just_i8, 0);
   402  }
   403  void add_maybe_i8(int8_t maybe_i8) {
   404    fbb_.AddElement<int8_t>(ScalarStuff::VT_MAYBE_I8, maybe_i8);
   405  }
   406  void add_default_i8(int8_t default_i8) {
   407    fbb_.AddElement<int8_t>(ScalarStuff::VT_DEFAULT_I8, default_i8, 42);
   408  }
   409  void add_just_u8(uint8_t just_u8) {
   410    fbb_.AddElement<uint8_t>(ScalarStuff::VT_JUST_U8, just_u8, 0);
   411  }
   412  void add_maybe_u8(uint8_t maybe_u8) {
   413    fbb_.AddElement<uint8_t>(ScalarStuff::VT_MAYBE_U8, maybe_u8);
   414  }
   415  void add_default_u8(uint8_t default_u8) {
   416    fbb_.AddElement<uint8_t>(ScalarStuff::VT_DEFAULT_U8, default_u8, 42);
   417  }
   418  void add_just_i16(int16_t just_i16) {
   419    fbb_.AddElement<int16_t>(ScalarStuff::VT_JUST_I16, just_i16, 0);
   420  }
   421  void add_maybe_i16(int16_t maybe_i16) {
   422    fbb_.AddElement<int16_t>(ScalarStuff::VT_MAYBE_I16, maybe_i16);
   423  }
   424  void add_default_i16(int16_t default_i16) {
   425    fbb_.AddElement<int16_t>(ScalarStuff::VT_DEFAULT_I16, default_i16, 42);
   426  }
   427  void add_just_u16(uint16_t just_u16) {
   428    fbb_.AddElement<uint16_t>(ScalarStuff::VT_JUST_U16, just_u16, 0);
   429  }
   430  void add_maybe_u16(uint16_t maybe_u16) {
   431    fbb_.AddElement<uint16_t>(ScalarStuff::VT_MAYBE_U16, maybe_u16);
   432  }
   433  void add_default_u16(uint16_t default_u16) {
   434    fbb_.AddElement<uint16_t>(ScalarStuff::VT_DEFAULT_U16, default_u16, 42);
   435  }
   436  void add_just_i32(int32_t just_i32) {
   437    fbb_.AddElement<int32_t>(ScalarStuff::VT_JUST_I32, just_i32, 0);
   438  }
   439  void add_maybe_i32(int32_t maybe_i32) {
   440    fbb_.AddElement<int32_t>(ScalarStuff::VT_MAYBE_I32, maybe_i32);
   441  }
   442  void add_default_i32(int32_t default_i32) {
   443    fbb_.AddElement<int32_t>(ScalarStuff::VT_DEFAULT_I32, default_i32, 42);
   444  }
   445  void add_just_u32(uint32_t just_u32) {
   446    fbb_.AddElement<uint32_t>(ScalarStuff::VT_JUST_U32, just_u32, 0);
   447  }
   448  void add_maybe_u32(uint32_t maybe_u32) {
   449    fbb_.AddElement<uint32_t>(ScalarStuff::VT_MAYBE_U32, maybe_u32);
   450  }
   451  void add_default_u32(uint32_t default_u32) {
   452    fbb_.AddElement<uint32_t>(ScalarStuff::VT_DEFAULT_U32, default_u32, 42);
   453  }
   454  void add_just_i64(int64_t just_i64) {
   455    fbb_.AddElement<int64_t>(ScalarStuff::VT_JUST_I64, just_i64, 0);
   456  }
   457  void add_maybe_i64(int64_t maybe_i64) {
   458    fbb_.AddElement<int64_t>(ScalarStuff::VT_MAYBE_I64, maybe_i64);
   459  }
   460  void add_default_i64(int64_t default_i64) {
   461    fbb_.AddElement<int64_t>(ScalarStuff::VT_DEFAULT_I64, default_i64, 42LL);
   462  }
   463  void add_just_u64(uint64_t just_u64) {
   464    fbb_.AddElement<uint64_t>(ScalarStuff::VT_JUST_U64, just_u64, 0);
   465  }
   466  void add_maybe_u64(uint64_t maybe_u64) {
   467    fbb_.AddElement<uint64_t>(ScalarStuff::VT_MAYBE_U64, maybe_u64);
   468  }
   469  void add_default_u64(uint64_t default_u64) {
   470    fbb_.AddElement<uint64_t>(ScalarStuff::VT_DEFAULT_U64, default_u64, 42ULL);
   471  }
   472  void add_just_f32(float just_f32) {
   473    fbb_.AddElement<float>(ScalarStuff::VT_JUST_F32, just_f32, 0.0f);
   474  }
   475  void add_maybe_f32(float maybe_f32) {
   476    fbb_.AddElement<float>(ScalarStuff::VT_MAYBE_F32, maybe_f32);
   477  }
   478  void add_default_f32(float default_f32) {
   479    fbb_.AddElement<float>(ScalarStuff::VT_DEFAULT_F32, default_f32, 42.0f);
   480  }
   481  void add_just_f64(double just_f64) {
   482    fbb_.AddElement<double>(ScalarStuff::VT_JUST_F64, just_f64, 0.0);
   483  }
   484  void add_maybe_f64(double maybe_f64) {
   485    fbb_.AddElement<double>(ScalarStuff::VT_MAYBE_F64, maybe_f64);
   486  }
   487  void add_default_f64(double default_f64) {
   488    fbb_.AddElement<double>(ScalarStuff::VT_DEFAULT_F64, default_f64, 42.0);
   489  }
   490  void add_just_bool(bool just_bool) {
   491    fbb_.AddElement<uint8_t>(ScalarStuff::VT_JUST_BOOL, static_cast<uint8_t>(just_bool), 0);
   492  }
   493  void add_maybe_bool(bool maybe_bool) {
   494    fbb_.AddElement<uint8_t>(ScalarStuff::VT_MAYBE_BOOL, static_cast<uint8_t>(maybe_bool));
   495  }
   496  void add_default_bool(bool default_bool) {
   497    fbb_.AddElement<uint8_t>(ScalarStuff::VT_DEFAULT_BOOL, static_cast<uint8_t>(default_bool), 1);
   498  }
   499  void add_just_enum(optional_scalars::OptionalByte just_enum) {
   500    fbb_.AddElement<int8_t>(ScalarStuff::VT_JUST_ENUM, static_cast<int8_t>(just_enum), 0);
   501  }
   502  void add_maybe_enum(optional_scalars::OptionalByte maybe_enum) {
   503    fbb_.AddElement<int8_t>(ScalarStuff::VT_MAYBE_ENUM, static_cast<int8_t>(maybe_enum));
   504  }
   505  void add_default_enum(optional_scalars::OptionalByte default_enum) {
   506    fbb_.AddElement<int8_t>(ScalarStuff::VT_DEFAULT_ENUM, static_cast<int8_t>(default_enum), 1);
   507  }
   508  explicit ScalarStuffBuilder(flatbuffers::FlatBufferBuilder &_fbb)
   509        : fbb_(_fbb) {
   510    start_ = fbb_.StartTable();
   511  }
   512  flatbuffers::Offset<ScalarStuff> Finish() {
   513    const auto end = fbb_.EndTable(start_);
   514    auto o = flatbuffers::Offset<ScalarStuff>(end);
   515    return o;
   516  }
   517};
   518
   519inline flatbuffers::Offset<ScalarStuff> CreateScalarStuff(
   520    flatbuffers::FlatBufferBuilder &_fbb,
   521    int8_t just_i8 = 0,
   522    flatbuffers::Optional<int8_t> maybe_i8 = flatbuffers::nullopt,
   523    int8_t default_i8 = 42,
   524    uint8_t just_u8 = 0,
   525    flatbuffers::Optional<uint8_t> maybe_u8 = flatbuffers::nullopt,
   526    uint8_t default_u8 = 42,
   527    int16_t just_i16 = 0,
   528    flatbuffers::Optional<int16_t> maybe_i16 = flatbuffers::nullopt,
   529    int16_t default_i16 = 42,
   530    uint16_t just_u16 = 0,
   531    flatbuffers::Optional<uint16_t> maybe_u16 = flatbuffers::nullopt,
   532    uint16_t default_u16 = 42,
   533    int32_t just_i32 = 0,
   534    flatbuffers::Optional<int32_t> maybe_i32 = flatbuffers::nullopt,
   535    int32_t default_i32 = 42,
   536    uint32_t just_u32 = 0,
   537    flatbuffers::Optional<uint32_t> maybe_u32 = flatbuffers::nullopt,
   538    uint32_t default_u32 = 42,
   539    int64_t just_i64 = 0,
   540    flatbuffers::Optional<int64_t> maybe_i64 = flatbuffers::nullopt,
   541    int64_t default_i64 = 42LL,
   542    uint64_t just_u64 = 0,
   543    flatbuffers::Optional<uint64_t> maybe_u64 = flatbuffers::nullopt,
   544    uint64_t default_u64 = 42ULL,
   545    float just_f32 = 0.0f,
   546    flatbuffers::Optional<float> maybe_f32 = flatbuffers::nullopt,
   547    float default_f32 = 42.0f,
   548    double just_f64 = 0.0,
   549    flatbuffers::Optional<double> maybe_f64 = flatbuffers::nullopt,
   550    double default_f64 = 42.0,
   551    bool just_bool = false,
   552    flatbuffers::Optional<bool> maybe_bool = flatbuffers::nullopt,
   553    bool default_bool = true,
   554    optional_scalars::OptionalByte just_enum = optional_scalars::OptionalByte::None,
   555    flatbuffers::Optional<optional_scalars::OptionalByte> maybe_enum = flatbuffers::nullopt,
   556    optional_scalars::OptionalByte default_enum = optional_scalars::OptionalByte::One) {
   557  ScalarStuffBuilder builder_(_fbb);
   558  builder_.add_default_f64(default_f64);
   559  if(maybe_f64) { builder_.add_maybe_f64(*maybe_f64); }
   560  builder_.add_just_f64(just_f64);
   561  builder_.add_default_u64(default_u64);
   562  if(maybe_u64) { builder_.add_maybe_u64(*maybe_u64); }
   563  builder_.add_just_u64(just_u64);
   564  builder_.add_default_i64(default_i64);
   565  if(maybe_i64) { builder_.add_maybe_i64(*maybe_i64); }
   566  builder_.add_just_i64(just_i64);
   567  builder_.add_default_f32(default_f32);
   568  if(maybe_f32) { builder_.add_maybe_f32(*maybe_f32); }
   569  builder_.add_just_f32(just_f32);
   570  builder_.add_default_u32(default_u32);
   571  if(maybe_u32) { builder_.add_maybe_u32(*maybe_u32); }
   572  builder_.add_just_u32(just_u32);
   573  builder_.add_default_i32(default_i32);
   574  if(maybe_i32) { builder_.add_maybe_i32(*maybe_i32); }
   575  builder_.add_just_i32(just_i32);
   576  builder_.add_default_u16(default_u16);
   577  if(maybe_u16) { builder_.add_maybe_u16(*maybe_u16); }
   578  builder_.add_just_u16(just_u16);
   579  builder_.add_default_i16(default_i16);
   580  if(maybe_i16) { builder_.add_maybe_i16(*maybe_i16); }
   581  builder_.add_just_i16(just_i16);
   582  builder_.add_default_enum(default_enum);
   583  if(maybe_enum) { builder_.add_maybe_enum(*maybe_enum); }
   584  builder_.add_just_enum(just_enum);
   585  builder_.add_default_bool(default_bool);
   586  if(maybe_bool) { builder_.add_maybe_bool(*maybe_bool); }
   587  builder_.add_just_bool(just_bool);
   588  builder_.add_default_u8(default_u8);
   589  if(maybe_u8) { builder_.add_maybe_u8(*maybe_u8); }
   590  builder_.add_just_u8(just_u8);
   591  builder_.add_default_i8(default_i8);
   592  if(maybe_i8) { builder_.add_maybe_i8(*maybe_i8); }
   593  builder_.add_just_i8(just_i8);
   594  return builder_.Finish();
   595}
   596
   597struct ScalarStuff::Traits {
   598  using type = ScalarStuff;
   599  static auto constexpr Create = CreateScalarStuff;
   600};
   601
   602flatbuffers::Offset<ScalarStuff> CreateScalarStuff(flatbuffers::FlatBufferBuilder &_fbb, const ScalarStuffT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
   603
   604inline ScalarStuffT *ScalarStuff::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
   605  auto _o = std::make_unique<ScalarStuffT>();
   606  UnPackTo(_o.get(), _resolver);
   607  return _o.release();
   608}
   609
   610inline void ScalarStuff::UnPackTo(ScalarStuffT *_o, const flatbuffers::resolver_function_t *_resolver) const {
   611  (void)_o;
   612  (void)_resolver;
   613  { auto _e = just_i8(); _o->just_i8 = _e; }
   614  { auto _e = maybe_i8(); _o->maybe_i8 = _e; }
   615  { auto _e = default_i8(); _o->default_i8 = _e; }
   616  { auto _e = just_u8(); _o->just_u8 = _e; }
   617  { auto _e = maybe_u8(); _o->maybe_u8 = _e; }
   618  { auto _e = default_u8(); _o->default_u8 = _e; }
   619  { auto _e = just_i16(); _o->just_i16 = _e; }
   620  { auto _e = maybe_i16(); _o->maybe_i16 = _e; }
   621  { auto _e = default_i16(); _o->default_i16 = _e; }
   622  { auto _e = just_u16(); _o->just_u16 = _e; }
   623  { auto _e = maybe_u16(); _o->maybe_u16 = _e; }
   624  { auto _e = default_u16(); _o->default_u16 = _e; }
   625  { auto _e = just_i32(); _o->just_i32 = _e; }
   626  { auto _e = maybe_i32(); _o->maybe_i32 = _e; }
   627  { auto _e = default_i32(); _o->default_i32 = _e; }
   628  { auto _e = just_u32(); _o->just_u32 = _e; }
   629  { auto _e = maybe_u32(); _o->maybe_u32 = _e; }
   630  { auto _e = default_u32(); _o->default_u32 = _e; }
   631  { auto _e = just_i64(); _o->just_i64 = _e; }
   632  { auto _e = maybe_i64(); _o->maybe_i64 = _e; }
   633  { auto _e = default_i64(); _o->default_i64 = _e; }
   634  { auto _e = just_u64(); _o->just_u64 = _e; }
   635  { auto _e = maybe_u64(); _o->maybe_u64 = _e; }
   636  { auto _e = default_u64(); _o->default_u64 = _e; }
   637  { auto _e = just_f32(); _o->just_f32 = _e; }
   638  { auto _e = maybe_f32(); _o->maybe_f32 = _e; }
   639  { auto _e = default_f32(); _o->default_f32 = _e; }
   640  { auto _e = just_f64(); _o->just_f64 = _e; }
   641  { auto _e = maybe_f64(); _o->maybe_f64 = _e; }
   642  { auto _e = default_f64(); _o->default_f64 = _e; }
   643  { auto _e = just_bool(); _o->just_bool = _e; }
   644  { auto _e = maybe_bool(); _o->maybe_bool = _e; }
   645  { auto _e = default_bool(); _o->default_bool = _e; }
   646  { auto _e = just_enum(); _o->just_enum = _e; }
   647  { auto _e = maybe_enum(); _o->maybe_enum = _e; }
   648  { auto _e = default_enum(); _o->default_enum = _e; }
   649}
   650
   651inline flatbuffers::Offset<ScalarStuff> ScalarStuff::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ScalarStuffT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
   652  return CreateScalarStuff(_fbb, _o, _rehasher);
   653}
   654
   655inline flatbuffers::Offset<ScalarStuff> CreateScalarStuff(flatbuffers::FlatBufferBuilder &_fbb, const ScalarStuffT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
   656  (void)_rehasher;
   657  (void)_o;
   658  struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ScalarStuffT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
   659  auto _just_i8 = _o->just_i8;
   660  auto _maybe_i8 = _o->maybe_i8;
   661  auto _default_i8 = _o->default_i8;
   662  auto _just_u8 = _o->just_u8;
   663  auto _maybe_u8 = _o->maybe_u8;
   664  auto _default_u8 = _o->default_u8;
   665  auto _just_i16 = _o->just_i16;
   666  auto _maybe_i16 = _o->maybe_i16;
   667  auto _default_i16 = _o->default_i16;
   668  auto _just_u16 = _o->just_u16;
   669  auto _maybe_u16 = _o->maybe_u16;
   670  auto _default_u16 = _o->default_u16;
   671  auto _just_i32 = _o->just_i32;
   672  auto _maybe_i32 = _o->maybe_i32;
   673  auto _default_i32 = _o->default_i32;
   674  auto _just_u32 = _o->just_u32;
   675  auto _maybe_u32 = _o->maybe_u32;
   676  auto _default_u32 = _o->default_u32;
   677  auto _just_i64 = _o->just_i64;
   678  auto _maybe_i64 = _o->maybe_i64;
   679  auto _default_i64 = _o->default_i64;
   680  auto _just_u64 = _o->just_u64;
   681  auto _maybe_u64 = _o->maybe_u64;
   682  auto _default_u64 = _o->default_u64;
   683  auto _just_f32 = _o->just_f32;
   684  auto _maybe_f32 = _o->maybe_f32;
   685  auto _default_f32 = _o->default_f32;
   686  auto _just_f64 = _o->just_f64;
   687  auto _maybe_f64 = _o->maybe_f64;
   688  auto _default_f64 = _o->default_f64;
   689  auto _just_bool = _o->just_bool;
   690  auto _maybe_bool = _o->maybe_bool;
   691  auto _default_bool = _o->default_bool;
   692  auto _just_enum = _o->just_enum;
   693  auto _maybe_enum = _o->maybe_enum;
   694  auto _default_enum = _o->default_enum;
   695  return optional_scalars::CreateScalarStuff(
   696      _fbb,
   697      _just_i8,
   698      _maybe_i8,
   699      _default_i8,
   700      _just_u8,
   701      _maybe_u8,
   702      _default_u8,
   703      _just_i16,
   704      _maybe_i16,
   705      _default_i16,
   706      _just_u16,
   707      _maybe_u16,
   708      _default_u16,
   709      _just_i32,
   710      _maybe_i32,
   711      _default_i32,
   712      _just_u32,
   713      _maybe_u32,
   714      _default_u32,
   715      _just_i64,
   716      _maybe_i64,
   717      _default_i64,
   718      _just_u64,
   719      _maybe_u64,
   720      _default_u64,
   721      _just_f32,
   722      _maybe_f32,
   723      _default_f32,
   724      _just_f64,
   725      _maybe_f64,
   726      _default_f64,
   727      _just_bool,
   728      _maybe_bool,
   729      _default_bool,
   730      _just_enum,
   731      _maybe_enum,
   732      _default_enum);
   733}
   734
   735inline const flatbuffers::TypeTable *OptionalByteTypeTable() {
   736  static const flatbuffers::TypeCode type_codes[] = {
   737    { flatbuffers::ET_CHAR, 0, 0 },
   738    { flatbuffers::ET_CHAR, 0, 0 },
   739    { flatbuffers::ET_CHAR, 0, 0 }
   740  };
   741  static const flatbuffers::TypeFunction type_refs[] = {
   742    optional_scalars::OptionalByteTypeTable
   743  };
   744  static const char * const names[] = {
   745    "None",
   746    "One",
   747    "Two"
   748  };
   749  static const flatbuffers::TypeTable tt = {
   750    flatbuffers::ST_ENUM, 3, type_codes, type_refs, nullptr, nullptr, names
   751  };
   752  return &tt;
   753}
   754
   755inline const flatbuffers::TypeTable *ScalarStuffTypeTable() {
   756  static const flatbuffers::TypeCode type_codes[] = {
   757    { flatbuffers::ET_CHAR, 0, -1 },
   758    { flatbuffers::ET_CHAR, 0, -1 },
   759    { flatbuffers::ET_CHAR, 0, -1 },
   760    { flatbuffers::ET_UCHAR, 0, -1 },
   761    { flatbuffers::ET_UCHAR, 0, -1 },
   762    { flatbuffers::ET_UCHAR, 0, -1 },
   763    { flatbuffers::ET_SHORT, 0, -1 },
   764    { flatbuffers::ET_SHORT, 0, -1 },
   765    { flatbuffers::ET_SHORT, 0, -1 },
   766    { flatbuffers::ET_USHORT, 0, -1 },
   767    { flatbuffers::ET_USHORT, 0, -1 },
   768    { flatbuffers::ET_USHORT, 0, -1 },
   769    { flatbuffers::ET_INT, 0, -1 },
   770    { flatbuffers::ET_INT, 0, -1 },
   771    { flatbuffers::ET_INT, 0, -1 },
   772    { flatbuffers::ET_UINT, 0, -1 },
   773    { flatbuffers::ET_UINT, 0, -1 },
   774    { flatbuffers::ET_UINT, 0, -1 },
   775    { flatbuffers::ET_LONG, 0, -1 },
   776    { flatbuffers::ET_LONG, 0, -1 },
   777    { flatbuffers::ET_LONG, 0, -1 },
   778    { flatbuffers::ET_ULONG, 0, -1 },
   779    { flatbuffers::ET_ULONG, 0, -1 },
   780    { flatbuffers::ET_ULONG, 0, -1 },
   781    { flatbuffers::ET_FLOAT, 0, -1 },
   782    { flatbuffers::ET_FLOAT, 0, -1 },
   783    { flatbuffers::ET_FLOAT, 0, -1 },
   784    { flatbuffers::ET_DOUBLE, 0, -1 },
   785    { flatbuffers::ET_DOUBLE, 0, -1 },
   786    { flatbuffers::ET_DOUBLE, 0, -1 },
   787    { flatbuffers::ET_BOOL, 0, -1 },
   788    { flatbuffers::ET_BOOL, 0, -1 },
   789    { flatbuffers::ET_BOOL, 0, -1 },
   790    { flatbuffers::ET_CHAR, 0, 0 },
   791    { flatbuffers::ET_CHAR, 0, 0 },
   792    { flatbuffers::ET_CHAR, 0, 0 }
   793  };
   794  static const flatbuffers::TypeFunction type_refs[] = {
   795    optional_scalars::OptionalByteTypeTable
   796  };
   797  static const char * const names[] = {
   798    "just_i8",
   799    "maybe_i8",
   800    "default_i8",
   801    "just_u8",
   802    "maybe_u8",
   803    "default_u8",
   804    "just_i16",
   805    "maybe_i16",
   806    "default_i16",
   807    "just_u16",
   808    "maybe_u16",
   809    "default_u16",
   810    "just_i32",
   811    "maybe_i32",
   812    "default_i32",
   813    "just_u32",
   814    "maybe_u32",
   815    "default_u32",
   816    "just_i64",
   817    "maybe_i64",
   818    "default_i64",
   819    "just_u64",
   820    "maybe_u64",
   821    "default_u64",
   822    "just_f32",
   823    "maybe_f32",
   824    "default_f32",
   825    "just_f64",
   826    "maybe_f64",
   827    "default_f64",
   828    "just_bool",
   829    "maybe_bool",
   830    "default_bool",
   831    "just_enum",
   832    "maybe_enum",
   833    "default_enum"
   834  };
   835  static const flatbuffers::TypeTable tt = {
   836    flatbuffers::ST_TABLE, 36, type_codes, type_refs, nullptr, nullptr, names
   837  };
   838  return &tt;
   839}
   840
   841inline const optional_scalars::ScalarStuff *GetScalarStuff(const void *buf) {
   842  return flatbuffers::GetRoot<optional_scalars::ScalarStuff>(buf);
   843}
   844
   845inline const optional_scalars::ScalarStuff *GetSizePrefixedScalarStuff(const void *buf) {
   846  return flatbuffers::GetSizePrefixedRoot<optional_scalars::ScalarStuff>(buf);
   847}
   848
   849inline ScalarStuff *GetMutableScalarStuff(void *buf) {
   850  return flatbuffers::GetMutableRoot<ScalarStuff>(buf);
   851}
   852
   853inline const char *ScalarStuffIdentifier() {
   854  return "NULL";
   855}
   856
   857inline bool ScalarStuffBufferHasIdentifier(const void *buf) {
   858  return flatbuffers::BufferHasIdentifier(
   859      buf, ScalarStuffIdentifier());
   860}
   861
   862inline bool VerifyScalarStuffBuffer(
   863    flatbuffers::Verifier &verifier) {
   864  return verifier.VerifyBuffer<optional_scalars::ScalarStuff>(ScalarStuffIdentifier());
   865}
   866
   867inline bool VerifySizePrefixedScalarStuffBuffer(
   868    flatbuffers::Verifier &verifier) {
   869  return verifier.VerifySizePrefixedBuffer<optional_scalars::ScalarStuff>(ScalarStuffIdentifier());
   870}
   871
   872inline const char *ScalarStuffExtension() {
   873  return "mon";
   874}
   875
   876inline void FinishScalarStuffBuffer(
   877    flatbuffers::FlatBufferBuilder &fbb,
   878    flatbuffers::Offset<optional_scalars::ScalarStuff> root) {
   879  fbb.Finish(root, ScalarStuffIdentifier());
   880}
   881
   882inline void FinishSizePrefixedScalarStuffBuffer(
   883    flatbuffers::FlatBufferBuilder &fbb,
   884    flatbuffers::Offset<optional_scalars::ScalarStuff> root) {
   885  fbb.FinishSizePrefixed(root, ScalarStuffIdentifier());
   886}
   887
   888inline std::unique_ptr<optional_scalars::ScalarStuffT> UnPackScalarStuff(
   889    const void *buf,
   890    const flatbuffers::resolver_function_t *res = nullptr) {
   891  return std::unique_ptr<optional_scalars::ScalarStuffT>(GetScalarStuff(buf)->UnPack(res));
   892}
   893
   894inline std::unique_ptr<optional_scalars::ScalarStuffT> UnPackSizePrefixedScalarStuff(
   895    const void *buf,
   896    const flatbuffers::resolver_function_t *res = nullptr) {
   897  return std::unique_ptr<optional_scalars::ScalarStuffT>(GetSizePrefixedScalarStuff(buf)->UnPack(res));
   898}
   899
   900}  // namespace optional_scalars
   901
   902#endif  // FLATBUFFERS_GENERATED_OPTIONALSCALARS2_OPTIONAL_SCALARS_H_

View as plain text