using google::protobuf::Descriptor;
using google::protobuf::FieldDescriptor;
using google::protobuf::EnumDescriptor;
using google::protobuf::EnumValueDescriptor;

const Descriptor* descriptor = message.GetDescriptor();for (int i = 0; i <
descriptor->field_count(); i++) {
  const FieldDescriptor* field = descriptor->field(i);
  if (field->type() == FieldDescriptor::TYPE_ENUM) {
    // this is an enum field.
    const EnumDescriptor* type = field->enum_type();
    for (int j = 0; j < type->value_count(); j++) {
      const EnumValueDescriptor* value = type->value(i);
      // value->name() and value->number() describe this value.
    }
  }
}

On Fri, Oct 2, 2009 at 8:23 AM, Tuppy Hamper <hamp...@gmail.com> wrote:

>
> is it possible to dynmically get allthe enum fields associated with a
> protocol buffer message and all the valid values defined in that enum
> fields?
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to