Ejemplo n.º 1
0
void SimplePdbPlugin::readDocumentInternal(const ZLFile&, BookModel &model, const PlainTextFormat &format, const std::string &encoding, ZLInputStream &stream) const {
	//if (TextFormatDetector().isHtml(stream)) {
		HtmlBookReader("", model, format, encoding).readDocument(stream);
	//} else {
		//TxtBookReader(model, format, encoding).readDocument(stream);
	//}
}
Ejemplo n.º 2
0
bool HtmlPlugin::readModel(const BookDescription &description, BookModel &model) const {
	std::string fileName = description.fileName();
	shared_ptr<ZLInputStream> stream = ZLFile(fileName).inputStream();
	if (stream.isNull()) {
		return false;
	}

	PlainTextFormat format(fileName);
	if (!format.initialized()) {
		PlainTextFormatDetector detector;
		detector.detect(*stream, format);
	}

	int index0 = fileName.rfind('/');
	int index1 = fileName.rfind(':');
	HtmlBookReader(fileName.substr(0, std::max(index0, index1) + 1), model, format, description.encoding()).readDocument(*stream);

	return true;
}