设为首页 加入收藏

TOP

让protobuf生成器支持时间戳检查 (二)
2014-11-23 22:57:33 来源: 作者: 【 】 浏览:3
Tags:protobuf 成器 支持 时间 检查
orter(&source_tree, &error_collector);

vector parsed_files;


if ( time_stamp_filename_ != "" )
CheckFileStamp( time_stamp_filename_ );
加黑部分为添加的代码, 这里是检查时间戳的入口

同时,我们还需要添加命令行解析开关, 这里在

bool CommandLineInterface::InterpretArgument(const string& name,
const string& value) {

函数中,找到:

} else if (name == "--error_format") {
if (value == "gcc") {
error_format_ = ERROR_FORMAT_GCC;
} else if (value == "msvs") {
error_format_ = ERROR_FORMAT_MSVS;
} else {
cerr << "Unknown error format: " << value << endl;
return false;
}

}
else if ( name == "--timestampfile" ){
time_stamp_filename_ = value;
}
else if (name == "--plugin") {
if (plugin_prefix_.empty()) {
cerr << "This compiler does not support plugins." << endl;
return false;
}
加黑部分为解析开关

之后在头文件中添加声明代码:

// Time stamp function
void ReadTimeStampFile( const string& timestampfile );

void WriteTimeStampFile( const string& timestampfile );

bool NeedGenerate( const std::string& filename );

void CheckFileStamp( const string& timestampfile );

typedef std::map time_stamp_map; // proto file name as key, timestamp as value
time_stamp_map time_stamp_map_;
string time_stamp_filename_;

此文来自战魂小筑

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇基于顺序存储的多叉树实现: (4) .. 下一篇对象的消息模型

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: