Thanks Jason. That worked perfectly.
On Feb 22, 12:43 pm, Jason Hsueh <[email protected]> wrote: > Oops, actually you'll need to recursively copy the dependencies into the > FileDescriptorSet. > > > > > > > > On Wed, Feb 22, 2012 at 9:42 AM, Jason Hsueh <[email protected]> wrote: > > You can use something like the code below. FileDescriptor's interface has > > methods to produce the FileDescriptorProto; you just need to walk the > > dependencies. > > > FileDescriptorSet output; > > const FileDescriptor* file_desc = ConcreteMessage::descriptor()->file(); > > for (int i = 0; i < file_desc->dependency_count(); ++i) { > > file_desc->dependency(i)->CopyTo(output.add_file()); > > } > > file_desc->CopyTo(output.add_file()); > > > On Mon, Feb 13, 2012 at 7:52 AM, msr <[email protected]> wrote: > > >> Hi, > >> For a message that is compiled into the binary, is there any way to > >> generate the FileDescriptorSet given the ConcreteMessage object (i.e. > >> the same output that protoc would generate for the proto file)? > >> Basically a way to serialize the FileDescriptor that we get from a > >> Concrete Message to a stream that can loaded back when reading. > > >> I am writing a simple wrapper to store a message to file. I would like > >> to also save the FileDescriptorSet for that message into the same file > >> so that users can read the file without having to have the message > >> compiled in during read phase or have seperate file with > >> FileDescriptoSet. If possible, I would like the users not having to > >> know anything about generating FileDescriptorSet. > > >> Thanks, > >> MSR > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Protocol Buffers" group. > >> To post to this group, send email to [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]. > >> For more options, visit this group at > >>http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
