[protobuf] Repeated combined with Required

2013-10-08 Thread Dror Cohen
Hi, if I have a field that is required to show at least 1 time but can occur a few times - What's the expected decleration in the proto file? I can think of the following options: 1. Just using repeated isn't good enough - it has to appear at least once. 2. Use first option and force a check in

Re: [protobuf] Repeated combined with Required

2013-10-08 Thread Ilia Mirkin
Protobuf is about serializing and deserializing data, not enforcing restrictions on it. (required being the odd case there, and it is often recommended that you avoid it.) Using repeated in the spec, and then enforcing any additional restrictions in your code is the preferred way to go. That way,

[protobuf] Newbie question about union types

2013-10-08 Thread Howard Lander
Hi all Please excuse this question from a newcomer; any assistance is greatly appreciated. I have the following 2 .proto files that I want to use to generate c++ code: create.proto: package proto; message CreateRequest { required string resource_type = 1; required string request_type =

Re: [protobuf] Newbie question about union types

2013-10-08 Thread Howard
OK, well you can really excuse me now, as I think I figured this out. Looks like I use the mutable_create_request method to access the create_request message, then I can use the accessors from that class to set the fields. I was expecting to create my own class, then somehow add that class

Re: [protobuf] Newbie question about union types

2013-10-08 Thread Feng Xiao
See the section of Singular Embedded Message Fields: https://developers.google.com/protocol-buffers/docs/reference/cpp-generated#fields On Tue, Oct 8, 2013 at 10:58 AM, Howard Lander how...@renci.org wrote: Hi all Please excuse this question from a newcomer; any assistance is greatly

Re: [protobuf] Newbie question about union types

2013-10-08 Thread Jie Luo
If you want a similar way of set_ function, you could use mutable_ and CopyFrom https://cs.corp.google.com/#piper///depot/google3/net/proto2/public/message.hl=158 Or set_allocated_ 2013/10/9 Howard how...@renci.org: OK, well you can really excuse me now, as I think I figured this out. Looks