本文整理汇总了C++中Directory::Next方法的典型用法代码示例。如果您正苦于以下问题:C++ Directory::Next方法的具体用法?C++ Directory::Next怎么用?C++ Directory::Next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Directory
的用法示例。
在下文中一共展示了Directory::Next方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TraverseBreadthFirst
void DirectoryTree::TraverseBreadthFirst(Directory& dir, const DirectoryEntryVisitor& visitor)
{
if (!dir)
{
return;
}
Aws::Queue<DirectoryEntry> queue;
while (DirectoryEntry&& entry = dir.Next())
{
queue.push(std::move(entry));
}
while (queue.size() > 0)
{
auto entry = queue.front();
queue.pop();
if(visitor(this, entry))
{
if(entry.fileType == FileType::Directory)
{
auto currentDir = dir.Descend(entry);
while (DirectoryEntry&& dirEntry = currentDir->Next())
{
queue.push(std::move(dirEntry));
}
}
}
else
{
return;
}
}
}
示例2: dir
/**
* Process the history directory and maintain the history file map
*
* Only handle rotated history files, those history.* that are not an
* index. For each one that is not in the history file map, create a
* new HistoryFile, poll it for entries to process, and add it to the
* map.
*/
void
aviary::history::processHistoryDirectory()
{
const char *file = NULL;
// each time through we rebuild our set of inodes
if (force_reset) {
m_historyFiles.clear();
}
Directory dir ( m_path.Value() );
dir.Rewind();
while ( ( file = dir.Next() ) )
{
// Skip all non-history files, e.g. history and history.*.idx
if ( strncmp ( file, "history.", 8 ) ||
!strncmp ( file + ( strlen ( file ) - 4 ), HISTORY_INDEX_SUFFIX, 4 ) ) continue;
HistoryFile h_file ( ( m_path + DIR_DELIM_STRING + file ).Value() );
CondorError errstack;
if ( !h_file.init ( errstack ) )
{
dprintf ( D_ALWAYS, "%s\n", errstack.getFullText().c_str() );
return;
}
errstack.clear();
long unsigned int id;
ASSERT ( h_file.getId ( id ) );
HistoryFileListType::iterator entry = m_historyFiles.find ( id );
if ( m_historyFiles.end() == entry )
{
HistoryFile::HistoryEntriesTypeIterators ij = h_file.poll ( errstack );
for ( HistoryFile::HistoryEntriesTypeIterator i = ij.first;
i != ij.second;
i++ )
{
process ( ( *i ) );
}
m_historyFiles.insert ( id );
}
}
}
示例3: TraverseDepthFirst
bool DirectoryTree::TraverseDepthFirst(Directory& dir, const DirectoryEntryVisitor& visitor, bool postOrder)
{
if (!dir)
{
return true;
}
bool exitTraversal(false);
DirectoryEntry entry;
while ((entry = dir.Next()) && !exitTraversal)
{
if(!postOrder)
{
if(!visitor(this, entry))
{
return false;
}
}
if (entry.fileType == FileType::Directory)
{
auto subDir = dir.Descend(entry);
exitTraversal = !TraverseDepthFirst(*subDir, visitor, postOrder);
}
if (postOrder)
{
if (!visitor(this, entry))
{
return false;
}
}
}
return !exitTraversal;
}