How to retrieve a proto file "option" from within a c++ program?

20 views
Skip to first unread message

Bruce Buffam

unread,
Mar 24, 2017, 8:38:52 AM3/24/17
to grpc.io
I have a sequence of the following expressions in my proto file as follows:
...

extend google.protobuf.FileOptions {

     // The foo service semantic version
     string foo_service = 1001;
}

option (foo_service) = "1.1.0";
...

Is there a c++ code snippet somewhere that shows how to retrieve the value of foo_service?

Rgds,
Bruce


Christian Rivasseau

unread,
Mar 24, 2017, 8:41:43 AM3/24/17
to Bruce Buffam, grpc.io
I've got this for a field option, file should be fairly similar  (using Message::descriptor()->file())

if (field->options().HasExtension(the_option)) {
    return field->options().GetExtension(the_option);
  }

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/30815ca5-8f6a-436a-a9b9-9bdb284c20ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Christian Rivasseau
Co-founder and CTO @ Lefty
+33 6 67 35 26 74
Reply all
Reply to author
Forward
0 new messages