1. For the person example, I create a descriptor as follows:
"E:\Desktop\prototype_MAIN\protoc.exe" person.proto --
descriptor_set_out=msg.protocomp

2. I create a Person object and serialized it to file. "person.pb"

3. I want to write a program to "print" the Person object using ONLY
its descriptor. I know there is a way, but I cannot seem to get all
the APIs correct.

4. Here is what I have done.
        ifstream desc_file("E:\\Visual Studio 2008\\Projects\
\proto_buf1\\msg.protocomp",ios::in);
        if (desc_file.bad()) {
                std::cout << "desc file not read...exiting" << std::endl;
                return -1;
        }

        FileDescriptorSet f;
        f.ParseFromIstream(&desc_file);
        f.PrintDebugString();

        FileDescriptorProto fdp = f.file(0);
        fdp.PrintDebugString();

        DescriptorProto dp = fdp.message_type(0);
        dp.PrintDebugString();


Now what ? I need a copy of "Message" that I can pass as input to
Parse, I think. I also may need DynamicMessage etc, and possibly also
the following:

        ifstream input_file("E:\\Visual Studio 2008\\Projects\
\proto_buf1\\Debug\\person.pb",ios::in);
        if (input_file.bad()) {
                std::cout << "file not read...exiting" << std::endl;
                return -1;
        }

        IstreamInputStream is(&input_file);

        TextFormat::Parse(&is,(msg));
        msg->PrintDebugString();


Any simple example is GREATLY appreciated. Thanks.

-- 
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.

Reply via email to