繁体   English   中英

是否可以使用协议缓冲区的外部枚举(外部消息定义)?

[英]Is it possible to use external enums (outside message definitions) with protocol buffers?

我需要将PB存储在PB消息定义之外定义的PB消息中。 有可能吗?怎么样?

这是可能的。 查看此主题以获取更多信息。 我喜欢在单独的.proto文件中定义枚举的建议。 喜欢

enums.proto

enum A
{ 
   FIRST = 1;
   SECOND = 2;
}

enum B { ... }

other.proto

import "enums.proto";

message SOMEMESSAGE
{
  required A myenum = 1;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM