Hi,
so we are somehow back in game. And now I am getting familiar what I have
done more then half a year ago.
So for now I got some basic structure of code that will later be as a
starting point for real implementation. I am trying to do some simple
experiments to see how it works. Though I got problem that even if I get
descriptor I am not getting any data. I have used example from encoding
specification since I needed something really simple.
...
const Descriptor* descriptor =
pool.FindMessageTypeByName("tutorial.Test1");
if (descriptor == NULL)
{
return;
}
DynamicMessageFactory factory;
Message *message = factory.GetPrototype(descriptor)->New();
// Use the message object for parsing/etc.
std::string input_data = "089601";
message->ParseFromString(input_data);
// Access a specific field in the message
for (int i = 0; i < descriptor->field_count(); i++)
{
const FieldDescriptor* field = descriptor->field(i);
switch (field->type())
{
case FieldDescriptor::TYPE_INT32:
{
int nVal = message->GetReflection()->GetInt32(*message,
field);
printf("%d\n", nVal);
break;
}
...
But from reflection I am getting that value is 0. So either I have wrongly
set input data considering that I misunderstand format or there is
something else. Do you have any idea what may be cause?
Thank you in advance for your reply.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.