Re: _has_bits_ and field bit definitions generated by protoc

2009-02-23 Thread Kenton Varda
You could query the message's Descriptor to find out the field number and index of each field, and then use one of those (probably the index). const Descriptor* descriptor = message.GetDescriptor() int foo_index = descriptor->FindFieldByName("foo")->index(); On Mon, Feb 23, 2009 at 7:42 PM, Ti

Re: _has_bits_ and field bit definitions generated by protoc

2009-02-23 Thread Tim
OK, thanks. Just to clarify, I don't want access to _has_bits_, but just to the definition of which bit position corresponds to which field in the message. I.e., I want the compiler to do this: #define ATTR1_BIT 1 ... _has_bit(ATTR1_BIT); instead of this: _has_bit(1); Then my application can u

Re: _has_bits_ and field bit definitions generated by protoc

2009-02-23 Thread Kenton Varda
Hi Tim, On Mon, Feb 23, 2009 at 7:01 PM, wrote: > > In my application, I have a need to track characteristics of message > fields on a field-by-field basis, e.g. has this field changed. This is > very much like what is already done in libprotobuf code for tracking > whether a field has been set