本文整理汇总了C++中HtmlToken::SetTag方法的典型用法代码示例。如果您正苦于以下问题:C++ HtmlToken::SetTag方法的具体用法?C++ HtmlToken::SetTag怎么用?C++ HtmlToken::SetTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlToken
的用法示例。
在下文中一共展示了HtmlToken::SetTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
// the name doesn't quite fit: this handles FB2 tags
void Fb2Formatter::HandleHtmlTag(HtmlToken *t)
{
if (Tag_Title == t->tag || Tag_Subtitle == t->tag) {
bool isSubtitle = Tag_Subtitle == t->tag;
ScopedMem<char> name(str::Format("h%d", section + (isSubtitle ? 1 : 0)));
HtmlToken tok;
tok.SetTag(t->type, name, name + str::Len(name));
HandleTagHx(&tok);
HandleAnchorAttr(t);
if (!isSubtitle && t->IsStartTag()) {
char *link = (char *)Allocator::Alloc(textAllocator, 24);
sprintf_s(link, 24, FB2_TOC_ENTRY_MARK "%d", ++titleCount);
currPage->instructions.Append(DrawInstr::Anchor(link, str::Len(link), RectF(0, currY, pageDx, 0)));
}
}
else if (Tag_Section == t->tag) {
if (t->IsStartTag())
section++;
else if (t->IsEndTag() && section > 1)
section--;
FlushCurrLine(true);
HandleAnchorAttr(t);
}
else if (Tag_P == t->tag) {
if (!tagNesting.Contains(Tag_Title))
HtmlFormatter::HandleHtmlTag(t);
}
else if (Tag_Image == t->tag) {
HandleTagImg(t);
HandleAnchorAttr(t);
}
else if (Tag_A == t->tag) {
HandleTagA(t, "href", "http://www.w3.org/1999/xlink");
HandleAnchorAttr(t, true);
}
else if (Tag_Pagebreak == t->tag)
ForceNewPage();
else if (Tag_Strong == t->tag)
HandleTagAsHtml(t, "b");
else if (t->NameIs("emphasis"))
HandleTagAsHtml(t, "i");
else if (t->NameIs("epigraph"))
HandleTagAsHtml(t, "blockquote");
else if (t->NameIs("empty-line")) {
if (!t->IsEndTag())
EmitParagraph(0);
}
else if (t->NameIs("stylesheet"))
HandleTagAsHtml(t, "style");
}
示例2:
void Fb2Formatter::HandleTagAsHtml(HtmlToken *t, const char *name)
{
HtmlToken tok;
tok.SetTag(t->type, name, name + str::Len(name));
HtmlFormatter::HandleHtmlTag(&tok);
}