Where is the (meta) .proto file which describes .d

2019-07-12 09:06发布

Where is the (meta) .proto file which describes .desc files?

I make .desc files with:

protoc --descriptor_set_out=foo.desc --include_imports foo.proto

Am I correct in believing that the .desc files are in protobuf format?

If so, where can I get the .proto file which describes their format?

3条回答
再贱就再见
2楼-- · 2019-07-12 09:21

If you install protocol buffers, the definition is in

   <PB install directory>/src/google/protobuf/descriptor.proto

Some/Most of the Instalation processes (e.g. Java) will "Generate" pb classes from this definition.

As keton said it is also available at

https://code.google.com/p/protobuf/source/browse/trunk/src/google/protobuf/descriptor.proto

查看更多
SAY GOODBYE
4楼-- · 2019-07-12 09:33

The format is FileDescriptorSet as defined in descriptor.proto:

https://code.google.com/p/protobuf/source/browse/trunk/src/google/protobuf/descriptor.proto

descriptor.proto is typically installed to /usr/include/descriptor.proto or /usr/local/include/descriptor.proto on Unix systems. descriptor.pb.h is installed with the protobuf headers and descriptor.pb.cc is compiled into the protobuf library, so you don't have to generate them yourself if you are using C++. Similarly, in Java, the com.google.protobuf.DescriptorProtos class is compiled into the base library.

查看更多
登录 后发表回答