Protocol Buffer
Protocol Buffer is an actively used application created in 2008.
11Years Old | 7,610Users | 0Jobs |
- Protocol Buffer ranks in the top 10% of languages
- the Protocol Buffer website
- the Protocol Buffer wikipedia page
- Protocol Buffer first appeared in 2008
- See also: xml, thrift, java, csharp, python, go, ruby, objective-c, perl, php, scala, julia
- I have 42 facts about Protocol Buffer. just email me if you need more.
Example code from the web:
message Person { required string name = 1; required int32 id = 2; optional string email = 3; }
Example code from Linguist:
package tutorial; option java_package = "com.example.tutorial"; option java_outer_classname = "AddressBookProtos"; message Person { required string name = 1; required int32 id = 2; optional string email = 3; enum PhoneType { MOBILE = 0; HOME = 1; WORK = 2; } message PhoneNumber { required string number = 1; optional PhoneType type = 2 [default = HOME]; } repeated PhoneNumber phone = 4; } message AddressBook { repeated Person person = 1; }
Example code from Wikipedia:
// polyline.cpp #include "polyline.pb.h" // generated by calling "protoc polyline.proto" Line* createNewLine(const std::string& name) { // create a line from (10, 20) to (30, 40) Line* line = new Line; line->mutable_start()->set_x(10); line->mutable_start()->set_y(20); line->mutable_end()->set_x(30); line->mutable_end()->set_y(40); line->set_label(name); return line; } Polyline* createNewPolyline() { // create a polyline with points at (10,10) and (20,20) Polyline* polyline = new Polyline; Point* point1 = polyline->add_point(); point1->set_x(10); point1->set_y(10); Point* point2 = polyline->add_point(); point2->set_x(20); point2->set_y(20); return polyline; }Edit
Last updated February 11th, 2019