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


C++ XML_PARSER类代码示例

本文整理汇总了C++中XML_PARSER的典型用法代码示例。如果您正苦于以下问题:C++ XML_PARSER类的具体用法?C++ XML_PARSER怎么用?C++ XML_PARSER使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: parse

int FILE_INFO::parse(XML_PARSER& xp) {
    bool found=false;
    optional = false;
    no_validate = false;
    while (!xp.get_tag()) {
        if (!xp.is_tag) continue;
        if (xp.match_tag("/file_ref")) {
            return found?0:ERR_XML_PARSE;
        }
        if (xp.parse_string("file_name", name)) {
            found = true;
            continue;
        }
        if (xp.parse_bool("optional", optional)) continue;
        if (xp.parse_bool("no_validate", no_validate)) continue;
    }
    return ERR_XML_PARSE;
}
开发者ID:abergstr,项目名称:BOINC,代码行数:18,代码来源:validate_util.cpp

示例2: parse

int OPENCL_CPU_PROP::parse(XML_PARSER& xp) {
    int retval;

    clear();

    while (!xp.get_tag()) {
        if (xp.match_tag("/opencl_cpu_prop")) {
            if (!strlen(platform_vendor)) return ERR_XML_PARSE;
            return 0;
        }
        if (xp.parse_str("platform_vendor", platform_vendor, sizeof(platform_vendor))) continue;
        if (xp.match_tag("opencl_cpu_info")) {
            retval = opencl_prop.parse(xp, "/opencl_cpu_info");
            if (retval) return retval;
            continue;
        }
    }
    return ERR_XML_PARSE;
}
开发者ID:AltroCoin,项目名称:altrocoin,代码行数:19,代码来源:opencl_boinc.cpp

示例3: parse_rsc_param

static bool parse_rsc_param(XML_PARSER& xp, const char* end_tag, int& rsc_type, double& value) {
    char name[256];
    bool val_found = false;

    rsc_type = -1;
    while (!xp.get_tag()) {
        if (xp.match_tag(end_tag)) {
            return (rsc_type > 0 && val_found);
        }
        if (xp.parse_str("name", name, sizeof(name))) {
            rsc_type = rsc_index(name);
            continue;
        }
        if (xp.parse_double("rsc_type", value)) {
            val_found = true;
        }
    }
    return false;
}
开发者ID:DanAurea,项目名称:boinc,代码行数:19,代码来源:project.cpp

示例4: parse

int COPROCS::parse(XML_PARSER& xp) {
    int retval;

    clear();
    n_rsc = 1;
    strcpy(coprocs[0].type, "CPU");
    while (!xp.get_tag()) {
        if (xp.match_tag("/coprocs")) {
            return 0;
        }
        if (xp.match_tag("coproc_cuda")) {
            retval = nvidia.parse(xp);
            if (retval) {
                nvidia.clear();
            } else {
                coprocs[n_rsc++] = nvidia;
            }
            continue;
        }
        if (xp.match_tag("coproc_ati")) {
            retval = ati.parse(xp);
            if (retval) {
                ati.clear();
            } else {
                coprocs[n_rsc++] = ati;
            }
            continue;
        }
        if (xp.match_tag("coproc_intel_gpu")) {
            retval = intel_gpu.parse(xp);
            if (retval) {
                intel_gpu.clear();
            } else {
                coprocs[n_rsc++] = intel_gpu;
            }
            continue;
        }
    }
    return ERR_XML_PARSE;
}
开发者ID:FpgaAtHome,项目名称:seti_fpga,代码行数:40,代码来源:coproc.cpp

示例5: parse

int APP_CONFIGS::parse(XML_PARSER& xp, PROJECT* p) {
    app_configs.clear();
    if (!xp.parse_start("app_config")) return ERR_XML_PARSE;
    while (!xp.get_tag()) {
        if (xp.match_tag("/app_config")) return 0;
        if (xp.match_tag("app")) {
            APP_CONFIG ac;
            int retval = ac.parse(xp, p);
            if (!retval) {
                app_configs.push_back(ac);
            }
            continue;
        }
        if (xp.match_tag("app_version")) {
            APP_VERSION_CONFIG avc;
            int retval = avc.parse(xp, p);
            if (!retval) {
                app_version_configs.push_back(avc);
            }
            continue;
        }
        if (log_flags.unparsed_xml) {
            msg_printf(p, MSG_INFO,
                "Unparsed line in app_info.xml: %s",
                xp.parsed_tag
            );
        }
        xp.skip_unexpected(log_flags.unparsed_xml, "APP_CONFIGS::parse");
    }
    return ERR_XML_PARSE;
}
开发者ID:justinlynn,项目名称:boinc-v2,代码行数:31,代码来源:app_config.cpp

