当前位置: 首页>>代码示例>>C++>>正文


C++ NOTICES::size方法代码示例

本文整理汇总了C++中NOTICES::size方法的典型用法代码示例。如果您正苦于以下问题:C++ NOTICES::size方法的具体用法?C++ NOTICES::size怎么用?C++ NOTICES::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NOTICES的用法示例。


在下文中一共展示了NOTICES::size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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);
    }
}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例2: write_archive

// write archive file for the given RSS feed
// (or, if NULL, non-RSS notices)
//
void NOTICES::write_archive(RSS_FEED* rfp) {
    char path[MAXPATHLEN];

    if (rfp) {
        rfp->archive_file_name(path);
    } else {
        safe_strcpy(path, NOTICES_DIR"/archive.xml");
    }
    FILE* f = fopen(path, "w");
    if (!f) return;
    MIOFILE fout;
    fout.init_file(f);
    fout.printf("<notices>\n");
    if (!f) return;
    for (unsigned int i=0; i<notices.size(); i++) {
        NOTICE& n = notices[i];
        if (rfp) {
            if (strcmp(rfp->url, n.feed_url)) continue;
        } else {
            if (strlen(n.feed_url)) continue;
        }
        n.write(fout, false);
    }
    fout.printf("</notices>\n");
    fclose(f);
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例3: init

// called at the start of client initialization
//
void NOTICES::init() {
#if 0
    read_archive_file(NOTICES_DIR"/archive.xml", NULL);
    if (log_flags.notice_debug) {
        msg_printf(0, MSG_INFO, "read %d BOINC notices", (int)notices.size());
    }
    write_archive(NULL);
#endif
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例4: write

// write notices newer than seqno as XML (for GUI RPC).
// Write them in order of increasing seqno
//
void NOTICES::write(int seqno, GUI_RPC_CONN& grc, bool public_only) {
    size_t i;
    MIOFILE mf;

    if (!net_status.need_physical_connection) {
        remove_notices(NULL, REMOVE_NETWORK_MSG);
    }
    if (log_flags.notice_debug) {
        msg_printf(0, MSG_INFO, "NOTICES::write: seqno %d, refresh %s, %d notices",
            seqno, grc.get_notice_refresh()?"true":"false", (int)notices.size()
        );
    }
    grc.mfout.printf("<notices>\n");
    if (grc.get_notice_refresh()) {
        grc.clear_notice_refresh();
        NOTICE n;
        n.seqno = -1;
        seqno = -1;
        i = notices.size();
        n.write(grc.mfout, true);
        if (log_flags.notice_debug) {
            msg_printf(0, MSG_INFO, "NOTICES::write: sending -1 seqno notice");
        }
    } else {
        for (i=0; i<notices.size(); i++) {
            NOTICE& n = notices[i];
            if (n.seqno <= seqno) break;
        }
    }
    for (; i>0; i--) {
        NOTICE& n = notices[i-1];
        if (public_only && n.is_private) continue;
        if (log_flags.notice_debug) {
            msg_printf(0, MSG_INFO, "NOTICES::write: sending notice %d", n.seqno);
        }
        n.write(grc.mfout, true);
    }
    grc.mfout.printf("</notices>\n");
}
开发者ID:,项目名称:,代码行数:42,代码来源:


注:本文中的NOTICES::size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。