E-MailRelay
|
A iterator similar to G::DirectoryIterator but doing all file i/o in one go and providing a sorted result. 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... | |
std::size_t | readAll (const Path &dir) |
An initialiser that is to be used after default construction. More... | |
std::size_t | readType (const Path &dir, std::string_view suffix, unsigned int limit=0U) |
An initialiser that is to be used after default construction. More... | |
std::size_t | readDirectories (const Path &dir, unsigned int limit=0U) |
An initialiser that reads all sub-directories. More... | |
bool | empty () const noexcept |
Returns true if empty. 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... | |
bool | isLink () const |
Returns true if the current item is a symlink. More... | |
Path | filePath () const |
Returns the current path. More... | |
std::string | fileName () const |
Returns the current filename. More... | |
Static Public Member Functions | |
static void | readAll (const Path &dir, std::vector< Item > &out) |
A static overload returning by reference a collection of Items, sorted by name. More... | |
A iterator similar to G::DirectoryIterator but doing all file i/o in one go and providing a sorted result.
This can be useful when temporarily adopting additional process privileges to read a directory.
Definition at line 149 of file gdirectory.h.
|
default |
Default constructor for an empty list.
Initialise with one of the three read methods to do all the file i/o in one go.
|
noexcept |
Returns true if empty.
Definition at line 124 of file gdirectory.cpp.
std::string G::DirectoryList::fileName | ( | ) | const |
Returns the current filename.
Definition at line 163 of file gdirectory.cpp.
G::Path G::DirectoryList::filePath | ( | ) | const |
Returns the current path.
Definition at line 158 of file gdirectory.cpp.
bool G::DirectoryList::isDir | ( | ) | const |
Returns true if the current item is a directory.
Definition at line 153 of file gdirectory.cpp.
bool G::DirectoryList::isLink | ( | ) | const |
Returns true if the current item is a symlink.
Definition at line 147 of file gdirectory.cpp.
bool G::DirectoryList::more | ( | ) |
Returns true if more and advances by one.
Definition at line 130 of file gdirectory.cpp.
std::size_t 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 82 of file gdirectory.cpp.
A static overload returning by reference a collection of Items, sorted by name.
Definition at line 74 of file gdirectory.cpp.
std::size_t G::DirectoryList::readDirectories | ( | const Path & | dir, |
unsigned int | limit = 0U |
||
) |
An initialiser that reads all sub-directories.
Definition at line 88 of file gdirectory.cpp.
std::size_t G::DirectoryList::readType | ( | const Path & | dir, |
std::string_view | suffix, | ||
unsigned int | limit = 0U |
||
) |
An initialiser that is to be used after default construction.
Reads all files that have the given suffix (unsorted).
Definition at line 94 of file gdirectory.cpp.