示例6: parse

int JOB_LIMIT::parse(XML_PARSER& xp, const char* end_tag) {
    while (!xp.get_tag()) {
        if (!xp.is_tag) {
            continue;
        }
        if (xp.match_tag(end_tag)) {
            return 0;
        }
        if (xp.parse_str("app_name", app_name, sizeof(app_name))) {
            continue;
        }
        if (xp.match_tag("total_limit")) {
            total.parse(xp, "/total_limit");
            continue;
        }
        if (xp.match_tag("cpu_limit")) {
            proc_type_limits[0].parse(xp, "/cpu_limit");
            continue;
        }
        if (xp.match_tag("gpu_limit")) {
            proc_type_limits[1].parse(xp, "/gpu_limit");
            for (int i=2; i<NPROC_TYPES; i++) {
                proc_type_limits[i] = proc_type_limits[1];
            }
            continue;
        }
    }
    return ERR_XML_PARSE;
}
开发者ID:Ashod,项目名称:Boinc,代码行数:29,代码来源:sched_limit.cpp

示例7: parse

int CLIENT_APP_VERSION::parse(XML_PARSER& xp) {
    double x;

    memset(this, 0, sizeof(*this));
    host_usage.avg_ncpus = 1;
    while (!xp.get_tag()) {
        if (xp.match_tag("/app_version")) {
            app = ssp->lookup_app_name(app_name);
            if (!app) return ERR_NOT_FOUND;

            double pf = host_usage.avg_ncpus * g_reply->host.p_fpops;
            if (host_usage.proc_type != PROC_TYPE_CPU) {
                COPROC* cp = g_request->coprocs.type_to_coproc(host_usage.proc_type);
                pf += host_usage.gpu_usage*cp->peak_flops;
            }
            host_usage.peak_flops = pf;
            return 0;
        }
        if (xp.parse_str("app_name", app_name, 256)) continue;
        if (xp.parse_str("platform", platform, 256)) continue;
        if (xp.parse_str("plan_class", plan_class, 256)) continue;
        if (xp.parse_int("version_num", version_num)) continue;
        if (xp.parse_double("avg_ncpus", x)) {
            if (x>0) host_usage.avg_ncpus = x;
            continue;
        }
        if (xp.parse_double("flops", x)) {
            if (x>0) host_usage.projected_flops = x;
            continue;
        }
        if (xp.match_tag("coproc")) {
            COPROC_REQ coproc_req;
            int retval = coproc_req.parse(xp);
            if (!retval) {
                int rt = coproc_type_name_to_num(coproc_req.type);
                if (!rt) {
                    log_messages.printf(MSG_NORMAL,
                        "UNKNOWN COPROC TYPE %s\n", coproc_req.type
                    );
                    continue;
                }
                host_usage.proc_type = rt;
                host_usage.gpu_usage = coproc_req.count;
            }
            continue;
        }
    }
    return ERR_XML_PARSE;
}
开发者ID:caguado,项目名称:boinc-v2,代码行数:49,代码来源:sched_types.cpp

示例8: parse

int CLIENT_APP_VERSION::parse(XML_PARSER& xp) {
    double x;

    memset(this, 0, sizeof(*this));
    host_usage.avg_ncpus = 1;
    while (!xp.get_tag()) {
        if (xp.match_tag("/app_version")) {
            app = ssp->lookup_app_name(app_name);
            if (!app) return ERR_NOT_FOUND;

            double pf = host_usage.avg_ncpus * g_reply->host.p_fpops;
            if (host_usage.ncudas && g_request->coprocs.nvidia.count) {
                pf += host_usage.ncudas*g_request->coprocs.nvidia.peak_flops;
            }
            if (host_usage.natis && g_request->coprocs.ati.count) {
                pf += host_usage.natis*g_request->coprocs.ati.peak_flops;
            }
            host_usage.peak_flops = pf;
            return 0;
        }
        if (xp.parse_str("app_name", app_name, 256)) continue;
        if (xp.parse_str("platform", platform, 256)) continue;
        if (xp.parse_str("plan_class", plan_class, 256)) continue;
        if (xp.parse_int("version_num", version_num)) continue;
        if (xp.parse_double("avg_ncpus", x)) {
            if (x>0) host_usage.avg_ncpus = x;
            continue;
        }
        if (xp.parse_double("flops", x)) {
            if (x>0) host_usage.projected_flops = x;
            continue;
        }
        if (xp.match_tag("coproc")) {
            COPROC_REQ coproc_req;
            int retval = coproc_req.parse(xp);
            if (!retval && !strcmp(coproc_req.type, "CUDA")) {
                host_usage.ncudas = coproc_req.count;
            }
            if (!retval && !strcmp(coproc_req.type, "NVIDIA")) {
                host_usage.ncudas = coproc_req.count;
            }
            if (!retval && !strcmp(coproc_req.type, "ATI")) {
                host_usage.natis = coproc_req.count;
            }
            continue;
        }
    }
    return ERR_XML_PARSE;
}
开发者ID:asimonov-im,项目名称:boinc,代码行数:49,代码来源:sched_types.cpp

