当前位置: 首页>>代码示例>>C++>>正文


C++ Book::file方法代码示例

本文整理汇总了C++中Book::file方法的典型用法代码示例。如果您正苦于以下问题:C++ Book::file方法的具体用法?C++ Book::file怎么用?C++ Book::file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Book的用法示例。


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

示例1: readMetaInfo

bool DocPlugin::readMetaInfo(Book &book) const {
	if (!DocMetaInfoReader(book).readMetaInfo()) {
		return false;
	}

	shared_ptr<ZLInputStream> stream = new DocCharStream(book.file(), 50000);
	if (!detectEncodingAndLanguage(book, *stream)) {
		stream = new DocAnsiStream(book.file(), 50000);
		detectLanguage(book, *stream, ZLEncodingConverter::UTF8, true);
	}

	return true;
}
开发者ID:andreypc,项目名称:FBReaderJ,代码行数:13,代码来源:DocPlugin.cpp

示例2: readMetaInfo

bool RtfPlugin::readMetaInfo(Book &book) const {
	if (!RtfDescriptionReader(book).readDocument(book.file())) {
		return false;
	}

	if (book.encoding().empty()) {
		book.setEncoding("utf-8");
	} else if (book.language().empty()) {
		shared_ptr<ZLInputStream> stream = new RtfReaderStream(book.file(), 50000);
		if (!stream.isNull()) {
			detectLanguage(book, *stream);
		}
	}

	return true;
}
开发者ID:gezhonglunta,项目名称:FBReaderJ_2,代码行数:16,代码来源:RtfPlugin.cpp

示例3: readLanguageAndEncoding

bool OEBPlugin::readLanguageAndEncoding(Book &book) const {
	if (book.language().empty()) {
		shared_ptr<ZLInputStream> oebStream = new OEBTextStream(opfFile(book.file()));
		detectLanguage(book, *oebStream, book.encoding());
	}
	return true;
}
开发者ID:ALEXGUOQ,项目名称:FBReaderJ,代码行数:7,代码来源:OEBPlugin.cpp

示例4: removeBook

bool BooksDB::removeBook(const Book &book) {
	if (!isInitialized() || book.bookId() == 0) {
		return false;
	}
	myDeleteBook->setFileName(book.file().path());
	return executeAsTransaction(*myDeleteBook);
}
开发者ID:temper8,项目名称:FBReader-Tizen,代码行数:7,代码来源:BooksDB.cpp

示例5: readLanguageAndEncoding

bool TxtPlugin::readLanguageAndEncoding(Book &book) const {
	shared_ptr<ZLInputStream> stream = book.file().inputStream();
	if (stream.isNull()) {
		return false;
	}
	detectEncodingAndLanguage(book, *stream);
	return !book.encoding().empty();
}
开发者ID:Brucechen13,项目名称:FBReaderJ,代码行数:8,代码来源:TxtPlugin.cpp

示例6: readMetaInfo

bool PluckerPlugin::readMetaInfo(Book &book) const {
	shared_ptr<ZLInputStream> stream = new PluckerTextStream(book.file());
	detectEncodingAndLanguage(book, *stream);
	if (book.encoding().empty()) {
		return false;
	}

	return true;
}
开发者ID:euroelessar,项目名称:FBReader,代码行数:9,代码来源:PluckerPlugin.cpp

示例7: readMetaInfo

bool OEBPlugin::readMetaInfo(Book &book) const {
	const ZLFile &file = book.file();
	shared_ptr<ZLInputStream> lock = file.inputStream();
	const ZLFile opfFile = this->opfFile(file);
	bool code = OEBMetaInfoReader(book).readMetaInfo(opfFile);
	if (code && book.language().empty()) {
		shared_ptr<ZLInputStream> oebStream = new OEBTextStream(opfFile);
		detectLanguage(book, *oebStream);
	}
	return code;
}
开发者ID:raghavkc,项目名称:fbreaderj2,代码行数:11,代码来源:OEBPlugin.cpp

示例8: readMetaInfo

bool HtmlPlugin::readMetaInfo(Book &book) const {
	shared_ptr<ZLInputStream> stream = book.file().inputStream();
	if (stream.isNull()) {
		return false;
	}

	shared_ptr<ZLInputStream> htmlStream = new HtmlReaderStream(stream, 50000);
	detectEncodingAndLanguage(book, *htmlStream);
	if (book.encoding().empty()) {
		return false;
	}
	HtmlDescriptionReader(book).readDocument(*stream);

	return true;
}
开发者ID:euroelessar,项目名称:FBReader,代码行数:15,代码来源:HtmlPlugin.cpp

示例9: readMetaInfo

