配置文件的protobuf
protobuf for configuration files
相关 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"}
所以我认为你必须使用':'而不是'=',并且"do not"写括号中的项目。
相关 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"}
所以我认为你必须使用':'而不是'=',并且"do not"写括号中的项目。