On Thu, Feb 27, 2014 at 11:04 AM,  <[email protected]> wrote:
> Hello,
>
> I have a proto buf file with an enumeration with leading comments.
>
> I do this commands to obtains FileDescriptorSet :
> protoc.exe --cpp_out=proto File.proto --include_imports
> --include_source_info -oFile.desc
>
> I want extract in C++ all enumerations values and its comments from this
> file descriptor.
>
> I can obtain the comments with SourceCodeInfo, I can obtains the name of
> enum value with
> EnumValueDescriptorProto.
>
> But how obtains the comment associated with a value ?
>
> I know do it with a protobuf source file, but with file descriptor I have
> not found how ?

I'm not 100% sure what your input is, but if you can get a
FileDescriptor (which you can obtain from a FileDescriptorProto using
a DescriptorPool, or if it's compiled in, it's much simpler...
message->descriptor->file() should do it), then you can look at all of
its enums by using enum_type(i). This returns an EnumDescriptor, which
in turn lets you get at the EnumValueDescriptors, which in turn have a
name/number.

HTH,

  -ilia

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to