• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ XHTMLReader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: doAtStart

void XHTMLTagLinkAction::doAtStart(XHTMLReader &reader, const char **xmlattributes) {
	static const std::string REL = "stylesheet";
	const char *rel = reader.attributeValue(xmlattributes, "rel");
	if ((rel == 0) || (REL != rel)) {
		return;
	}
	static const std::string TYPE = "text/css";

	const char *type = reader.attributeValue(xmlattributes, "type");
	if ((type == 0) || (TYPE != type)) {
		return;
	}

	const char *href = reader.attributeValue(xmlattributes, "href");
	if (href == 0) {
		return;
	}

	ZLLogger::Instance().println("CSS", "style file: " + reader.myPathPrefix + MiscUtil::decodeHtmlURL(href));
	shared_ptr<ZLInputStream> cssStream = ZLFile(reader.myPathPrefix + MiscUtil::decodeHtmlURL(href)).inputStream();
	if (cssStream.isNull()) {
		return;
	}
	ZLLogger::Instance().println("CSS", "parsing file");
	StyleSheetTableParser parser(reader.myStyleSheetTable);
	parser.parse(*cssStream);
	//reader.myStyleSheetTable.dump();
}
开发者ID:Alexander--,项目名称:FBReaderJ,代码行数:28,代码来源:XHTMLReader.cpp


示例2: doAtStart

void XHTMLTagParagraphAction::doAtStart(XHTMLReader &reader, const char**) {
	if (!reader.myNewParagraphInProgress) {
		reader.pushTextKind(myTextKind);
		reader.beginParagraph();
		reader.myNewParagraphInProgress = true;
	}
}
开发者ID:Ca5th,项目名称:FBReaderJ,代码行数:7,代码来源:XHTMLReader.cpp


示例3: doAtStart

void XHTMLTagImageAction::doAtStart(XHTMLReader &reader, const char **xmlattributes) {
	// Ignore transparent images
	if (!reader.myParseStack.back().opacity) {
		return;
	}

	const char *fileName = reader.attributeValue(xmlattributes, *myPredicate);
	if (fileName == 0) {
		return;
	}

	const std::string fullfileName = pathPrefix(reader) + MiscUtil::decodeHtmlURL(fileName);
	if (!ZLFile(fullfileName).exists()) {
		return;
	}

	if ((strlen(fileName) > 2) && strncmp(fileName, "./", 2) == 0) {
		fileName +=2;
	}

	reader.myParseStack.back().kind = IMAGE;
	reader.haveContent();
	reader.myModelReader.addImageReference(fullfileName);
	reader.myModelReader.addImage(fullfileName, new ZLFileImage(ZLFile(fullfileName), 0));
}
开发者ID:isxinchen,项目名称:harbour-books,代码行数:25,代码来源:XHTMLReader.cpp


示例4: doAtStart

void XHTMLTagSourceAction::doAtStart(XHTMLReader &reader, const char **xmlattributes) {
	const char *mime = reader.attributeValue(xmlattributes, "type");
	const char *href = reader.attributeValue(xmlattributes, "src");
	if (mime != 0 && href != 0) {
		reader.myVideoEntry->addSource(
			mime,
			ZLFile(pathPrefix(reader) + MiscUtil::decodeHtmlURL(href)).path()
		);
	}
}
开发者ID:BrendanL79,项目名称:FBReaderJ,代码行数:10,代码来源:XHTMLReader.cpp


示例5: doAtStart

void XHTMLTagHyperlinkAction::doAtStart(XHTMLReader &reader, const char **xmlattributes) {
    const char *href = reader.attributeValue(xmlattributes, "href");
    if (href != 0) {
        const std::string link = (*href == '#') ? (reader.myReferenceName + href) : href;
        FBTextKind hyperlinkType = MiscUtil::isReference(link) ? EXTERNAL_HYPERLINK : INTERNAL_HYPERLINK;
        myHyperlinkStack.push(hyperlinkType);
        bookReader(reader).addHyperlinkControl(hyperlinkType, link);
    } else {
        myHyperlinkStack.push(REGULAR);
    }
    const char *name = reader.attributeValue(xmlattributes, "name");
    if (name != 0) {
        bookReader(reader).addHyperlinkLabel(reader.myReferenceName + "#" + name);
    }
}
开发者ID:justsoso8,项目名称:fbreader-0.8.17,代码行数:15,代码来源:XHTMLReader.cpp


示例6: doAtStart

