diff options
author | Wouter van Oortmerssen <wvo@google.com> | 2014-09-22 15:49:43 -0700 |
---|---|---|
committer | Wouter van Oortmerssen <wvo@google.com> | 2014-09-23 14:13:35 -0700 |
commit | 30642c5a6f0fe2728d5b05cd272880d325c18cf6 (patch) | |
tree | a601d192acbad84ae2356c6e17ecefeb730aeee1 /include | |
parent | 517c964fe2099ecc0810db33cfd45b406b3f3132 (diff) | |
download | flatbuffers-30642c5a6f0fe2728d5b05cd272880d325c18cf6.tar.gz flatbuffers-30642c5a6f0fe2728d5b05cd272880d325c18cf6.tar.bz2 flatbuffers-30642c5a6f0fe2728d5b05cd272880d325c18cf6.zip |
Added option to flatc to generate dependent header statements.
Bug: 17322776
Change-Id: I3a4d3cb4ccd40bc3200a87653aa0ab8ecb90ce60
Tested: on Linux.
Diffstat (limited to 'include')
-rw-r--r-- | include/flatbuffers/idl.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/include/flatbuffers/idl.h b/include/flatbuffers/idl.h index 0ab3ae15..9d171e88 100644 --- a/include/flatbuffers/idl.h +++ b/include/flatbuffers/idl.h @@ -282,7 +282,10 @@ class Parser { // include_paths must be nullptr terminated if specified. // If include_paths is nullptr, it will attempt to load from the current // directory. - bool Parse(const char *_source, const char **include_paths = nullptr); + // If the source was loaded from a file and isn't an include file, + // supply its name in source_filename. + bool Parse(const char *_source, const char **include_paths = nullptr, + const char *source_filename = nullptr); // Set the root type. May override the one set in the schema. bool SetRootType(const char *name); @@ -324,6 +327,8 @@ class Parser { std::string file_identifier_; std::string file_extension_; + std::map<std::string, bool> included_files_; + private: const char *source_, *cursor_; int line_; // the current line being parsed @@ -332,8 +337,6 @@ class Parser { std::vector<std::pair<Value, FieldDef *>> field_stack_; std::vector<uint8_t> struct_stack_; - - std::map<std::string, bool> included_files_; }; // Utility functions for multiple generators: @@ -348,6 +351,7 @@ struct GeneratorOptions { int indent_step; bool output_enum_identifiers; bool prefixed_enums; + bool include_dependence_headers; // Possible options for the more general generator below. enum Language { kJava, kCSharp, kMAX }; @@ -356,6 +360,7 @@ struct GeneratorOptions { GeneratorOptions() : strict_json(false), indent_step(2), output_enum_identifiers(true), prefixed_enums(true), + include_dependence_headers(false), lang(GeneratorOptions::kJava) {} }; |