本文整理汇总了C++中TreeNode::SupportsCDATA方法的典型用法代码示例。如果您正苦于以下问题:C++ TreeNode::SupportsCDATA方法的具体用法?C++ TreeNode::SupportsCDATA怎么用?C++ TreeNode::SupportsCDATA使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeNode
的用法示例。
在下文中一共展示了TreeNode::SupportsCDATA方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: output_standard_tag
void output_standard_tag(Context& ctx, std::string *out, const TreeNode& tag) {
if (!tag.mbIsText && tag.mName == "pre")
++ctx.pre_count;
if (out && (tag.mbIsControl || !tag.mbIsText)) {
if (ctx.holding_space && ctx.cdata_count) {
if (!ctx.eat_next_space) {
*out += ' ';
}
ctx.eat_next_space = false;
ctx.holding_space = false;
}
}
if (!ctx.construction_stack.empty()) {
TreeNode *new_tag = ctx.mpDocument->AllocNode();
new_tag->mpLocation = tag.mpLocation;
new_tag->mLineno = tag.mLineno;
new_tag->mName = tag.mName;
new_tag->mAttribs = tag.mAttribs;
new_tag->mbIsText = tag.mbIsText;
new_tag->mbIsControl = tag.mbIsControl;
ctx.construction_stack.back()->mChildren.push_back(new_tag);
ctx.construction_stack.push_back(new_tag);
output_tag_contents(ctx, out, tag);
ctx.construction_stack.pop_back();
} else if (tag.mbIsText) {
if (out) {
if (tag.mbIsControl) {
*out += tag.mName;
} else if (ctx.cdata_count) {
if (ctx.pre_count) {
*out += tag.mName;
} else {
std::string::const_iterator it(tag.mName.begin()), itEnd(tag.mName.end());
for(; it!=itEnd; ++it) {
const char c = *it;
if (isspace(c)) {
ctx.holding_space = true;
} else {
if (ctx.eat_next_space)
ctx.eat_next_space = false;
else if (ctx.holding_space)
*out += ' ';
ctx.holding_space = false;
*out += c;
}
}
}
} else {
std::string::const_iterator it(tag.mName.begin()), itEnd(tag.mName.end());
for(; it!=itEnd; ++it) {
const char c = *it;
if (!isspace(c))
error(ctx, "inline text not allowed");
}
}
}
} else {
bool cdata = tag.SupportsCDATA();
if (cdata) {
if (!ctx.cdata_count) {
ctx.holding_space = false;
ctx.eat_next_space = true;
}
++ctx.cdata_count;
}
if (!out) {
output_tag_contents(ctx, out, tag);
} else if (tag.mChildren.empty()) {
*out += '<';
*out += tag.mName;
output_tag_attributes(*out, tag);
*out += '>';
} else {
*out += '<';
*out += tag.mName;
output_tag_attributes(*out, tag);
*out += '>';
output_tag_contents(ctx, out, tag);
*out += "</";
*out += tag.mName;
*out += '>';
}
if (cdata)
--ctx.cdata_count;
//.........这里部分代码省略.........