One thing that might help is to use a FieldMask
<https://github.com/google/protobuf/blob/8aa927f08f6b92808976b0c22fa4a45850279987/src/google/protobuf/field_mask.proto#L42>,
since that can essentially represent the kind of path string you mentioned.
You can then use FieldMaskUtil::MergeMessageTo
<https://github.com/google/protobuf/blob/8aa927f08f6b92808976b0c22fa4a45850279987/src/google/protobuf/util/field_mask_util.h#L124>
to update just the fields identified by the field mask.

On Thu, Apr 13, 2017 at 8:25 PM, Trung Hoang Nguyen <
[email protected]> wrote:

> Hi everyone,
>
> I'm newbie of Google buffer protocol, and now I have an issue as below:
> I have a path string and value like that:
>
>> path_string = "classA.classB.classC.foo_variable ";
>> set_value = 1000;
>
>
> a common set function:
>
>> void set(path_string, set_value);
>
>
> and some messages:
>
> message classA {
>> ...
>> classB = 1;
>> }
>> message classB {
>> ...
>> classC =1;
>> }
>> message classC {
>> ...
>> int foo_variable = 10;
>> }
>
>
> Now with the path_string I need to find out the foo_variable and set its
> value to 1000.
> How can I do it with google buffer protocol?
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to