本文整理汇总了C++中CFileInfo::Name方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileInfo::Name方法的具体用法?C++ CFileInfo::Name怎么用?C++ CFileInfo::Name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileInfo
的用法示例。
在下文中一共展示了CFileInfo::Name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ForEachFile
Status ForEachFile(const PIVFS& fs, const VfsPath& startPath, FileCallback cb, uintptr_t cbData, const wchar_t* pattern, size_t flags)
{
// (declare here to avoid reallocations)
CFileInfos files;
DirectoryNames subdirectoryNames;
// (a FIFO queue is more efficient than recursion because it uses less
// stack space and avoids seeks due to breadth-first traversal.)
std::queue<VfsPath> pendingDirectories;
pendingDirectories.push(startPath/"");
while(!pendingDirectories.empty())
{
const VfsPath& path = pendingDirectories.front();
RETURN_STATUS_IF_ERR(fs->GetDirectoryEntries(path, &files, &subdirectoryNames));
for(size_t i = 0; i < files.size(); i++)
{
const CFileInfo fileInfo = files[i];
if(!match_wildcard(fileInfo.Name().string().c_str(), pattern))
continue;
const VfsPath pathname(path / fileInfo.Name()); // (CFileInfo only stores the name)
RETURN_STATUS_IF_ERR(cb(pathname, fileInfo, cbData));
}
if(!(flags & DIR_RECURSIVE))
break;
for(size_t i = 0; i < subdirectoryNames.size(); i++)
pendingDirectories.push(path / subdirectoryNames[i]/"");
pendingDirectories.pop();
}
return INFO::OK;
}