void XHTMLTagImageAction::doAtStart(XHTMLReader &reader, const char **xmlattributes) {
	const char *fileName = reader.attributeValue(xmlattributes, *myPredicate);
	if (fileName == 0) {
		return;
	}

	const std::string fullfileName = pathPrefix(reader) + MiscUtil::decodeHtmlURL(fileName);
	ZLFile imageFile(fullfileName);
	if (!imageFile.exists()) {
		return;
	}

	bool flag = bookReader(reader).paragraphIsOpen();
	if (flag) {
		endParagraph(reader);
	}
	if (std::strlen(fileName) > 2 && std::strncmp(fileName, "./", 2) == 0) {
		fileName +=2;
	}
	bookReader(reader).addImageReference(fullfileName);
	bookReader(reader).addImage(fullfileName, new ZLFileImage(ZLFile(fullfileName), 0));
	if (flag) {
		beginParagraph(reader);
	}
}
开发者ID:euroelessar,项目名称:FBReader,代码行数:25,代码来源:XHTMLReader.cpp


示例7: doAtStart

void XHTMLTagStyleAction::doAtStart(XHTMLReader &reader, const char **xmlattributes) {
	static const std::string TYPE = "text/css";

	const char *type = reader.attributeValue(xmlattributes, "type");
	if ((type == 0) || (TYPE != type)) {
		return;
	}

	if (reader.myReadState == XHTMLReader::READ_NOTHING) {
		reader.myReadState = XHTMLReader::READ_STYLE;
		reader.myTableParser = new StyleSheetTableParser(reader.myStyleSheetTable);
	}
}
开发者ID:Darion,项目名称:FBReader,代码行数:13,代码来源:XHTMLReader.cpp


示例8: generateTOC

void OEBBookReader::generateTOC(const XHTMLReader &xhtmlReader) {
	if (!myNCXTOCFileName.empty()) {
		NCXReader ncxReader(myModelReader);
		const ZLFile ncxFile(myFilePrefix + myNCXTOCFileName);
		if (ncxReader.readDocument(ncxFile.inputStream(myEncryptionMap))) {
			const std::map<int,NCXReader::NavPoint> navigationMap = ncxReader.navigationMap();
			if (!navigationMap.empty()) {
				std::size_t level = 0;
				for (std::map<int,NCXReader::NavPoint>::const_iterator it = navigationMap.begin(); it != navigationMap.end(); ++it) {
					const NCXReader::NavPoint &point = it->second;
					int index = myModelReader.model().label(xhtmlReader.normalizedReference(point.ContentHRef)).ParagraphNumber;
					while (level > point.Level) {
						myModelReader.endContentsParagraph();
						--level;
					}
					while (++level <= point.Level) {
						myModelReader.beginContentsParagraph(-2);
						myModelReader.addContentsData("...");
					}
					myModelReader.beginContentsParagraph(index);
					myModelReader.addContentsData(point.Text);
				}
				while (level > 0) {
					myModelReader.endContentsParagraph();
					--level;
				}
				return;
			}
		}
	}

	std::vector<std::pair<std::string,std::string> > &toc = myTourTOC.empty() ? myGuideTOC : myTourTOC;
	for (std::vector<std::pair<std::string,std::string> >::const_iterator it = toc.begin(); it != toc.end(); ++it) {
		int index = myModelReader.model().label(it->second).ParagraphNumber;
		if (index != -1) {
			myModelReader.beginContentsParagraph(index);
			myModelReader.addContentsData(it->first);
			myModelReader.endContentsParagraph();
		}
	}
}
开发者ID:alexzhuustc,项目名称:FBReaderJ,代码行数:41,代码来源:OEBBookReader.cpp


示例9: endParagraph

void XHTMLTagAction::endParagraph(XHTMLReader &reader) {
	reader.endParagraph();
}
开发者ID:Alexander--,项目名称:FBReaderJ,代码行数:3,代码来源:XHTMLReader.cpp


示例10: beginParagraph

void XHTMLTagAction::beginParagraph(XHTMLReader &reader) {
	reader.beginParagraph();
}
开发者ID:Alexander--,项目名称:FBReaderJ,代码行数:3,代码来源:XHTMLReader.cpp


示例11: doAtEnd

void XHTMLTagParagraphAction::doAtEnd(XHTMLReader &reader) {
	reader.endParagraph();
}
开发者ID:Ca5th,项目名称:FBReaderJ,代码行数:3,代码来源:XHTMLReader.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ XIBObject类代码示例发布时间:2022-05-31
下一篇:
C++ XFile类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap