BTW, this also works, assuming cmd is a protoc-generated class:

  const UnknownFieldSet& set = cmd.unknown_fields();

On Thu, Sep 3, 2009 at 9:56 AM, Kenton Varda <[email protected]> wrote:

> You want:
>   const UnknownFieldSet& set = cmd.GetReflection()->GetUnknownFields(cmd);
>
>
> On Thu, Sep 3, 2009 at 4:18 AM, Jesper Eskilson <[email protected]>wrote:
>
>> On Fri, Aug 28, 2009 at 6:42 PM, Kenton Varda<[email protected]> wrote:
>>
>> > To answer your specific question, BTW, yes, you can inspect the contents
>> of
>> > UnknownFieldSet.  Every message object has methods unknown_fields() and
>> > mutable_unkown_fields() which return the UnknownFieldSet.  The API is
>> > described here:
>> >
>> http://code.google.com/apis/protocolbuffers/docs/reference/cpp/google.protobuf.unknown_field_set.html
>>
>> I'm probably missing something, but I get a complation error when
>> trying to access the unknown fields of a message:
>>
>> Error   1       error C2248:
>> 'google::protobuf::UnknownFieldSet::UnknownFieldSet' : cannot access
>> private member declared in class 'google::protobuf::UnknownFieldSet';
>>
>> e:\dev\ide-platform\core\ide\protobuf\src\google/protobuf/unknown_field_set.h(124)
>> : see declaration of
>> 'google::protobuf::UnknownFieldSet::UnknownFieldSet';
>>
>> e:\dev\ide-platform\core\ide\protobuf\src\google/protobuf/unknown_field_set.h(63)
>> : see declaration of
>> 'google::protobuf::UnknownFieldSet'
>> e:\dev\ide-platform\core\ide\CSpyServer\src\model\CssListWindowService.cpp
>>    21
>>
>> The code looks like this:
>>
>> void
>> foo(const cdp::DebugCommand &cmd)
>> {
>>  UnknownFieldSet set = cmd.GetReflection()->GetUnknownFields(cmd);
>> }
>>
>> --
>> /Jesper
>>
>
>

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