I have made a simple protobuf file to reproduce my problem:
syntax = "proto3";
package proto;
message Test {
uint32 test1 = 1;
oneof param {
uint32 test2 = 2;
bool test3 = 3;
}
}
When I generate the c++ code the oneof's has_param()
member function is private. Is it normal ? How do I know if the oneof is set ?
By the way I tried with protobuf 3.12.4 and 3.21.9 and got the same result.
Refer to the documentation for Protobuf C++ generated code.
The generator creates a method param_case()
, which returns enumeration type that identifies which field inside the oneof
is present. If the oneof
is empty, it returns PARAM_NOT_SET
.