本文整理汇总了C++中NOTICES::unkeep方法的典型用法代码示例。如果您正苦于以下问题:C++ NOTICES::unkeep方法的具体用法?C++ NOTICES::unkeep怎么用?C++ NOTICES::unkeep使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NOTICES
的用法示例。
在下文中一共展示了NOTICES::unkeep方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parse_items
// parse the actual RSS feed.
//
int RSS_FEED::parse_items(XML_PARSER& xp, int& nitems) {
nitems = 0;
int ntotal = 0, nerror = 0;
int retval, func_ret = ERR_XML_PARSE;
vector<NOTICE> new_notices;
notices.clear_keep();
while (!xp.get_tag()) {
if (!xp.is_tag) continue;
if (xp.match_tag("/rss")) {
if (log_flags.notice_debug) {
msg_printf(0, MSG_INFO,
"[notice] parsed RSS feed: total %d error %d added %d",
ntotal, nerror, nitems
);
}
func_ret = 0;
break;
}
if (xp.match_tag("item")) {
NOTICE n;
ntotal++;
retval = n.parse_rss(xp);
if (retval) {
nerror++;
} else if (n.create_time < gstate.now - 30*86400) {
if (log_flags.notice_debug) {
msg_printf(0, MSG_INFO,
"[notice] item is older than 30 days: %s",
n.title
);
}
} else {
n.arrival_time = gstate.now;
n.keep = true;
safe_strcpy(n.feed_url, url);
safe_strcpy(n.project_name, project_name);
new_notices.push_back(n);
}
continue;
}
if (xp.parse_int("error_num", retval)) {
if (log_flags.notice_debug) {
msg_printf(0,MSG_INFO,
"[notice] RSS fetch returned error %d (%s)",
retval,
boincerror(retval)
);
}
return retval;
}
}
// sort new notices by increasing create time, and append them
//
std::sort(new_notices.begin(), new_notices.end(), create_time_asc);
for (unsigned int i=0; i<new_notices.size(); i++) {
NOTICE& n = new_notices[i];
if (notices.append(n)) {
nitems++;
}
}
notices.unkeep(url);
return func_ret;
}