I am having the message as
Package letters;
message A
{
message Aa
{
// fields
}
message Aaa
{
// fields
}
repeated Aa AaMessage = 1;
repeated Aaa AaaMessage = 2;
}
message B
{
message Bb
{
// fields
}
message Bbb
{
// fields
}
repeated Bb BbMessage = 1;
repeated Bbb BbbMessage = 2;
}
message alphabet
{
repeated A MessageA = 1;
repeated B MessageB = 2;
}
I have complied the proto file using CPP_OUT. No problem in compiling and serializing the message. I have got the message serialized by using SerializeToString() as..
letters::alphabet letterMessage;
letters::A* aMessageFields = letterMessage->add_messagea();
letters::Aa* aaMessageFields = aMessageFields->add_aamessage();
// set some default values for all fields in message
std::string SerializedMessage;
letterMessage.SerializeToString(&SerializedMessage);
I am also having the JSON serialised message in another std::wstring. I need to pass these two messages as a single value meaning single message. So I tried to concatenate both the string type protobuffer serialized value and the std::wstring JSON serialised value and store the result string in std::string. I have tried many ways. nothing works. :(
std::string SerializedMessage;
std::wstring JSONserializedMessage;
std::string completeMessage;
completeMessage = SerializedMessage + JSONserializedMessage;
//may be this is stupid but i want something really work like this
Please correct me if I got anything wrong here.
Thanks in Advance..