JimmyY
JimmyY

Reputation: 31

C++ protobuf SerializedData

I need to get serializedData (like in C#) in C++ for google::protobuf::FileDescriptor object.

In C++ code I have google::protobuf::FileDescriptor object. And I need to get something like ByteString SerializedData in C# (The original serialized binary form of this descriptor.)

Does anyone know how to do it? Thank you.

Upvotes: 0

Views: 530

Answers (1)

Thomas
Thomas

Reputation: 181705

You can use FileDescriptor::CopyTo(FileDescriptorProto * proto) to copy the contents to a FileDescriptorProto, which is a regular Message that you can serialize using any of the SerializeTo... functions.

Upvotes: 1

Related Questions