Reading FileOptions extension in C++?

21 views
Skip to first unread message

Colin McInnes

unread,
Sep 14, 2022, 5:09:16 PMSep 14
to Protocol Buffers
I know how to read an option within Message by using GetExtension on the Message, but can I do that for a global option that is not encapsulated within a message?

So in C++, how would I read the "my_file_name" option from the proto below?

extend google.protobuf.FileOptions {
  string my_file_name = 1001;
}

extend google.protobuf.MessageOptions {
  optional string my_option = 51234;
}

option (my_file_name) = "filename.txt";

message MyMessage {
  option (my_option) = "Hello world!";
}


sh...@google.com

unread,
Sep 20, 2022, 6:40:03 PMSep 20
to Protocol Buffers
I believe there's `msg->file()->options()->getExtensions(...)`
Reply all
Reply to author
Forward
0 new messages