On 21 jul, 00:22, Kenton Varda <[email protected]> wrote:
> IMO you should just include a tag field which contains some unique
> identifier, as described in the docs you cite.

So I just shouldn't have used your extensions mechanism but rather
added to each message a unique id? Adding it now seems duplicate work
since the extension, in my opinion, already make the distinction
between messages. I am just not able to figure out how to query a
message about its extension without knowing all possibilities up
front...

Using the Reflection API could I do something like this?

for each defined extension:
fdExtensions.push_back(msgReflection.findKnownExtensionByName(extensionName));

and then in the parse method

for(int i;i< fdExtensions; i++)
  if(msgReflection.HasField(msg,fdExtensions[i]) {
    Parser p = parsers.get(fdExtensions[i]);
    if(p != null) p.parse()
  }

Or is their a faster way of determining the message's extension?

kind regards

Johan

-- 
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.

Reply via email to