A Directory iterator that does all file i/o in one go. More...
#include <gdirectory.h>
Public Member Functions | |
DirectoryList () | |
Default constructor for an empty list. More... | |
void | readAll (const Path &dir) |
An initialiser that is to be used after default construction. More... | |
void | readType (const Path &dir, const std::string &suffix, unsigned int limit=0U) |
An initialiser that is to be used after default construction. More... | |
bool | more () |
Returns true if more and advances by one. More... | |
bool | isDir () const |
Returns true if the current item is a directory. More... | |
G::Path | filePath () const |
Returns the current path. More... | |
G::Path | fileName () const |
Returns the current filename. More... | |
A Directory iterator that does all file i/o in one go.
This is useful, compared to DirectoryIterator, while temporarily adopting additional process privileges to read a directory. The implementation uses DirectoryIterator.
Definition at line 164 of file gdirectory.h.
G::DirectoryList::DirectoryList | ( | ) |
Default constructor for an empty list.
Initialise with a read method.
Definition at line 76 of file gdirectory.cpp.
G::Path G::DirectoryList::fileName | ( | ) | const |
Returns the current filename.
Definition at line 136 of file gdirectory.cpp.
Referenced by GPop::StoreLock::lock().
G::Path G::DirectoryList::filePath | ( | ) | const |
Returns the current path.
Definition at line 131 of file gdirectory.cpp.
bool G::DirectoryList::isDir | ( | ) | const |
Returns true if the current item is a directory.
Definition at line 126 of file gdirectory.cpp.
bool G::DirectoryList::more | ( | ) |
Returns true if more and advances by one.
Definition at line 110 of file gdirectory.cpp.
Referenced by GPop::StoreLock::lock().
void G::DirectoryList::readAll | ( | const Path & | dir | ) |
An initialiser that is to be used after default construction.
Reads all files in the directory. All file i/o is done in readAll()/readType().
Definition at line 82 of file gdirectory.cpp.
void G::DirectoryList::readType | ( | const Path & | dir, |
const std::string & | suffix, | ||
unsigned int | limit = 0U |
||
) |
An initialiser that is to be used after default construction.
Reads all files that have the given suffix. All file i/o is done in readAll()/readType().
Definition at line 87 of file gdirectory.cpp.
References G::DirectoryIterator::error(), G::DirectoryIterator::fileName(), G::DirectoryIterator::filePath(), G::DirectoryIterator::isDir(), G::DirectoryIterator::more(), G::Path::str(), and G::Str::tailMatch().
Referenced by GSmtp::FileIterator::FileIterator(), and GPop::StoreLock::lock().