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


C++ ArchivePtr::getFileList方法代码示例

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


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

示例1: main

int main(void)
{
	// Get hold of the Manager class
	ManagerPtr manager = getManager();

	// Use the manager to look up a particular archive format
	ArchiveTypePtr archiveType = manager->getArchiveTypeByCode("grp-duke3d");

	// Open an archive file on disk
	stream::file_sptr file(new stream::file());
	file->open("duke3d.grp");

	// We cheat here - we should check and load any supplementary files, but
	// for the sake of keeping this example simple we know this format doesn't
	// need any supps.
	camoto::SuppData supps;

	// Use the archive format handler to read in the file we opened as an archive
	ArchivePtr arch = archiveType->open(file, supps);

	// Get a list of all the files in the archive
	const Archive::VC_ENTRYPTR& contents = arch->getFileList();

	// Print the size of the list (the number of files in the archive)
	std::cout << "Found " << contents.size() << " files.\n";

	// Run through the list of files and show the filename
	for (Archive::VC_ENTRYPTR::const_iterator i = contents.begin(); i != contents.end(); i++) {
		const Archive::EntryPtr subfile = *i;
		std::cout << subfile->strName << "\n";
	}
	std::cout << "Done." << std::endl;

	// No cleanup required because all the Ptr variables are shared pointers,
	// which get destroyed automatically when they go out of scope (and nobody
	// else is using them!)

	return 0;
}
开发者ID:HendrikR,项目名称:libgamearchive,代码行数:39,代码来源:hello.cpp


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