本文整理汇总了C++中NOTICES::end方法的典型用法代码示例。如果您正苦于以下问题:C++ NOTICES::end方法的具体用法?C++ NOTICES::end怎么用?C++ NOTICES::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NOTICES
的用法示例。
在下文中一共展示了NOTICES::end方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clear_keep
void NOTICES::clear_keep() {
deque<NOTICE>::iterator i = notices.begin();
while (i != notices.end()) {
NOTICE& n = *i;
n.keep = false;
i++;
}
}
示例2: init_rss
// called at the end of client initialization
//
void NOTICES::init_rss() {
rss_feeds.init();
if (log_flags.notice_debug) {
msg_printf(0, MSG_INFO, "read %d total notices", (int)notices.size());
}
// sort by decreasing arrival time, then assign seqnos
//
sort(notices.begin(), notices.end(), cmp);
size_t n = notices.size();
for (unsigned int i=0; i<n; i++) {
notices[i].seqno = (int)(n - i);
}
}
示例3: remove_dups
// we're considering adding a notice n.
// If there's already an identical message n2
// return false (don't add n)
// If there's a message n2 with same title and text,
// and n is significantly newer than n2,
// delete n2
//
// Also remove notices older than 30 days
//
bool NOTICES::remove_dups(NOTICE& n) {
deque<NOTICE>::iterator i = notices.begin();
bool removed_something = false;
bool retval = true;
double min_time = gstate.now - 30*86400;
while (i != notices.end()) {
NOTICE& n2 = *i;
if (n2.arrival_time < min_time
|| (n2.create_time && n2.create_time < min_time)
) {
i = notices.erase(i);
removed_something = true;
#if 0
// this check prevents news item edits from showing; skip it
} else if (same_guid(n, n2)) {
n2.keep = true;
return false;
#endif
} else if (same_text(n, n2)) {
int min_diff = 0;
// show a given scheduler notice at most once a week
//
if (!strcmp(n.category, "scheduler")) {
min_diff = 7*86400;
}
if (n.create_time > n2.create_time + min_diff) {
i = notices.erase(i);
removed_something = true;
} else {
n2.keep = true;
retval = false;
++i;
}
} else {
++i;
}
}
#ifndef SIM
if (removed_something) {
gstate.gui_rpcs.set_notice_refresh();
}
#endif
return retval;
}
示例4: remove_network_msg
// Remove "need network access" notices
//
void NOTICES::remove_network_msg() {
deque<NOTICE>::iterator i = notices.begin();
while (i != notices.end()) {
NOTICE& n = *i;
if (!strcmp(n.description.c_str(), NEED_NETWORK_MSG)) {
i = notices.erase(i);
#ifndef SIM
gstate.gui_rpcs.set_notice_refresh();
#endif
if (log_flags.notice_debug) {
msg_printf(0, MSG_INFO, "REMOVING NETWORK MESSAGE");
}
} else {
++i;
}
}
}
示例5: unkeep
void NOTICES::unkeep(const char* url) {
deque<NOTICE>::iterator i = notices.begin();
bool removed_something = false;
while (i != notices.end()) {
NOTICE& n = *i;
if (!strcmp(url, n.feed_url) && !n.keep) {
i = notices.erase(i);
removed_something = true;
} else {
i++;
}
}
#ifndef SIM
if (removed_something) {
gstate.gui_rpcs.set_notice_refresh();
}
#endif
}
示例6: remove_scheduler_notices
// Remove scheduler notices from the given project.
// This is called if we did an RPC to the project requesting work,
// and no notices were returned.
//
void NOTICES::remove_scheduler_notices(PROJECT* p) {
deque<NOTICE>::iterator i = notices.begin();
while (i != notices.end()) {
NOTICE& n = *i;
if (!strcmp(n.project_name, p->get_project_name())
&& !strcmp(n.category, "scheduler")
) {
i = notices.erase(i);
#ifndef SIM
gstate.gui_rpcs.set_notice_refresh();
#endif
if (log_flags.notice_debug) {
msg_printf(0, MSG_INFO, "REMOVING PROJECT MESSAGE");
}
} else {
++i;
}
}
}
示例7: remove_notices
// Remove outdated notices
//
void NOTICES::remove_notices(PROJECT* p, int which) {
deque<NOTICE>::iterator i = notices.begin();
while (i != notices.end()) {
NOTICE& n = *i;
if (p && strcmp(n.project_name, p->get_project_name())) {
++i;
continue;
}
bool remove = false;
switch (which) {
case REMOVE_NETWORK_MSG:
remove = !strcmp(n.description.c_str(), NEED_NETWORK_MSG);
break;
case REMOVE_SCHEDULER_MSG:
remove = !strcmp(n.category, "scheduler");
break;
case REMOVE_NO_WORK_MSG:
remove = !strcmp(n.description.c_str(), NO_WORK_MSG);
break;
case REMOVE_CONFIG_MSG:
remove = (strstr(n.description.c_str(), "cc_config.xml") != NULL);
break;
case REMOVE_APP_INFO_MSG:
remove = (strstr(n.description.c_str(), "app_info.xml") != NULL);
break;
case REMOVE_APP_CONFIG_MSG:
remove = (strstr(n.description.c_str(), "app_config.xml") != NULL);
break;
}
if (remove) {
i = notices.erase(i);
#ifndef SIM
gstate.gui_rpcs.set_notice_refresh();
#endif
if (log_flags.notice_debug) {
msg_printf(p, MSG_INFO, "Removing notices of type %d", which);
}
} else {
++i;
}
}
}