Unfortunately no.. You could, however, put the Emessages opCode in the
MsgFirst message (instead of in the MsgHeader). Then you can specify the
default value for the EMessages to MSG_FIRST.

On Tue, Jul 10, 2012 at 10:06 PM, Barzo <[email protected]> wrote:

> Hi,
> I'm new to PB and I would ask a simple thing...
> I've already read the 'Techniques' page but, if I want to do the following:
>
> enum EMessages
> {
>   MSG_FIRST;
>   MSG_SECOND;
> }
>
> message MsgHeader
> {
>   required FileDescriptorSet proto_files = 1;
>   required string type_name = 2;
>
>   required EMessages opCode = 3;
> }
>
> message MsgFirst
> {
>   required MsgHeader Header = 1;
>
> *  // Here would be nice to do*
> *  Header.opCode = MSG_FIRST;*
>
>   required int MyData = 2;
> }
>
> Is there a way to assign a constant to a message field?
>
> Thanks in advance,
> Daniele.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/protobuf/-/elpUPyh_ACEJ.
> 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.
>

-- 
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