Reputation: 51
Generally, I can call the google::protobuf::TextFormat::Parse
to parse a prototxt file into a Message
. But now I have to use MessageLite
for some reason. Since TextFormat takes only Message*, the conversion fails. Is there any way to do this?
Upvotes: 1
Views: 1755
Reputation: 7112
Protobuf Lite does not support reflection, which is needed for implementing human-readable text format parser. Therefore it's not possible to read a message in this format using the Lite version.
Upvotes: 1
Reputation: 26800
The MessageLite
class has a ParseFromString
member with the following signature.
bool MessageLite::ParseFromString(const string & data)
This parses a protocol buffer contained in a string.
For more details, you can refer
to the documentation on this.
Upvotes: 0