I would like to check (via reflection) whether a particular field within a 
oneof. This is the example message:

message Foo {
   oneof Bar {
      int32 A = 1;
      string B = 2;
   }
}



I browse through the .h and it seems like the only plausible check is to 
examine it via Foo.GetReflection->HasOneof(), but I found it hardcoded as 
false in message.h:

class LIBPROTOBUF_EXPORT Reflection {
 public:
 ...
  // Check if the oneof is set. Returns true if any field in oneof
  // is set, false otherwise.
  // TODO(jieluo) - make it pure virtual after updating all
  // the subclasses.
  virtual bool HasOneof(const Message& /*message*/,
                        const OneofDescriptor* /*oneof_descriptor*/) const {
    return false;
  }
 ...
}

Am I missing something? 

-- 
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 https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to