I have some code set up like this:
const Descriptor* msg_desc = pool->FindMessageTypeByName(class_name);
DynamicMessageFactory dmf;
Message* dm = dmf.GetPrototype(msg_desc)->New();
string str(serialized, length);
bool success = dm->ParseFromString(str);

which outputs the DebugString:
1: Kimberly Ann Hart
2: Amy Jo Johnson
3: Pink

rather than
CharacterName: Kimberly Ann Hart
ActressName: Amy Jo Johnson
Color: Pink

I've noticed that if I get the descriptor use the types provided by the 
compiled file, e.g. 
PowerRanger pr;
const Descriptor* msg_desc = pr.GetDescriptor();

The debug string will not have any unknown fields.  I've checked the pool, 
which has the file "powerranger.proto," which leads me to believe that 
FindMessageTypeByName is losing info.  However,
the source says:
// These find descriptors by fully-qualified name.  These will find both
// top-level descriptors and nested descriptors.  They return NULL if not
// found.

Does anyone know why this is happening or how I can get the full 
DebugString() dynamically?

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

Reply via email to