You can easily implement your own text format by writing code based on protobuf reflection. In fact, the official TextFormat class is based on reflection. So take a look at the code for the TextFormat class and write something like that with whatever modifications you need. On Fri, Apr 3, 2009 at 5:25 AM, <voodooha...@gmail.com> wrote:
> > Hi, > > I'm currently using protocol buffers files in text format. While it's > a very easy format to use and understand I think it's need more > flexibility. > > For example if I want to define a structure for a index array I have > to do this : > > // definitions > message IndexArray { > repeated int32 index = 1; > } > > message SomeStruct { > optional IndexArray indices = 1; > } > > > // data in text format > indices { > index: 15 > index: 1 > index: 65 > index: 44 > index: 2 > index: 78 > ... > } > > As you can see 'index' is repeated as many times as you need a single > value. > What I would like is something like this : > > // data in text format > indices { > index: { 15, 1, 65, 44, 2, 78, ... } > } > > The compact format would be defined in some way like this : > > // definition > message IndexArray { > repeatedarray int32 index = 1 [separator = ","]; > } > > I still don't know repeatedarray would work with message data.... > > (Sorry for my english) > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~----------~----~----~----~------~----~------~--~---