mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 04:04:19 +00:00
(Optionally) add an additional suffix namespace to generated fbs files. (#5698)
This change allows for the generation of fbs files (from proto) that don't contain name collisions with the protobuf generated C++ code, allowing both the proto and fbs message types to be linked into the same binary.
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
35daaf83d3
commit
21b7061963
@@ -134,6 +134,8 @@ std::string FlatCompiler::GetUsageString(const char *program_name) const {
|
||||
" This may crash flatc given a mismatched schema.\n"
|
||||
" --size-prefixed Input binaries are size prefixed buffers.\n"
|
||||
" --proto Input is a .proto, translate to .fbs.\n"
|
||||
" --proto-namespace-suffix Add this namespace to any flatbuffers generated\n"
|
||||
" SUFFIX from protobufs.\n"
|
||||
" --oneof-union Translate .proto oneofs to flatbuffer unions.\n"
|
||||
" --grpc Generate GRPC interfaces for the specified languages.\n"
|
||||
" --schema Serialize schemas instead of JSON (use with -b).\n"
|
||||
@@ -299,6 +301,9 @@ int FlatCompiler::Compile(int argc, const char **argv) {
|
||||
binary_files_from = filenames.size();
|
||||
} else if (arg == "--proto") {
|
||||
opts.proto_mode = true;
|
||||
} else if (arg == "--proto-namespace-suffix") {
|
||||
if (++argi >= argc) Error("missing namespace suffix" + arg, true);
|
||||
opts.proto_namespace_suffix = argv[argi];
|
||||
} else if (arg == "--oneof-union") {
|
||||
opts.proto_oneof_union = true;
|
||||
} else if (arg == "--schema") {
|
||||
|
||||
Reference in New Issue
Block a user