mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-27 15:02:18 +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
59
tests/prototest/test_suffix.golden
Normal file
59
tests/prototest/test_suffix.golden
Normal file
@@ -0,0 +1,59 @@
|
||||
// Generated from test.proto
|
||||
|
||||
namespace proto.test.test_namespace_suffix;
|
||||
|
||||
/// Enum doc comment.
|
||||
enum ProtoEnum : int {
|
||||
NUL = 0,
|
||||
FOO = 1,
|
||||
/// Enum 2nd value doc comment misaligned.
|
||||
BAR = 5,
|
||||
}
|
||||
|
||||
table ImportedMessage {
|
||||
a:int;
|
||||
}
|
||||
|
||||
/// 2nd table doc comment with
|
||||
/// many lines.
|
||||
table ProtoMessage {
|
||||
c:int = 16;
|
||||
d:long;
|
||||
p:uint;
|
||||
e:ulong;
|
||||
/// doc comment for f.
|
||||
f:int = -1;
|
||||
g:long;
|
||||
h:uint;
|
||||
q:ulong;
|
||||
i:int;
|
||||
j:long;
|
||||
/// doc comment for k.
|
||||
k:bool;
|
||||
/// doc comment for l on 2
|
||||
/// lines
|
||||
l:string (required);
|
||||
m:[ubyte];
|
||||
n:proto.test.test_namespace_suffix.ProtoMessage_.OtherMessage;
|
||||
o:[string];
|
||||
z:proto.test.test_namespace_suffix.ImportedMessage;
|
||||
/// doc comment for r.
|
||||
r:proto.test.test_namespace_suffix.ProtoMessage_.Anonymous0;
|
||||
}
|
||||
|
||||
namespace proto.test.test_namespace_suffix.ProtoMessage_;
|
||||
|
||||
table OtherMessage {
|
||||
a:double;
|
||||
/// doc comment for b.
|
||||
b:float = 3.14149;
|
||||
}
|
||||
|
||||
table Anonymous0 {
|
||||
/// doc comment for s.
|
||||
s:proto.test.test_namespace_suffix.ImportedMessage;
|
||||
/// doc comment for t on 2
|
||||
/// lines.
|
||||
t:proto.test.test_namespace_suffix.ProtoMessage_.OtherMessage;
|
||||
}
|
||||
|
||||
63
tests/prototest/test_union_suffix.golden
Normal file
63
tests/prototest/test_union_suffix.golden
Normal file
@@ -0,0 +1,63 @@
|
||||
// Generated from test.proto
|
||||
|
||||
namespace proto.test.test_namespace_suffix;
|
||||
|
||||
/// Enum doc comment.
|
||||
enum ProtoEnum : int {
|
||||
NUL = 0,
|
||||
FOO = 1,
|
||||
/// Enum 2nd value doc comment misaligned.
|
||||
BAR = 5,
|
||||
}
|
||||
|
||||
namespace proto.test.test_namespace_suffix.ProtoMessage_;
|
||||
|
||||
union RUnion {
|
||||
/// doc comment for s.
|
||||
proto.test.test_namespace_suffix.ImportedMessage,
|
||||
/// doc comment for t on 2
|
||||
/// lines.
|
||||
proto.test.test_namespace_suffix.ProtoMessage_.OtherMessage,
|
||||
}
|
||||
|
||||
namespace proto.test.test_namespace_suffix;
|
||||
|
||||
table ImportedMessage {
|
||||
a:int;
|
||||
}
|
||||
|
||||
/// 2nd table doc comment with
|
||||
/// many lines.
|
||||
table ProtoMessage {
|
||||
c:int = 16;
|
||||
d:long;
|
||||
p:uint;
|
||||
e:ulong;
|
||||
/// doc comment for f.
|
||||
f:int = -1;
|
||||
g:long;
|
||||
h:uint;
|
||||
q:ulong;
|
||||
i:int;
|
||||
j:long;
|
||||
/// doc comment for k.
|
||||
k:bool;
|
||||
/// doc comment for l on 2
|
||||
/// lines
|
||||
l:string (required);
|
||||
m:[ubyte];
|
||||
n:proto.test.test_namespace_suffix.ProtoMessage_.OtherMessage;
|
||||
o:[string];
|
||||
z:proto.test.test_namespace_suffix.ImportedMessage;
|
||||
/// doc comment for r.
|
||||
r:proto.test.test_namespace_suffix.ProtoMessage_.RUnion;
|
||||
}
|
||||
|
||||
namespace proto.test.test_namespace_suffix.ProtoMessage_;
|
||||
|
||||
table OtherMessage {
|
||||
a:double;
|
||||
/// doc comment for b.
|
||||
b:float = 3.14149;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user