Save PB schema as a PB Message

37 views
Skip to first unread message

Steve

unread,
Dec 19, 2011, 8:26:46 PM12/19/11
to Protocol Buffers
Has anyone created a new compiler "language type" that saves a PB file
as output? Goal is to use the PB output along actual PB messages
files to create generic a PB message viewer/editor/creator. Seems
simpler then using protoc each time.

An simplified PB message schema for the desired output:

message MessageSchema
{
enum FieldType {
INT32 = 0;
UINT32 = 1;
INT64 = 2;
uiNT64 = 3;
STRING = 4;
ENUM = 5;
NESTED_MESSAGE = 6;

NAME_ENUM = 100;
NAME_NESTED = 101;
}

message Field {
required string name = 1;
required FieldType type = 2;
required int32 number = 3;
}

required string name = 1; // name of message
repeated Field fields = 2; // list of fields in message
}

Daniel Wright

unread,
Dec 19, 2011, 8:34:34 PM12/19/11
to Steve, Protocol Buffers
This is already built in -- see http://code.google.com/apis/protocolbuffers/docs/reference/cpp/google.protobuf.compiler.parser.html (in particular, Parser::Parse), and http://code.google.com/apis/protocolbuffers/docs/reference/cpp/google.protobuf.descriptor.pb.html# for the schema of the output.


--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To post to this group, send email to prot...@googlegroups.com.
To unsubscribe from this group, send email to protobuf+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.


Reply all
Reply to author
Forward
0 new messages