72 :
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110#define FLATBUFFERS_GEN_TYPES(TD) \
111 FLATBUFFERS_GEN_TYPES_SCALAR(TD) \
112 FLATBUFFERS_GEN_TYPES_POINTER(TD) \
113 FLATBUFFERS_GEN_TYPE_ARRAY(TD)
114
115
116#ifdef __GNUC__
117__extension__
118#endif
120 #define FLATBUFFERS_TD(ENUM, ...) \
121 BASE_TYPE_ ## ENUM,
123 #undef FLATBUFFERS_TD
124};
125
126#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, ...) \
127 static_assert(sizeof(CTYPE) <= sizeof(largest_scalar_t), \
128 "define largest_scalar_t as " #CTYPE);
130#undef FLATBUFFERS_TD
131
132inline bool IsScalar (BaseType t) {
return t >= BASE_TYPE_UTYPE &&
133 t <= BASE_TYPE_DOUBLE; }
134inline bool IsInteger(BaseType t) {
return t >= BASE_TYPE_UTYPE &&
135 t <= BASE_TYPE_ULONG; }
136inline bool IsFloat (BaseType t) {
return t == BASE_TYPE_FLOAT ||
137 t == BASE_TYPE_DOUBLE; }
138inline bool IsLong (BaseType t) {
return t == BASE_TYPE_LONG ||
139 t == BASE_TYPE_ULONG; }
140inline bool IsBool (BaseType t) {
return t == BASE_TYPE_BOOL; }
141inline bool IsOneByte(BaseType t) {
return t >= BASE_TYPE_UTYPE &&
142 t <= BASE_TYPE_UCHAR; }
143
145 return (t == BASE_TYPE_UTYPE) || (t == BASE_TYPE_UCHAR) ||
146 (t == BASE_TYPE_USHORT) || (t == BASE_TYPE_UINT) ||
147 (t == BASE_TYPE_ULONG);
148}
149
150
151
154
156
157struct StructDef;
158struct EnumDef;
159class Parser;
160
161
162
164{
165 explicit Type(BaseType _base_type = BASE_TYPE_NONE, StructDef *_sd =
nullptr,
166 EnumDef *_ed = nullptr, uint16_t _fixed_length = 0)
167 : base_type(_base_type), element(BASE_TYPE_NONE), struct_def(_sd), enum_def(_ed),
168 fixed_length(_fixed_length)
169 {
170 }
171
173 {
174 return base_type == o.base_type && element == o.element && struct_def == o.struct_def &&
175 enum_def == o.enum_def;
176 }
177
178 Type VectorType()
const {
return Type(element, struct_def, enum_def, fixed_length); }
179
180 Offset<reflection::Type> Serialize(FlatBufferBuilder *builder) const;
181
182 bool Deserialize(const Parser &parser, const reflection::Type *type);
183
186 StructDef *struct_def;
187 EnumDef *enum_def;
188
189 uint16_t fixed_length;
190};
191
192
193struct Value
194{
195 Value() :
constant(
"0"),
offset(static_cast<voffset_t>(~(static_cast<voffset_t>(0U)))) {}
199};
200
201
202
203template <typename T> class SymbolTable
204{
205public:
206 ~SymbolTable()
207 {
208 for (auto it = vec.begin(); it != vec.end(); ++it)
209 {
210 delete *it;
211 }
212 }
213
214 bool Add(
const std::string &name, T *e)
215 {
217 auto it = dict.find(name);
218 if (it != dict.end())
219 return true;
220 dict[name] = e;
221 return false;
222 }
223
224 void Move(const std::string &oldname, const std::string &newname)
225 {
226 auto it = dict.find(oldname);
227 if (it != dict.end())
228 {
229 auto obj = it->second;
230 dict.erase(it);
232 }
233 else
234 {
236 }
237 }
238
239 T *Lookup(const std::string &name) const
240 {
241 auto it = dict.find(name);
242 return it == dict.end() ? nullptr : it->second;
243 }
244
245public:
246 std::map<std::string, T *> dict;
247 std::vector<T *> vec;
248};
249
250
251struct Namespace
252{
253 Namespace() : from_table(0) {}
254
255
256
257
258
259 std::string GetFullyQualifiedName(const std::string &name, size_t max_components = 1000) const;
260
261 std::vector<std::string> components;
262 size_t from_table;
263};
264
265inline bool operator<(
const Namespace &a,
const Namespace &b)
266{
267 size_t min_size = std::min(a.components.size(),
b.components.size());
268 for (size_t i = 0; i < min_size; ++i)
269 {
270 if (a.components[i] !=
b.components[i])
271 return a.components[i] <
b.components[i];
272 }
273 return a.components.size() <
b.components.size();
274}
275
276
277struct Definition
278{
279 Definition()
280 : generated(false), defined_namespace(nullptr), serialized_location(0),
index(-1), refcount(1)
281 {
282 }
283
285 SerializeAttributes(FlatBufferBuilder *builder, const Parser &parser) const;
286
287 bool DeserializeAttributes(Parser &parser,
const Vector<Offset<reflection::KeyValue>> *attrs);
288
289 std::string name;
291 std::vector<std::string> doc_comment;
292 SymbolTable<Value> attributes;
293 bool generated;
294 Namespace *defined_namespace;
295
296
297 uoffset_t serialized_location;
299 int refcount;
300};
301
302struct FieldDef : public Definition
303{
304 FieldDef()
305 : deprecated(false), key(false), shared(false), native_inline(false), flexbuffer(false),
306 presence(
kDefault), nested_flatbuffer(NULL), padding(0)
307 {
308 }
309
310 Offset<reflection::Field> Serialize(FlatBufferBuilder *builder, uint16_t id,
311 const Parser &parser) const;
312
313 bool Deserialize(Parser &parser, const reflection::Field *field);
314
315 bool IsScalarOptional()
const {
return IsScalar(value.type.base_type) && IsOptional(); }
316 bool IsOptional() const { return presence == kOptional; }
317 bool IsRequired() const { return presence == kRequired; }
318 bool IsDefault()
const {
return presence ==
kDefault; }
319
320 Value value;
321 bool deprecated;
322
323 bool key;
324 bool shared;
325
326 bool native_inline;
327
328 bool flexbuffer;
329
330 enum Presence
331 {
332
333 kRequired,
334
335 kOptional,
336
337
339 };
340 Presence static MakeFieldPresence(bool optional, bool required)
341 {
343
344 return required ? FieldDef::kRequired
346 : FieldDef::kDefault;
347
348 }
349 Presence presence;
350
351 StructDef *nested_flatbuffer;
352 size_t padding;
353};
354
355struct StructDef : public Definition
356{
357 StructDef()
358 : fixed(false), predecl(true), sortbysize(true), has_key(false), minalign(1), bytesize(0)
359 {
360 }
361
362 void PadLastField(size_t min_align)
363 {
364 auto padding = PaddingBytes(bytesize, min_align);
365 bytesize += padding;
366 if (fields.vec.size())
367 fields.vec.back()->padding = padding;
368 }
369
370 Offset<reflection::Object> Serialize(FlatBufferBuilder *builder, const Parser &parser) const;
371
372 bool Deserialize(Parser &parser, const reflection::Object *object);
373
374 SymbolTable<FieldDef> fields;
375
376 bool fixed;
377 bool predecl;
378 bool sortbysize;
379 bool has_key;
380 size_t minalign;
381 size_t bytesize;
382
384};
385
386struct EnumDef;
387struct EnumValBuilder;
388
389struct EnumVal
390{
391 Offset<reflection::EnumVal> Serialize(FlatBufferBuilder *builder, const Parser &parser) const;
392
393 bool Deserialize(const Parser &parser, const reflection::EnumVal *val);
394
395 uint64_t GetAsUInt64() const { return static_cast<uint64_t>(value); }
396 int64_t GetAsInt64() const { return value; }
397 bool IsZero() const { return 0 == value; }
398 bool IsNonZero() const { return !IsZero(); }
399
400 std::string name;
401 std::vector<std::string> doc_comment;
403
404private:
405 friend EnumDef;
406 friend EnumValBuilder;
407 friend bool operator==(
const EnumVal &lhs,
const EnumVal &rhs);
408
409 EnumVal(const std::string &_name, int64_t _val) : name(_name), value(_val) {}
410 EnumVal() : value(0) {}
411
412 int64_t value;
413};
414
415struct EnumDef : public Definition
416{
417 EnumDef() : is_union(false), uses_multiple_type_instances(false) {}
418
419 Offset<reflection::Enum> Serialize(FlatBufferBuilder *builder, const Parser &parser) const;
420
421 bool Deserialize(Parser &parser, const reflection::Enum *values);
422
423 template <typename T> void ChangeEnumValue(EnumVal *ev, T new_val);
424 void SortByValue();
425 void RemoveDuplicates();
426
427 std::string AllFlags() const;
428 const EnumVal *MinValue() const;
429 const EnumVal *MaxValue() const;
430
431 uint64_t Distance(const EnumVal *v1, const EnumVal *v2) const;
432
433 uint64_t Distance() const { return Distance(MinValue(), MaxValue()); }
434
435 EnumVal *ReverseLookup(int64_t enum_idx, bool skip_union_default = false) const;
436 EnumVal *FindByValue(
const std::string &
constant)
const;
437
438 std::string ToString(const EnumVal &ev) const
439 {
441 }
442
443 size_t size()
const {
return vals.vec.size(); }
444
445 const std::vector<EnumVal *> &Vals() const { return vals.vec; }
446
447 const EnumVal *Lookup(const std::string &enum_name) const { return vals.Lookup(enum_name); }
448
449 bool is_union;
450
451
452 bool uses_multiple_type_instances;
453 Type underlying_type;
454
455private:
456 bool IsUInt64() const { return (BASE_TYPE_ULONG == underlying_type.base_type); }
457
458 friend EnumValBuilder;
459 SymbolTable<EnumVal> vals;
460};
461
462inline bool IsString(
const Type &type) {
return type.base_type == BASE_TYPE_STRING; }
463
464inline bool IsStruct(
const Type &type)
465{
466 return type.base_type == BASE_TYPE_STRUCT &&
type.struct_def->fixed;
467}
468
469inline bool IsUnion(
const Type &type)
470{
471 return type.enum_def !=
nullptr &&
type.enum_def->is_union;
472}
473
474inline bool IsVector(
const Type &type) {
return type.base_type == BASE_TYPE_VECTOR; }
475
476inline bool IsArray(
const Type &type) {
return type.base_type == BASE_TYPE_ARRAY; }
477
479
480inline bool IsEnum(
const Type &type)
481{
483}
484
486{
490}
491
493{
495 {
496 return type.struct_def->minalign;
497 }
499 {
501 }
502 else
503 {
505 }
506}
507inline bool operator==(
const EnumVal &lhs,
const EnumVal &rhs) {
return lhs.value == rhs.value; }
508inline bool operator!=(
const EnumVal &lhs,
const EnumVal &rhs) {
return !(lhs == rhs); }
509
510inline bool EqualByName(
const Type &a,
const Type &b)
511{
512 return a.base_type ==
b.base_type && a.element ==
b.element &&
513 (a.struct_def ==
b.struct_def || a.struct_def->name ==
b.struct_def->name) &&
514 (a.enum_def ==
b.enum_def || a.enum_def->name ==
b.enum_def->name);
515}
516
517struct RPCCall : public Definition
518{
519 Offset<reflection::RPCCall> Serialize(FlatBufferBuilder *builder, const Parser &parser) const;
520
521 bool Deserialize(Parser &parser, const reflection::RPCCall *call);
522
523 StructDef *request, *response;
524};
525
526struct ServiceDef : public Definition
527{
528 Offset<reflection::Service> Serialize(FlatBufferBuilder *builder, const Parser &parser) const;
529 bool Deserialize(Parser &parser, const reflection::Service *service);
530
531 SymbolTable<RPCCall> calls;
532};
533
534
535struct IDLOptions
536{
537 bool gen_jvmstatic;
538
539 bool use_flexbuffers;
540 bool strict_json;
541 bool output_default_scalars_in_json;
542 int indent_step;
543 bool output_enum_identifiers;
544 bool prefixed_enums;
545 bool scoped_enums;
546 bool include_dependence_headers;
547 bool mutable_buffer;
548 bool one_file;
549 bool proto_mode;
550 bool proto_oneof_union;
551 bool generate_all;
552 bool skip_unexpected_fields_in_json;
553 bool generate_name_strings;
554 bool generate_object_based_api;
555 bool gen_compare;
556 std::string cpp_object_api_pointer_type;
557 std::string cpp_object_api_string_type;
558 bool cpp_object_api_string_flexible_constructor;
559 bool cpp_direct_copy;
560 bool gen_nullable;
561 bool java_checkerframework;
562 bool gen_generated;
563 std::string object_prefix;
564 std::string object_suffix;
565 bool union_value_namespacing;
566 bool allow_non_utf8;
567 bool natural_utf8;
568 std::string include_prefix;
569 bool keep_include_path;
570 bool binary_schema_comments;
571 bool binary_schema_builtins;
572 bool binary_schema_gen_embed;
573 std::string go_import;
574 std::string go_namespace;
575 bool protobuf_ascii_alike;
576 bool size_prefixed;
577 std::string root_type;
578 bool force_defaults;
579 bool java_primitive_has_method;
580 bool cs_gen_json_serializer;
581 std::vector<std::string> cpp_includes;
582 std::string cpp_std;
583 bool cpp_static_reflection;
584 std::string proto_namespace_suffix;
585 std::string filename_suffix;
586 std::string filename_extension;
587 bool no_warnings;
588
589
590 enum Language
591 {
592 kJava = 1 << 0,
593 kCSharp = 1 << 1,
594 kGo = 1 << 2,
595 kCpp = 1 << 3,
596 kPython = 1 << 5,
597 kPhp = 1 << 6,
598 kJson = 1 << 7,
599 kBinary = 1 << 8,
600 kTs = 1 << 9,
601 kJsonSchema = 1 << 10,
602 kDart = 1 << 11,
603 kLua = 1 << 12,
604 kLobster = 1 << 13,
605 kRust = 1 << 14,
606 kKotlin = 1 << 15,
607 kSwift = 1 << 16,
608 kMAX
609 };
610
611 Language lang;
612
613 enum MiniReflect
614 {
616 kTypes,
617 kTypesAndNames
618 };
619
620 MiniReflect mini_reflect;
621
622
623 bool require_explicit_ids;
624
625
626
627 unsigned long lang_to_generate;
628
629
630
631 bool set_empty_strings_to_null;
632
633
634
635 bool set_empty_vectors_to_null;
636
637 IDLOptions()
638 : gen_jvmstatic(false), use_flexbuffers(false), strict_json(false),
639 output_default_scalars_in_json(false), indent_step(2), output_enum_identifiers(true),
640 prefixed_enums(true), scoped_enums(false), include_dependence_headers(true),
641 mutable_buffer(false), one_file(false), proto_mode(false), proto_oneof_union(false),
642 generate_all(false), skip_unexpected_fields_in_json(false), generate_name_strings(false),
643 generate_object_based_api(false), gen_compare(false),
644 cpp_object_api_pointer_type("std::unique_ptr"),
645 cpp_object_api_string_flexible_constructor(false), cpp_direct_copy(true), gen_nullable(false),
646 java_checkerframework(false), gen_generated(false), object_suffix("T"),
647 union_value_namespacing(true), allow_non_utf8(false), natural_utf8(false),
648 keep_include_path(false), binary_schema_comments(false), binary_schema_builtins(false),
649 binary_schema_gen_embed(false), protobuf_ascii_alike(false), size_prefixed(false),
650 force_defaults(false), java_primitive_has_method(false), cs_gen_json_serializer(false),
651 cpp_static_reflection(false), filename_suffix("_generated"), filename_extension(),
652 no_warnings(false), lang(IDLOptions::kJava), mini_reflect(IDLOptions::
kNone),
653 require_explicit_ids(false), lang_to_generate(0), set_empty_strings_to_null(true),
654 set_empty_vectors_to_null(true)
655 {
656 }
657};
658
659
660struct ParserState
661{
662 ParserState()
663 : cursor_(nullptr), line_start_(nullptr), line_(0), token_(-1),
664 attr_is_trivial_ascii_string_(true)
665 {
666 }
667
668protected:
669 void ResetState(const char *source)
670 {
671 cursor_ = source;
672 line_ = 0;
673 MarkNewLine();
674 }
675
676 void MarkNewLine()
677 {
678 line_start_ = cursor_;
679 line_ += 1;
680 }
681
682 int64_t CursorPosition() const
683 {
685 return static_cast<int64_t>(cursor_ - line_start_);
686 }
687
688 const char *cursor_;
689 const char *line_start_;
690 int line_;
691 int token_;
692
693
694
695
696 bool attr_is_trivial_ascii_string_;
697 std::string attribute_;
698 std::vector<std::string> doc_comment_;
699};
700
701
702
703
704
705
706
707
708class CheckedError
709{
710public:
711 explicit CheckedError(
bool error) : is_error_(
error), has_been_checked_(false) {}
712
713 CheckedError &operator=(const CheckedError &other)
714 {
715 is_error_ = other.is_error_;
716 has_been_checked_ = false;
717 other.has_been_checked_ = true;
718 return *this;
719 }
720
721 CheckedError(const CheckedError &other)
722 {
723 *this = other;
724 }
725
727
728 bool Check()
729 {
730 has_been_checked_ = true;
731 return is_error_;
732 }
733
734private:
735 bool is_error_;
736 mutable bool has_been_checked_;
737};
738
739
740
741
742#ifdef __GNUC__
743#define FLATBUFFERS_CHECKED_ERROR CheckedError \
744 __attribute__((warn_unused_result))
745#else
746#define FLATBUFFERS_CHECKED_ERROR CheckedError
747#endif
748
749
750class Parser : public ParserState
751{
752public:
753 explicit Parser(const IDLOptions &options = IDLOptions())
754 : current_namespace_(nullptr), empty_namespace_(nullptr),
756 opts(
options), uses_flexbuffers_(false), advanced_features_(0), source_(nullptr),
757 anonymous_counter_(0), parse_depth_counter_(0)
758 {
759 if (opts.force_defaults)
760 {
761 builder_.ForceDefaults(true);
762 }
763
764 empty_namespace_ = new Namespace();
765 namespaces_.push_back(empty_namespace_);
766 current_namespace_ = empty_namespace_;
767 known_attributes_["deprecated"] = true;
768 known_attributes_["required"] = true;
769 known_attributes_["key"] = true;
770 known_attributes_["shared"] = true;
771 known_attributes_["hash"] = true;
772 known_attributes_["id"] = true;
773 known_attributes_["force_align"] = true;
774 known_attributes_["bit_flags"] = true;
775 known_attributes_["original_order"] = true;
776 known_attributes_["nested_flatbuffer"] = true;
777 known_attributes_["csharp_partial"] = true;
778 known_attributes_["streaming"] = true;
779 known_attributes_["idempotent"] = true;
780 known_attributes_["cpp_type"] = true;
781 known_attributes_["cpp_ptr_type"] = true;
782 known_attributes_["cpp_ptr_type_get"] = true;
783 known_attributes_["cpp_str_type"] = true;
784 known_attributes_["cpp_str_flex_ctor"] = true;
785 known_attributes_["native_inline"] = true;
786 known_attributes_["native_custom_alloc"] = true;
787 known_attributes_["native_type"] = true;
788 known_attributes_["native_type_pack_name"] = true;
789 known_attributes_["native_default"] = true;
790 known_attributes_["flexbuffer"] = true;
791 known_attributes_["private"] = true;
792 }
793
794 ~Parser()
795 {
796 for (auto it = namespaces_.begin(); it != namespaces_.end(); ++it)
797 {
798 delete *it;
799 }
800 }
801
802
803
804
805
806
807
808
809
810
811
812
813 bool Parse(const char *_source, const char **include_paths = nullptr,
814 const char *source_filename = nullptr);
815
816 bool ParseJson(const char *json, const char *json_filename = nullptr);
817
818
819 bool SetRootType(const char *name);
820
821
822 void MarkGenerated();
823
824
825
826 std::set<std::string> GetIncludedFilesRecursive(const std::string &file_name) const;
827
828
829
830 void Serialize();
831
832
833 bool Deserialize(
const uint8_t *buf,
const size_t size);
834
835
836
837 bool Deserialize(const reflection::Schema *schema);
838
839 Type *DeserializeType(
const reflection::Type *type);
840
841
842
843 std::string ConformTo(const Parser &base);
844
845
846
847 bool ParseFlexBuffer(const char *source, const char *source_filename,
848 flexbuffers::Builder *builder);
849
850 StructDef *LookupStruct(const std::string &id) const;
851 StructDef *LookupStructThruParentNamespaces(const std::string &id) const;
852
853 std::string UnqualifiedName(const std::string &fullQualifiedName);
854
856
857
858
859
861
862private:
863 class ParseDepthGuard;
864
865 void Message(const std::string &msg);
866 void Warning(const std::string &msg);
870 bool Is(int t) const;
871 bool IsIdent(const char *id) const;
873 std::string TokenToStringId(int t) const;
879 const Type &type, FieldDef **dest);
884 const StructDef *parent_struct_def, uoffset_t count,
885 bool inside_vector = false);
886 template <typename F>
888 F body);
890 uoffset_t *ovalue);
891 void SerializeStruct(const StructDef &struct_def, const Value &val);
892 void SerializeStruct(FlatBufferBuilder &builder, const StructDef &struct_def, const Value &val);
895 size_t fieldn);
898 const StructDef *parent_struct_def);
901 BaseType req, bool *destmatch);
907 StructDef *LookupCreateStruct(const std::string &name, bool create_if_new = true,
908 bool definition = false);
916 bool inside_oneof);
927 const char *source_filename);
929 const char *source_filename, const char *include_filename);
932 const char *suffix, BaseType baseType);
934 size_t *align);
935
936 bool SupportsAdvancedUnionFeatures() const;
937 bool SupportsAdvancedArrayFeatures() const;
938 bool SupportsOptionalScalars() const;
939 bool SupportsDefaultVectorsAndStrings() const;
940 Namespace *UniqueNamespace(Namespace *ns);
941
943 template <typename F> CheckedError Recurse(F f);
944
945public:
946 SymbolTable<Type> types_;
947 SymbolTable<StructDef> structs_;
948 SymbolTable<EnumDef> enums_;
949 SymbolTable<ServiceDef> services_;
950 std::vector<Namespace *> namespaces_;
951 Namespace *current_namespace_;
952 Namespace *empty_namespace_;
953 std::string error_;
954
955 FlatBufferBuilder builder_;
956 flexbuffers::Builder flex_builder_;
958 StructDef *root_struct_def_;
959 std::string file_identifier_;
960 std::string file_extension_;
961
962 std::map<uint64_t, std::string> included_files_;
963 std::map<std::string, std::set<std::string>> files_included_per_file_;
964 std::vector<std::string> native_included_files_;
965
966 std::map<std::string, bool> known_attributes_;
967
968 IDLOptions opts;
969 bool uses_flexbuffers_;
970
971 uint64_t advanced_features_;
972
973private:
974 const char *source_;
975
976 std::string file_being_parsed_;
977
978 std::vector<std::pair<Value, FieldDef *>> field_stack_;
979
980 int anonymous_counter_;
981 int parse_depth_counter_;
982};
983
984
985
986extern std::string
MakeCamel(
const std::string &in,
bool first =
true);
987
989
990
991
992
993
994
995
996
997
999 const std::string &tablename, std::string *text);
1000extern bool GenerateText(
const Parser &parser,
const void *flatbuffer, std::string *text);
1002 const std::string &file_name);
1003
1004
1005
1007
1008
1009
1010
1011extern bool GenerateBinary(
const Parser &parser,
const std::string &path,
1012 const std::string &file_name);
1013
1014
1015
1016extern bool GenerateCPP(
const Parser &parser,
const std::string &path,
1017 const std::string &file_name);
1018
1019
1020
1021extern bool GenerateCSharp(
const Parser &parser,
const std::string &path,
1022 const std::string &file_name);
1023
1024extern bool GenerateDart(
const Parser &parser,
const std::string &path,
1025 const std::string &file_name);
1026
1027
1028
1029extern bool GenerateJava(
const Parser &parser,
const std::string &path,
1030 const std::string &file_name);
1031
1032
1033
1034extern bool GenerateTS(
const Parser &parser,
const std::string &path,
const std::string &file_name);
1035
1036
1037
1038extern bool GenerateGo(
const Parser &parser,
const std::string &path,
const std::string &file_name);
1039
1040
1041
1042extern bool GeneratePhp(
const Parser &parser,
const std::string &path,
1043 const std::string &file_name);
1044
1045
1046
1047extern bool GeneratePython(
const Parser &parser,
const std::string &path,
1048 const std::string &file_name);
1049
1050
1051
1052extern bool GenerateLobster(
const Parser &parser,
const std::string &path,
1053 const std::string &file_name);
1054
1055
1056
1057extern bool GenerateLua(
const Parser &parser,
const std::string &path,
1058 const std::string &file_name);
1059
1060
1061
1062extern bool GenerateRust(
const Parser &parser,
const std::string &path,
1063 const std::string &file_name);
1064
1065
1066
1068 const std::string &file_name);
1069
1070extern bool GenerateKotlin(
const Parser &parser,
const std::string &path,
1071 const std::string &file_name);
1072
1073
1074
1075extern bool GenerateSwift(
const Parser &parser,
const std::string &path,
1076 const std::string &file_name);
1077
1078
1079
1080extern std::string
GenerateFBS(
const Parser &parser,
const std::string &file_name);
1081extern bool GenerateFBS(
const Parser &parser,
const std::string &path,
1082 const std::string &file_name);
1083
1084
1085
1086extern std::string
TSMakeRule(
const Parser &parser,
const std::string &path,
1087 const std::string &file_name);
1088
1089
1090
1091extern std::string
CPPMakeRule(
const Parser &parser,
const std::string &path,
1092 const std::string &file_name);
1093
1094
1095
1096extern std::string
DartMakeRule(
const Parser &parser,
const std::string &path,
1097 const std::string &file_name);
1098
1099
1100
1101extern std::string
RustMakeRule(
const Parser &parser,
const std::string &path,
1102 const std::string &file_name);
1103
1104
1105
1107 const std::string &file_name);
1108
1109
1110
1111extern std::string
TextMakeRule(
const Parser &parser,
const std::string &path,
1112 const std::string &file_names);
1113
1114
1115
1116extern std::string
BinaryMakeRule(
const Parser &parser,
const std::string &path,
1117 const std::string &file_name);
1118
1119
1120
1121bool GenerateCppGRPC(
const Parser &parser,
const std::string &path,
const std::string &file_name);
1122
1123
1124
1125bool GenerateGoGRPC(
const Parser &parser,
const std::string &path,
const std::string &file_name);
1126
1127
1128
1129bool GenerateJavaGRPC(
const Parser &parser,
const std::string &path,
const std::string &file_name);
1130
1131
1132
1134 const std::string &file_name);
1135
1136
1137
1139 const std::string &file_name);
1140
1141extern bool GenerateTSGRPC(
const Parser &parser,
const std::string &path,
1142 const std::string &file_name);
1143}
1144
1145#endif
void Add(const float *input1_data, const Dims< 4 > &input1_dims, const float *input2_data, const Dims< 4 > &input2_dims, float *output_data, const Dims< 4 > &output_dims)
const char * kTypeNames[]
#define FLATBUFFERS_ASSERT
__global uchar * offset(const Image *img, int x, int y)
#define FLATBUFFERS_CHECKED_ERROR
#define FLATBUFFERS_TD(ENUM,...)
#define FLATBUFFERS_GEN_TYPES(TD)
bool operator<(const ElemID &lhs, const ElemID &rhs)
bool GenerateSwiftGRPC(const Parser &parser, const std::string &path, const std::string &file_name)
bool operator!=(const EnumVal &lhs, const EnumVal &rhs)
bool IsInteger(BaseType t)
std::string TextMakeRule(const Parser &parser, const std::string &path, const std::string &file_names)
bool IsScalar(BaseType t)
bool GenerateTextFromTable(const Parser &parser, const void *table, const std::string &tablename, std::string *text)
bool GenerateJava(const Parser &parser, const std::string &path, const std::string &file_name)
bool GenerateCSharp(const Parser &parser, const std::string &path, const std::string &file_name)
std::string RustMakeRule(const Parser &parser, const std::string &path, const std::string &file_name)
bool GenerateTSGRPC(const Parser &parser, const std::string &path, const std::string &file_name)
bool IsUnion(const Type &type)
bool IsSeries(const Type &type)
bool IsStruct(const Type &type)
bool GenerateJavaGRPC(const Parser &parser, const std::string &path, const std::string &file_name)
bool IsUnsigned(BaseType t)
std::string TSMakeRule(const Parser &parser, const std::string &path, const std::string &file_name)
int64_t LookupEnum(int64_t enum_val, const int64_t *values, size_t num_values)
void vector_emplace_back(std::vector< T > *vector, V &&data)
std::string NumToString(T t)
bool GenerateCppGRPC(const Parser &parser, const std::string &path, const std::string &file_name)
bool IsString(const Type &type)
bool GenerateRust(const Parser &parser, const std::string &path, const std::string &file_name)
std::string CPPMakeRule(const Parser &parser, const std::string &path, const std::string &file_name)
bool GenerateCPP(const Parser &parser, const std::string &path, const std::string &file_name)
bool GenerateLobster(const Parser &parser, const std::string &path, const std::string &file_name)
bool IsOneByte(BaseType t)
bool GenerateSwift(const Parser &parser, const std::string &path, const std::string &file_name)
bool GenerateKotlin(const Parser &parser, const std::string &path, const std::string &file_name)
bool GenerateGo(const Parser &parser, const std::string &path, const std::string &file_name)
bool GenerateDart(const Parser &parser, const std::string &path, const std::string &file_name)
bool GenerateGoGRPC(const Parser &parser, const std::string &path, const std::string &file_name)
size_t InlineAlignment(const Type &type)
std::string MakeCamel(const std::string &in, bool first=true)
bool IsArray(const Type &type)
std::string GenerateFBS(const Parser &parser, const std::string &file_name)
size_t SizeOf(BaseType t)
bool GenerateTextFile(const Parser &parser, const std::string &path, const std::string &file_name)
bool GeneratePython(const Parser &parser, const std::string &path, const std::string &file_name)
std::string BinaryMakeRule(const Parser &parser, const std::string &path, const std::string &file_name)
bool GenerateText(const Parser &parser, const void *flatbuffer, std::string *text)
std::string MakeScreamingCamel(const std::string &in)
size_t InlineSize(const Type &type)
bool GeneratePythonGRPC(const Parser &parser, const std::string &path, const std::string &file_name)
std::string JavaCSharpMakeRule(const Parser &parser, const std::string &path, const std::string &file_name)
bool GenerateTS(const Parser &parser, const std::string &path, const std::string &file_name)
bool GenerateJsonSchema(const Parser &parser, std::string *json)
bool IsVector(const Type &type)
bool IsEnum(const Type &type)
bool GeneratePhp(const Parser &parser, const std::string &path, const std::string &file_name)
bool EqualByName(const Type &a, const Type &b)
bool GenerateLua(const Parser &parser, const std::string &path, const std::string &file_name)
std::string DartMakeRule(const Parser &parser, const std::string &path, const std::string &file_name)
bool GenerateBinary(const Parser &parser, const std::string &path, const std::string &file_name)
loco::GraphInputIndex index(const TFPlaceholder *node)
bool optional(bool is_optional)
convert option overview for Option constructor
bool operator==(const std::vector< T > &lhs, const std::vector< T > &rhs)
Compare elements of two vectors.