mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 04:04:19 +00:00
merge
This commit is contained in:
@@ -90,13 +90,15 @@ static void Error(const std::string &err, bool usage, bool show_exe_name) {
|
||||
" --defaults-json Output fields whose value is the default when\n"
|
||||
" writing JSON\n"
|
||||
" --no-prefix Don\'t prefix enum values with the enum type in C++.\n"
|
||||
" --gen-includes Generate include statements for included schemas the\n"
|
||||
" generated file depends on (C++).\n"
|
||||
" --gen-includes (deprecated), instead use:\n"
|
||||
" --no-includes Don\'t generate include statements for included\n"
|
||||
" schemas the generated file depends on (C++).\n"
|
||||
" --gen-mutable Generate accessors that can mutate buffers in-place.\n"
|
||||
" --gen-onefile Generate single output file for C#\n"
|
||||
" --raw-binary Allow binaries without file_indentifier to be read.\n"
|
||||
" This may crash flatc given a mismatched schema.\n"
|
||||
" --proto Input is a .proto, translate to .fbs.\n"
|
||||
" --schema Serialize schemas instead of JSON (use with -b)\n"
|
||||
"FILEs may depend on declarations in earlier files.\n"
|
||||
"FILEs after the -- must be binary flatbuffer format files.\n"
|
||||
"Output files are named using the base file name of the input,\n"
|
||||
@@ -117,6 +119,7 @@ int main(int argc, const char *argv[]) {
|
||||
bool print_make_rules = false;
|
||||
bool proto_mode = false;
|
||||
bool raw_binary = false;
|
||||
bool schema_binary = false;
|
||||
std::vector<std::string> filenames;
|
||||
std::vector<const char *> include_directories;
|
||||
size_t binary_files_from = std::numeric_limits<size_t>::max();
|
||||
@@ -140,7 +143,10 @@ int main(int argc, const char *argv[]) {
|
||||
} else if(arg == "--gen-mutable") {
|
||||
opts.mutable_buffer = true;
|
||||
} else if(arg == "--gen-includes") {
|
||||
opts.include_dependence_headers = true;
|
||||
// Deprecated, remove this option some time in the future.
|
||||
printf("warning: --gen-includes is deprecated (it is now default)\n");
|
||||
} else if(arg == "--no-includes") {
|
||||
opts.include_dependence_headers = false;
|
||||
} else if (arg == "--gen-onefile") {
|
||||
opts.one_file = true;
|
||||
} else if (arg == "--raw-binary") {
|
||||
@@ -150,6 +156,8 @@ int main(int argc, const char *argv[]) {
|
||||
} else if(arg == "--proto") {
|
||||
proto_mode = true;
|
||||
any_generator = true;
|
||||
} else if(arg == "--schema") {
|
||||
schema_binary = true;
|
||||
} else if(arg == "-M") {
|
||||
print_make_rules = true;
|
||||
} else {
|
||||
@@ -216,6 +224,10 @@ int main(int argc, const char *argv[]) {
|
||||
if (!parser.Parse(contents.c_str(), &include_directories[0],
|
||||
file_it->c_str()))
|
||||
Error(parser.error_, false, false);
|
||||
if (schema_binary) {
|
||||
parser.Serialize();
|
||||
parser.file_extension_ = reflection::SchemaExtension();
|
||||
}
|
||||
include_directories.pop_back();
|
||||
include_directories.pop_back();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user