示例9: parse_time_stats

int HOST::parse_time_stats(XML_PARSER& xp) {
    while (!xp.get_tag()) {
        if (xp.match_tag("/time_stats")) return 0;
        if (xp.parse_double("on_frac", on_frac)) continue;
        if (xp.parse_double("connected_frac", connected_frac)) continue;
        if (xp.parse_double("active_frac", active_frac)) continue;
#if 0
        if (xp.match_tag("outages")) continue;
        if (xp.match_tag("outage")) continue;
        if (xp.match_tag("start")) continue;
        if (xp.match_tag("end")) continue;
        log_messages.printf(MSG_NORMAL,
            "HOST::parse_time_stats(): unrecognized: %s\n",
            xp.parsed_tag
        );
#endif
    }
    return ERR_XML_PARSE;
}
开发者ID:asimonov-im,项目名称:boinc,代码行数:19,代码来源:sched_types.cpp

示例10: parse_project_files

int parse_project_files(XML_PARSER& xp, vector<FILE_REF>& project_files) {
    int retval;
    project_files.clear();
    while (!xp.get_tag()) {
        if (xp.match_tag("/project_files")) return 0;
        if (xp.match_tag("file_ref")) {
            FILE_REF file_ref;
            retval = file_ref.parse(xp);
            if (!retval) {
                project_files.push_back(file_ref);
            }
        } else {
            if (log_flags.unparsed_xml) {
                msg_printf(0, MSG_INFO,
                    "[unparsed_xml] parse_project_files(): unrecognized: %s\n",
                    xp.parsed_tag
                );
            }
            xp.skip_unexpected();
        }
    }
    return ERR_XML_PARSE;
}
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:23,代码来源:client_types.cpp

示例11: SetAttribute

void CFileListXml::SetAttribute(XML_PARSER& parser, const char* AttribName,const char* AttribValue)
{
	//多字节转化为UTF-8后再保存
	char* szUtf8 = CCharSetConversionUtil::MultiByteToUtf8(AttribValue, (int)strlen(AttribValue));
	if (szUtf8 == NULL)
	{
		return;
	}
	else
	{
		parser.Set_Attribute(AttribName, szUtf8);
		delete[] szUtf8;
		szUtf8 = NULL;
	}
}
开发者ID:yuechuanbingzhi163,项目名称:sixhe,代码行数:15,代码来源:FileList.cpp

示例12: GetAttribute

CString CFileListXml::GetAttribute(XML_PARSER& parser, const char* AttribName)
{
	std::string str = parser.GetAttributeValue(AttribName);
	char* szMultiByte = CCharSetConversionUtil::Utf8ToMultiByte(str.c_str(), (int)strlen(str.c_str()));
	if (szMultiByte == NULL)
	{
		return _T("");
	}
	else
	{
		CString strTemp = szMultiByte;
		delete[] szMultiByte;
		szMultiByte = NULL;
		return strTemp;
	}
}
开发者ID:yuechuanbingzhi163,项目名称:sixhe,代码行数:16,代码来源:FileList.cpp

示例13: parse

