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

自闭症网瘾萝莉.ら 提交于 2020-01-04 09:14:50

问题


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?


回答1:


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.




回答2:


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




回答3:


Presumably, it should be in the reference documentation, here:

https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.descriptor.pb#FileDescriptorSet



来源:https://stackoverflow.com/questions/18636887/where-is-the-meta-proto-file-which-describes-desc-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!