Ooops! I mixed up my mailing lists. Sigh. Someone recently wrote something similar internally but it has not made it into a public release. That's what I was referring to. We should probably get more of our random utility code out into the open. :/
On Fri, Dec 4, 2009 at 3:06 PM, Kenton Varda <[email protected]> wrote: > How does this differ from net/proto2/util/public/field_path.h? > > > On Fri, Dec 4, 2009 at 2:17 PM, Scott Stafford > <[email protected]>wrote: > >> Hi - >> >> We built a simplified XPath-like syntax (and implementation for C++) >> to control the Reflection interface via strings. For instance, >> >> message Substructure >> { >> required int32 id = 10; >> >> required int32 field1 = 1; >> optional int32 field2 = 2; >> repeated int32 field3 = 3; >> } >> >> message Structure >> { >> repeated int32 field1 = 1; >> repeated Substructure field2 = 2; >> } >> >> PBPath::clearField( myMessage, "field2[0]" ); >> >> would basically run myMessage.clear_field2(); >> >> and >> >> PBPath::GetInt32( myMessage, "field2[id=50].field3[1]" ); >> >> would search myMessage.field2() for a message with id()==50, then get >> the second element of Substructure.field3() and return it. >> >> Is this something people would be interested in if I cleaned it up for >> release as a separate library? Is there any interest in me submitting >> a patch to build it in to the protobuf library directly in some form? >> If so, what form? >> >> The implementation involves digesting the xpath-like string into a >> protobuf object that contains field ids and so on. >> >> In case you're interested, our use case involved having a large local >> Protobuf object containing configuration data. We needed a way to >> have a remote process send in commands to clear and update various >> parts of the configuration data object. So it sent the digested xpath >> strings to clear various subtrees or elements. Updating was easy, we >> could simply send in a new object with all the updates set and Merge >> it in... >> >> -- >> >> 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]<protobuf%[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.
