So having our classes with attributes in folder how to generate .proto markup files out from them (to get for example C++ code)?
proto file are simple: you add a message for each data structure you want to serialize, then specify a name and a type for each field in the message. Here is the . proto file that defines your messages, addressbook. proto .
Protocol buffers provide a language-neutral, platform-neutral, extensible mechanism for serializing structured data in a forward-compatible and backward-compatible way. It's like JSON, except it's smaller and faster, and it generates native language bindings.
Protobuf encodingA Protobuf message is structured as a collection of key/value pairs, with the numeric tag as the key and the corresponding field as the value.
By "classes with attributes", do you mean attributes suitable for protobuf-net? If so, protobuf-net has a GetProto
method which will provide the schema based on a root type:
string proto = Serializer.GetProto<SomeType>();
Despite the rumors to the contrary, this method in v2 has been re-implemented for quite some time now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With