The descriptor itself contains a list of all of the defined fields for the
type.  E.g.:
  const Descriptor* type = message->GetDescriptor();
  for (int i = 0; i < type->field_count(); i++) {
    const FieldDescriptor* field = type->field(i);
    // handle field

On Tue, Apr 14, 2009 at 6:09 PM, Joe <> wrote:

> I'm using the TextFormat provided by protocol buffers to read in and
> print out messages in ... text format.  I have a lot of optional
> fields with defaults in my .proto file.  When I do a
> TextFormat::Print, only set values are printed.  I'd like
> TextFormat::Print to also print unset values.  Am I crazy?
> I tried to figure out a way to do this using the reflection API, but
> it seems to only provide a way to list the set fields of a message.
> Is there any other way to do this?
> >

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to