本文整理汇总了C++中XML_PARSER::element_contents方法的典型用法代码示例。如果您正苦于以下问题:C++ XML_PARSER::element_contents方法的具体用法?C++ XML_PARSER::element_contents怎么用?C++ XML_PARSER::element_contents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XML_PARSER
的用法示例。
在下文中一共展示了XML_PARSER::element_contents方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parse
int AM_ACCOUNT::parse(XML_PARSER& xp) {
char tag[256];
bool is_tag, btemp;
int retval;
double dtemp;
detach = false;
update = false;
dont_request_more_work.init();
detach_when_done.init();
url = "";
strcpy(url_signature, "");
authenticator = "";
resource_share.init();
while (!xp.get(tag, sizeof(tag), is_tag)) {
if (!is_tag) {
if (log_flags.unparsed_xml) {
msg_printf(0, MSG_INFO,
"[unparsed_xml] AM_ACCOUNT::parse: unexpected text %s",
tag
);
}
continue;
}
if (!strcmp(tag, "/account")) {
if (url.length()) return 0;
return ERR_XML_PARSE;
}
if (xp.parse_string(tag, "url", url)) continue;
if (!strcmp(tag, "url_signature")) {
retval = xp.element_contents("</url_signature>", url_signature, sizeof(url_signature));
if (retval) return retval;
strcat(url_signature, "\n");
continue;
}
if (xp.parse_string(tag, "authenticator", authenticator)) continue;
if (xp.parse_bool(tag, "detach", detach)) continue;
if (xp.parse_bool(tag, "update", update)) continue;
if (xp.parse_bool(tag, "dont_request_more_work", btemp)) {
dont_request_more_work.set(btemp);
continue;
}
if (xp.parse_bool(tag, "detach_when_done", btemp)) {
detach_when_done.set(btemp);
continue;
}
if (xp.parse_double(tag, "resource_share", dtemp)) {
if (dtemp >= 0) {
resource_share.set(dtemp);
} else {
msg_printf(NULL, MSG_INFO,
"Resource share out of range: %f", dtemp
);
}
continue;
}
if (log_flags.unparsed_xml) {
msg_printf(NULL, MSG_INFO,
"[unparsed_xml] AM_ACCOUNT: unrecognized %s", tag
);
}
xp.skip_unexpected(tag, log_flags.unparsed_xml, "AM_ACCOUNT::parse");
}
return ERR_XML_PARSE;
}
示例2: parse
// parse a project account from AM reply
//
int AM_ACCOUNT::parse(XML_PARSER& xp) {
char buf[256];
bool btemp;
int retval;
double dtemp;
detach = false;
update = false;
memset(no_rsc, 0, sizeof(no_rsc));
dont_request_more_work.init();
detach_when_done.init();
suspend.init();
abort_not_started.init();
url = "";
safe_strcpy(url_signature, "");
authenticator = "";
resource_share.init();
while (!xp.get_tag()) {
if (!xp.is_tag) {
if (log_flags.unparsed_xml) {
msg_printf(0, MSG_INFO,
"[unparsed_xml] AM_ACCOUNT::parse: unexpected text %s",
xp.parsed_tag
);
}
continue;
}
if (xp.match_tag("/account")) {
if (url.length()) return 0;
return ERR_XML_PARSE;
}
if (xp.parse_string("url", url)) continue;
if (xp.match_tag("url_signature")) {
retval = xp.element_contents("</url_signature>", url_signature, sizeof(url_signature));
if (retval) return retval;
safe_strcat(url_signature, "\n");
continue;
}
if (xp.parse_string("authenticator", authenticator)) continue;
if (xp.parse_bool("detach", detach)) continue;
if (xp.parse_bool("update", update)) continue;
if (xp.parse_bool("no_cpu", btemp)) {
handle_no_rsc("CPU", btemp);
continue;
}
// deprecated
if (xp.parse_bool("no_cuda", btemp)) {
handle_no_rsc(GPU_TYPE_NVIDIA, btemp);
continue;
}
if (xp.parse_bool("no_ati", btemp)) {
handle_no_rsc(GPU_TYPE_NVIDIA, btemp);
continue;
}
if (xp.parse_str("no_rsc", buf, sizeof(buf))) {
handle_no_rsc(buf, true);
continue;
}
if (xp.parse_bool("dont_request_more_work", btemp)) {
dont_request_more_work.set(btemp);
continue;
}
if (xp.parse_bool("detach_when_done", btemp)) {
detach_when_done.set(btemp);
continue;
}
if (xp.parse_double("resource_share", dtemp)) {
if (dtemp >= 0) {
resource_share.set(dtemp);
} else {
msg_printf(NULL, MSG_INFO,
"Resource share out of range: %f", dtemp
);
}
continue;
}
if (xp.parse_bool("suspend", btemp)) {
suspend.set(btemp);
continue;
}
if (xp.parse_bool("abort_not_started", btemp)) {
abort_not_started.set(btemp);
continue;
}
if (log_flags.unparsed_xml) {
msg_printf(NULL, MSG_INFO,
"[unparsed_xml] AM_ACCOUNT: unrecognized %s", xp.parsed_tag
);
}
xp.skip_unexpected(log_flags.unparsed_xml, "AM_ACCOUNT::parse");
}
return ERR_XML_PARSE;
}