int COMPLETED_JOB_DESC::parse(XML_PARSER& xp) {
    canonical_resultid = 0;
    error_mask = 0;
    error_resultid = 0;
    exit_status = 0;
    elapsed_time = 0;
    cpu_time = 0;
    while (!xp.get_tag()) {
        if (xp.match_tag("/completed_job")) return 0;
        if (xp.parse_int("canonical_resultid", canonical_resultid)) continue;
        if (xp.parse_int("error_mask", error_mask)) continue;
        if (xp.parse_int("error_resultid", error_resultid)) continue;
        if (xp.parse_int("exit_status", exit_status)) continue;
        if (xp.parse_double("elapsed_time", elapsed_time)) continue;
        if (xp.parse_double("cpu_time", cpu_time)) continue;
        if (xp.parse_string("stderr_out", stderr_out)) {
            xml_unescape(stderr_out);
            continue;
        }
    }
    return ERR_XML_PARSE;
}
开发者ID:FpgaAtHome,项目名称:seti_fpga,代码行数:22,代码来源:remote_submit.cpp

示例14: set_debt

static int set_debt(XML_PARSER& xp) {
    bool is_tag;
    char tag[256], url[256];
    double short_term_debt = 0, long_term_debt = 0, cuda_debt=0, ati_debt=0;
    bool got_std=false, got_ltd=false, got_cuda_debt=false, got_ati_debt=false;
    strcpy(url, "");
    while (!xp.get(tag, sizeof(tag), is_tag)) {
        if (!strcmp(tag, "/project")) {
            if (!strlen(url)) return ERR_XML_PARSE;
            canonicalize_master_url(url);
            PROJECT* p = gstate.lookup_project(url);
            if (!p) return ERR_NOT_FOUND;
            if (got_std) {
                p->cpu_pwf.short_term_debt = short_term_debt;
                p->cuda_pwf.short_term_debt = short_term_debt;
                p->ati_pwf.short_term_debt = short_term_debt;
            }
            if (got_ltd) p->cpu_pwf.long_term_debt = long_term_debt;
            if (got_cuda_debt) p->cuda_pwf.long_term_debt = cuda_debt;
            if (got_ati_debt) p->ati_pwf.long_term_debt = ati_debt;
            return 0;
        }
        if (xp.parse_str(tag, "master_url", url, sizeof(url))) continue;
        if (xp.parse_double(tag, "short_term_debt", short_term_debt)) {
            got_std = true;
            continue;
        }
        if (xp.parse_double(tag, "long_term_debt", long_term_debt)) {
            got_ltd = true;
            continue;
        }
        if (xp.parse_double(tag, "cuda_debt", cuda_debt)) {
            got_cuda_debt = true;
            continue;
        }
        if (xp.parse_double(tag, "ati_debt", ati_debt)) {
            got_ati_debt = true;
            continue;
        }
        if (log_flags.unparsed_xml) {
            msg_printf(NULL, MSG_INFO,
                "[unparsed_xml] set_debt: unrecognized %s", tag
            );
        }
        xp.skip_unexpected(tag, log_flags.unparsed_xml, "set_debt");
    }
    return 0;
}
开发者ID:Rytiss,项目名称:native-boinc-for-android,代码行数:48,代码来源:gui_rpc_server_ops.cpp

示例15: parse_day

int GLOBAL_PREFS::parse_day(XML_PARSER& xp) {
    int day_of_week = -1;
    bool has_cpu = false;
    bool has_net = false;
    double start_hour = 0;
    double end_hour = 0;
    double net_start_hour = 0;
    double net_end_hour = 0;

    while (!xp.get_tag()) {
        if (!xp.is_tag) continue;
        if (xp.match_tag("/day_prefs")) {
            if (day_of_week < 0 || day_of_week > 6) return ERR_XML_PARSE;
            if (has_cpu) {
                cpu_times.week.set(day_of_week, start_hour, end_hour);
            }
            if (has_net) {
                net_times.week.set(day_of_week, net_start_hour, net_end_hour);
            }
            return 0;
        }
        if (xp.parse_int("day_of_week", day_of_week)) continue;
        if (xp.parse_double("start_hour", start_hour)) {
            has_cpu = true;
            continue;
        }
        if (xp.parse_double("end_hour", end_hour)) {
            has_cpu = true;
            continue;
        }
        if (xp.parse_double("net_start_hour", net_start_hour)) {
            has_net = true;
            continue;
        }
        if (xp.parse_double("net_end_hour", net_end_hour)) {
            has_net = true;
            continue;
        }
        xp.skip_unexpected(true, "GLOBAL_PREFS::parse_day");
    }
    return ERR_XML_PARSE;
}
开发者ID:niclaslockner,项目名称:boinc,代码行数:42,代码来源:prefs.cpp


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