与using protobuf as a textual configuraton file相关我想使用 protobuf 作为配置文件。
我希望 protobuf 允许我使用具有精确结构的简单解析器。
我的配置结构是这样的
//my.proto
package my_config;
message MyConfigItem {
required string type = 1;
required string name = 2;
repeated string inputNames = 3 [packed=true];
repeated string outputNames = 4 [packed=true];
}
还有配置文件中的一堆不同的项目,比如
MyConfigItem {
type = "type1";
name = "name1";
inputNames = {"input1", "input2"};
}
什么是最好的组织方式?
最佳答案
你可以这样写配置文件:
type : "type1"
name : "name1"
inputNames : {"input1", "input2"}
所以我认为你必须使用':'而不是'=',并且“不要”写括号中的项目。
关于c++ - 配置文件的protobuf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42652009/