E-MailRelay
|
A iterator similar to G::DirectoryIterator but doing all file i/o in one go. More...
#include <gdirectory.h>
Classes | |
struct | Item |
A directory-entry item for G::DirectoryList. More... | |
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... | |
Path | filePath () const |
Returns the current path. More... | |
std::string | fileName () const |
Returns the current filename. More... | |
void | sort () |
Sorts the files lexicographically. More... | |
Static Public Member Functions | |
static void | readAll (const Path &dir, std::vector< Item > &out, bool sorted) |
A static overload returning by reference a collection of Items. More... | |
A iterator similar to G::DirectoryIterator but doing all file i/o in one go.
This is useful when temporarily adopting additional process privileges to read a directory.
Definition at line 145 of file gdirectory.h.
|
default |
Default constructor for an empty list.
Initialise with one of the two read methods to do all the file i/o in one go.
std::string G::DirectoryList::fileName | ( | ) | const |
Returns the current filename.
On Windows any characters that cannot be represented in the active code page are replaced by '?'.
Definition at line 138 of file gdirectory.cpp.
G::Path G::DirectoryList::filePath | ( | ) | const |
Returns the current path.
Definition at line 133 of file gdirectory.cpp.
bool G::DirectoryList::isDir | ( | ) | const |
Returns true if the current item is a directory.
Definition at line 128 of file gdirectory.cpp.
bool G::DirectoryList::more | ( | ) |
Returns true if more and advances by one.
Definition at line 112 of file gdirectory.cpp.
void G::DirectoryList::readAll | ( | const Path & | dir | ) |
An initialiser that is to be used after default construction.
Reads all files in the directory.
Definition at line 83 of file gdirectory.cpp.
A static overload returning by reference a collection of Items.
Definition at line 75 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.
Definition at line 88 of file gdirectory.cpp.
void G::DirectoryList::sort | ( | ) |
Sorts the files lexicographically.
Definition at line 148 of file gdirectory.cpp.