I'm not sure I understand your question.  Why is the constness a problem?
 It has to be const because descriptor pointers are always const (because
they are immutable objects).

Here is how you would use SetEnum() to set a field called "foo" to the enum
value "BAR":

  const FieldDescriptor* field =
    message.GetDescriptor()->FindFieldByName("foo");
  const EnumValueDescriptor* value =
    field->enum_type()->FindValeByName("BAR");
  message.GetReflection()->SetEnum(&message, field, value);

On Mon, Feb 8, 2010 at 12:12 AM, read.the news <[email protected]>wrote:

> Hi guys,
>
> From the API docs, reflection class offers setEnum() method which
> needs an EnumValueDescriptor as argument. This argument cannot be set
> due to the const-ness of the EnumValueDescriptor.
>
> Is there a way to set an enum value through reflection?
>
> Thank you,
> Alex.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<protobuf%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

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

Reply via email to