Yes, that is correct that I have a file that is encoded with protobuf. I need to both read and write this file type. I'll use the tools as you mentioned and see what I come up with.
The code that I have doesn't have the generated comments, just user comments. I don't know how to replicated the same class structure in the proto file based on the code that I have. On Sunday, October 14, 2018 at 11:29:11 AM UTC-7, Adam Cozzette wrote: > > Do I understand right that you have a raw data file encoded in the > protobuf binary format? Are you just trying to read that one file, or do > you want to be able to read and write other files with that same message > type? > > One quick thing you can do is pipe the raw data to protoc --decode_raw. > That will give you an incomplete view of the data because protoc can't > fully interpret it without knowing the schema, but it could at least give > you a rough idea of what the data contains. If you want to recreate the > .proto file from the pb.h and pb.cc files, that should be fairly easy to > do--you can look in the generated pb.h file and just look at the comments > next to the field accessors. That should tell you the type and field number > associated with each field. > > On Sat, Oct 13, 2018 at 12:02 AM Steven Lutz <[email protected] > <javascript:>> wrote: > >> I'm working with a file that was created using protocol buffers. the >> application that writes these files was written in c++. I put in a request >> to the 3rd party that created this software to get the file definition/spec >> and I was given the c++ code/header file. (not the entire application) >> I'm having some trouble understanding the structure defined in the code >> (i'm c++ rusty) so I was thinking that if there was a way to recreate the >> c++ code using a protofile I'd have the generated example code to go along >> with it. The original author doesn't seem to know anything about a >> protofile which makes me wonder how it was all created in the first place. >> >> I figure I can either: >> Try to untangle this confusion without a protofile, >> or >> Figure out how to create the protofile from the code I was given. >> >> Can someone shed some advice on this? >> Thank you >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Protocol Buffers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at https://groups.google.com/group/protobuf. >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
