From 87a18f37743efde6f66f77209c98400cdec67cbe Mon Sep 17 00:00:00 2001 From: Chris Fallin Date: Wed, 14 Jan 2015 11:18:20 -0800 Subject: Support oneof defs in upb. This change adds support for a OneofDef (upb_oneofdef), which represents a 'oneof' as introduced by Protocol Buffers. This is semantically a union type that contains fields and in turn may be added to a MessageDef. This change does not alter parsing or the handler abstraction in any way, because a oneof has impact only at a higher semantic level (i.e., any sort of storage of the fields in a message object), which is user-specific with respect to upb. --- upb/bindings/googlepb/bridge.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'upb/bindings/googlepb') diff --git a/upb/bindings/googlepb/bridge.cc b/upb/bindings/googlepb/bridge.cc index 6ae8868..2a2bbbf 100644 --- a/upb/bindings/googlepb/bridge.cc +++ b/upb/bindings/googlepb/bridge.cc @@ -246,7 +246,8 @@ const Handlers* CodeCache::GetMaybeUnfrozenWriteHandlers( to_freeze_.push_back(h); const goog::Descriptor* d = m.GetDescriptor(); - for (upb::MessageDef::const_iterator i = md->begin(); i != md->end(); ++i) { + for (upb::MessageDef::const_field_iterator i = md->field_begin(); + i != md->field_end(); ++i) { const FieldDef* upb_f = *i; const goog::FieldDescriptor* proto2_f = -- cgit v1.2.3