mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-10 23:17:27 +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
@@ -63,6 +63,13 @@ std::string GenerateFBS(const Parser &parser, const std::string &file_name) {
|
||||
for (size_t i = 0; i < ns.from_table; i++) {
|
||||
ns.components[ns.components.size() - 1 - i] += "_";
|
||||
}
|
||||
|
||||
if (parser.opts.proto_mode && !parser.opts.proto_namespace_suffix.empty()) {
|
||||
// Since we know that all these namespaces come from a .proto, and all are
|
||||
// being converted, we can simply apply this suffix to all of them.
|
||||
ns.components.insert(ns.components.end() - ns.from_table,
|
||||
parser.opts.proto_namespace_suffix);
|
||||
}
|
||||
}
|
||||
|
||||
std::string schema;
|
||||
|
||||
Reference in New Issue
Block a user