Re: [protobuf] Enumerating a variable's fields and setting them

2021-06-22 Thread J G
;os"); > Message* os = > health_report->GetReflection()->MutableMessage(health_report, os_field); > const FieldDescriptor* version_field = > os->GetDescriptor()->FindFieldByName("version"); > os->GetReflection()->SetEnumValue(os, version_field, 3); > &

Re: [protobuf] Enumerating a variable's fields and setting them

2021-06-22 Thread J G
he message and look at > the descriptors at the same time. > > On Tue, Jun 22, 2021 at 10:58 AM J G wrote: > >> Hi Adam, >> >> That works for the first iteration, but I descend the tree like so: >> >> bool enumpb( const char * pszpath, ENUMPROTOPROC f, const >>

Re: [protobuf] Enumerating a variable's fields and setting them

2021-06-22 Thread J G
y, 22 June 2021 at 13:47:15 UTC-4 acoz...@google.com wrote: > I think the easiest thing would be that wherever you're now storing a > google::protobuf::FieldDescriptor*, you can also store a > google::protobuf::Message* pointing to the parent message. > > On Tue, Jun 22, 2

Re: [protobuf] Enumerating a variable's fields and setting them

2021-06-22 Thread J G
don't need to save the descriptor for each leaf, but > you do need to save a pointer to the message containing each leaf. > > On Tue, Jun 22, 2021 at 10:17 AM J G wrote: > >> Hi again Adam, and thank you for taking the time to help me. >> >> Maybe I haven't explained what I a

Re: [protobuf] Enumerating a variable's fields and setting them

2021-06-22 Thread J G
points to a vafmsg.HealthReport but the > field descriptor refers to a field in another message > (vafmsg.HardwareComponent). > > On Tue, Jun 22, 2021 at 7:42 AM J G wrote: > >> Hello Adam, >> >> OK, I understand, so I've tried this, but I get an error. >> >> vo

Re: [protobuf] Enumerating a variable's fields and setting them

2021-06-22 Thread J G
::Get* and > Reflection::Set* methods to get and set particular fields. > > On Fri, Jun 18, 2021 at 9:11 AM J G wrote: > >> Hi, >> >> I've got some code that lets me recursively walk a protobuf variable. >> >> That part works, I can enumerate the charact

[protobuf] Enumerating a variable's fields and setting them

2021-06-18 Thread J G
Hi, I've got some code that lets me recursively walk a protobuf variable. That part works, I can enumerate the characteristics of a variable, but the pointers/references returned by the API are const. My question is: From a variable's Descriptor or FieldDescriptor, is it possible to get a