sor*_*h-r 30 c++ protocol-buffers
我想在另一个协议文件中包含一个协议定义文件.例如:
// base.proto:
message P_EndPoint {
required int32 id = 1;
required string host = 2;
required int32 port = 3;
}
Run Code Online (Sandbox Code Playgroud)
然后在另一个文件中:
communication.proto:
// somehow include `base.proto'
// ...
message P_CommunicationProtocol {
required CP_MessageType type = 1;
optional int32 id = 2;
optional P_EndPoint identity = 3;
repeated P_EndPoint others = 4;
}
// ...
Run Code Online (Sandbox Code Playgroud)
(注意:我的语言环境中没有developers.google.com)
Bri*_*ach 31
import "myproject/base.proto";
Run Code Online (Sandbox Code Playgroud)
文档:http://developers.google.com/protocol-buffers/docs/proto#other
归档时间: |
|
查看次数: |
14527 次 |
最近记录: |