本文整理汇总了C++中XML_PARSER类的典型用法代码示例。如果您正苦于以下问题:C++ XML_PARSER类的具体用法?C++ XML_PARSER怎么用?C++ XML_PARSER使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XML_PARSER类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: parse_net_stats
int HOST::parse_net_stats(XML_PARSER& xp) {
double dtemp;
while (!xp.get_tag()) {
if (xp.match_tag("/net_stats")) return 0;
if (xp.parse_double("bwup", n_bwup)) continue;
if (xp.parse_double("bwdown", n_bwdown)) continue;
// items reported by 5.10+ clients, not currently used
//
if (xp.parse_double("avg_time_up", dtemp)) continue;
if (xp.parse_double("avg_up", dtemp)) continue;
if (xp.parse_double("avg_time_down", dtemp)) continue;
if (xp.parse_double("avg_down", dtemp)) continue;
log_messages.printf(MSG_NORMAL,
"HOST::parse_net_stats(): unrecognized: %s\n",
xp.parsed_tag
);
}
return ERR_XML_PARSE;
}
开发者ID:asimonov-im,项目名称:boinc,代码行数:21,代码来源:sched_types.cpp
示例17: parse
int APP_CONFIGS::parse(XML_PARSER& xp, MSG_VEC& mv, LOG_FLAGS& log_flags) {
char buf[1024];
int n;
clear();
while (!xp.get_tag()) {
if (!xp.is_tag) {
sprintf(buf, "unexpected text '%s' in app_config.xml", xp.parsed_tag);
mv.push_back(string(buf));
return ERR_XML_PARSE;
}
if (xp.match_tag("/app_config")) return 0;
if (xp.match_tag("app")) {
APP_CONFIG ac;
int retval = ac.parse(xp, mv, log_flags);
if (retval) return retval;
app_configs.push_back(ac);
continue;
}
if (xp.match_tag("app_version")) {
APP_VERSION_CONFIG avc;
int retval = avc.parse(xp, mv, log_flags);
if (retval) return retval;
app_version_configs.push_back(avc);
continue;
}
if (xp.parse_int("project_max_concurrent", n)) {
if (n >= 0) {
have_max_concurrent = true;
project_max_concurrent = n;
}
continue;
}
if (xp.parse_bool("report_results_immediately", report_results_immediately)) {
continue;
}
sprintf(buf, "Unknown tag in app_config.xml: %s", xp.parsed_tag);
mv.push_back(string(buf));
xp.skip_unexpected(log_flags.unparsed_xml, "APP_CONFIGS::parse");
}
mv.push_back(string("Missing </app_config> in app_config.xml"));
return ERR_XML_PARSE;
}
开发者ID:UweBeckert,项目名称:boinc,代码行数:43,代码来源:cc_config.cpp
示例18: parse
// Parse XML information about a persistent file transfer
//
int PERS_FILE_XFER::parse(XML_PARSER& xp) {
while (!xp.get_tag()) {
if (xp.match_tag("/persistent_file_xfer")) return 0;
else if (xp.parse_int("num_retries", nretry)) continue;
else if (xp.parse_double("first_request_time", first_request_time)) {
continue;
}
else if (xp.parse_double("next_request_time", next_request_time)) {
continue;
}
else if (xp.parse_double("time_so_far", time_so_far)) continue;
else if (xp.parse_double("last_bytes_xferred", last_bytes_xferred)) continue;
else if (xp.parse_bool("is_upload", is_upload)) continue;
else {
if (log_flags.unparsed_xml) {
msg_printf(NULL, MSG_INFO,
"[unparsed_xml] Unparsed line in file transfer info: %s",
xp.parsed_tag
);
}
}
}
return ERR_XML_PARSE;
}
开发者ID:Gspohu,项目名称:Crowdcomputing,代码行数:26,代码来源:pers_file_xfer.cpp
示例19: parse
int CONFIG::parse(XML_PARSER& xp, LOG_FLAGS& log_flags) {
while (!xp.get_tag()) {
if (!xp.is_tag) {
continue;
}
if (xp.match_tag("/cc_config")) return 0;
if (xp.match_tag("log_flags")) {
log_flags.parse(xp);
continue;
}
if (xp.match_tag("options")) {
parse_options(xp);
continue;
}
if (xp.match_tag("options/")) continue;
if (xp.match_tag("log_flags/")) continue;
}
return ERR_XML_PARSE;
}
开发者ID:FpgaAtHome,项目名称:seti_fpga,代码行数:19,代码来源:cc_config.cpp
示例20: parse
int VBOX_PORT_FORWARD::parse(XML_PARSER& xp) {
while (!xp.get_tag()) {
if (xp.match_tag("/port_forward")) {
if (!host_port) {
vboxlog_msg("VBOX_PORT_FORWARD::parse(): unspecified host port");
return ERR_XML_PARSE;
}
if (!guest_port) {
vboxlog_msg("VBOX_PORT_FORWARD::parse(): unspecified guest port");
return ERR_XML_PARSE;
}
return 0;
}
else if (xp.parse_bool("is_remote", is_remote)) continue;
else if (xp.parse_int("host_port", host_port)) continue;
else if (xp.parse_int("guest_port", guest_port)) continue;
else if (xp.parse_int("nports", nports)) continue;
else {
vboxlog_msg("VBOX_PORT_FORWARD::parse(): unexpected text %s", xp.parsed_tag);
}
}
return ERR_XML_PARSE;
}
开发者ID:gchilders,项目名称:boinc,代码行数:23,代码来源:vboxjob.cpp
注:本文中的XML_PARSER类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论