I write test code following below.
t2r::prot::Request msg0, msg2, msg3, msg4;
std::string s;
// set all fields of msg.
.....
.....
bool b;
b = msg0.SerializeToString(&s); // OK
msg0.PrintDebugString();
b = msg2.ParseFromString(s); // OK
b = msg2.IsInitialized(); // OK
msg0.PrintDebugString();
for(int i= 0; i < s.size(); ++i)
{
char c = s[i];
std::cout << "============== " << i << " ====================="
<<
std::endl;
google::protobuf::io::ArrayInputStream inp(&c, 1);
google::protobuf::io::CodedInputStream decoder(&inp);
b = msg3.MergeFromCodedStream(&decoder); // FAILED
msg3.PrintDebugString();
std::cout << "********************************" << std::endl;
b = msg4.MergePartialFromCodedStream
(&decoder); // OK
msg4.PrintDebugString();
b = msg4.IsInitialized(); // FAILED
}
b = msg3.IsInitialized(); // FAILED
b = msg4.IsInitialized(); // FAILED
I want parsing string 's' by reading each a byte from s.
What is wrong.
Please help me.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---