bool EReaderPlugin::readMetaInfo(Book &book) const {
	shared_ptr<ZLInputStream> stream = book.file().inputStream();
	if (stream.isNull() || ! stream->open()) {
		return false;
	}
	PdbHeader header;
	if (!header.read(stream)) {
		return false;
	}
	stream->seek(header.Offsets[0] + 46, true);
	unsigned short metaInfoOffset;
	PdbUtil::readUnsignedShort(*stream, metaInfoOffset);
	if (metaInfoOffset == 0 || metaInfoOffset >= header.Offsets.size()) {
		return false;
	}
	std::size_t currentOffset = header.Offsets[metaInfoOffset];
	std::size_t nextOffset =
		(metaInfoOffset + 1 < (unsigned short)header.Offsets.size()) ?
			header.Offsets[metaInfoOffset + 1] : stream->sizeOfOpened();
	if (nextOffset <= currentOffset) {
		return false;
	}
	std::size_t length = nextOffset - currentOffset;

	char* metaInfoBuffer = new char[length];
	stream->seek(currentOffset, true);
	stream->read(metaInfoBuffer, length);
	std::string metaInfoStr(metaInfoBuffer, length);
	delete[] metaInfoBuffer;

	std::string metaInfoData[5]; // Title; Author; Rights; Publisher; isbn;
	for (std::size_t i = 0; i < 5; ++i) { 
		const std::size_t index = metaInfoStr.find('\0');
		metaInfoData[i] = metaInfoStr.substr(0,index);
		metaInfoStr = metaInfoStr.substr(index + 1);
	}
	
	if (!metaInfoData[0].empty()) {
		book.setTitle(metaInfoData[0]);
	}
	
	if (!metaInfoData[1].empty()) {
		book.addAuthor(metaInfoData[1]);
	}

	stream->close();
	return SimplePdbPlugin::readMetaInfo(book);
}
开发者ID:euroelessar,项目名称:FBReader,代码行数:48,代码来源:EReaderPlugin.cpp

示例10: readMetaInfo

bool CHMPlugin::readMetaInfo(Book &book) const {
    const ZLFile &file = book.file();
    shared_ptr<ZLInputStream> stream = file.inputStream();
    if (stream.isNull() || !stream->open()) {
        return false;
    }

    CHMFileInfo chmFile(file);
    if (!chmFile.init(*stream)) {
        return false;
    }

    CHMFileInfo::FileNames names = chmFile.sectionNames(stream);
    if (names.empty()) {
        return false;
    }

    /*
    shared_ptr<ZLInputStream> entryStream = chmFile.entryStream(stream, names.Start);
    if (entryStream.isNull()) {
    	entryStream = chmFile.entryStream(stream, names.Home);
    }
    if (entryStream.isNull()) {
    	entryStream = chmFile.entryStream(stream, names.TOC);
    }
    / *
    if (entryStream.isNull()) {
    	chmFile.entryStream(stream, names.Index);
    }
    * /
    if (entryStream.isNull()) {
    	return false;
    }
    */

    CHMTextStream textStream(chmFile, stream);
    detectEncodingAndLanguage(book, textStream);
    if (book.encoding().empty()) {
        return false;
    }

    return true;
}
开发者ID:euroelessar,项目名称:FBReader,代码行数:43,代码来源:CHMPlugin.cpp

示例11: readMetainfo

bool SimplePdbPlugin::readMetainfo(Book &book) const {
	const ZLFile &file = book.file();
	shared_ptr<ZLInputStream> stream = createStream(file);
	detectEncodingAndLanguage(book, *stream);
	if (book.encoding().empty()) {
		return false;
	}
	int readType = HtmlMetainfoReader::NONE;
	if (book.title().empty()) {
		readType |= HtmlMetainfoReader::TITLE;
	}
	if (book.authors().empty()) {
		readType |= HtmlMetainfoReader::AUTHOR;
	}
	if (readType != HtmlMetainfoReader::NONE) {
	//if ((readType != HtmlMetainfoReader::NONE) && TextFormatDetector().isHtml(*stream)) {
		readType |= HtmlMetainfoReader::TAGS;
		HtmlMetainfoReader metainfoReader(book, (HtmlMetainfoReader::ReadType)readType);
		metainfoReader.readDocument(*stream);
	}

	return true;
}
开发者ID:ALEXGUOQ,项目名称:FBReaderJ,代码行数:23,代码来源:SimplePdbPlugin.cpp

示例12: readUids

bool OEBPlugin::readUids(Book &book) const {
	const ZLFile &file = book.file();
	return OEBUidReader(book).readUids(opfFile(file));
}
开发者ID:ALEXGUOQ,项目名称:FBReaderJ,代码行数:4,代码来源:OEBPlugin.cpp

示例13: OEBEncryptionReader

std::vector<shared_ptr<FileEncryptionInfo> > OEBPlugin::readEncryptionInfos(Book &book) const {
	const ZLFile &opf = opfFile(book.file());
	return OEBEncryptionReader().readEncryptionInfos(epubFile(opf), opf);
}
开发者ID:ALEXGUOQ,项目名称:FBReaderJ,代码行数:4,代码来源:OEBPlugin.cpp

示例14: readMetainfo

bool OEBPlugin::readMetainfo(Book &book) const {
	const ZLFile &file = book.file();
	return OEBMetaInfoReader(book).readMetainfo(opfFile(file));
}
开发者ID:ALEXGUOQ,项目名称:FBReaderJ,代码行数:4,代码来源:OEBPlugin.cpp


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