jeudi 27 août 2015

Can't convert form "std::string" to "std::wstring"?

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);
std::wstring serialisedvaluestrore = SerializedMessage;
// which is not working for me

In my case I have to pass the SerializedMessage which is a protobuf serialized message containing the unicode characters which is also string to the std::wstring. But I could not pass the serialized value to the wstring type. Is there any method we can do this ? Please correct me if I got anything wrong here.

Thanks in Advance..

Aucun commentaire:

Enregistrer un commentaire