On Wed, Jun 11, 2014 at 7:04 PM, CB <cbrund...@gmail.com> wrote:
>
>
> On Wednesday, June 11, 2014 7:01:42 PM UTC-4, Ilia Mirkin wrote:
>>
>> On Wed, Jun 11, 2014 at 6:54 PM, CB <cbru...@gmail.com> wrote:
>> >
>> > I've got a proto file that looks like this:
>> >
>> > option optimize_for = SPEED;
>> >
>> > package test;
>> >
>> > message KeyedStrings
>> > {
>> >     optional string key = 1;
>> >     repeated string value = 2;
>> > }
>> >
>> > message Map
>> > {
>> >     repeated KeyedStrings map = 1;
>> >     repeated string test = 2;
>> > }
>> >
>> > My problem is that the generated C++ code does not include any methods
>> > that
>> > allow me to add or set the map values. The test field is fine as you can
>> > see
>> > the required methods in the attached files. What am I doing wrong?
>>
>> What method are you expecting to see but isn't there? add_map() seems
>> to be there...
>>
>>   -ilia
>
>
> Yes, but it takes no arguments. There are add_test() methods that take the
> string to add, for example. I expected an add_map() method that took the
> KeyedStrings object to add.

That's not how it works. It returns a KeyedStrings object for you to
modify. Take a look at

https://developers.google.com/protocol-buffers/docs/reference/cpp-generated#fields

Specifically the "Repeated Embedded Message Fields" section.

  -ilia

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to