E-MailRelay

Classes | Public Member Functions | Static Public Member Functions | List of all members
G::DirectoryList Class Reference

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...

## Detailed Description

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.

## Constructor & Destructor Documentation

## ◆ DirectoryList()

G::DirectoryList::DirectoryList | ( |  | ) |
| 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.

## Member Function Documentation

## ◆ fileName()

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.

## ◆ filePath()

G::Path G::DirectoryList::filePath | ( |  | ) | const

Returns the current path.

Definition at line 133 of file gdirectory.cpp.

## ◆ isDir()

bool G::DirectoryList::isDir | ( |  | ) | const

Returns true if the current item is a directory.

Definition at line 128 of file gdirectory.cpp.

## ◆ more()

bool G::DirectoryList::more | ( |  | ) |

Returns true if more and advances by one.

Definition at line 112 of file gdirectory.cpp.

## ◆ readAll() [1/2]

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.

## ◆ readAll() [2/2]

void G::DirectoryList::readAll | ( | const Path & | dir,
|  | std::vector< Item > & | out,
|  | bool | sorted
| ) |  |
| static

A static overload returning by reference a collection of Items.

Definition at line 75 of file gdirectory.cpp.

## ◆ readType()

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.

## ◆ sort()

void G::DirectoryList::sort | ( |  | ) |

Sorts the files lexicographically.

Definition at line 148 of file gdirectory.cpp.

The documentation for this class was generated from the following files:

- /usr/src/slapt-src-x86_64/network/emailrelay/emailrelay-2.3/src/glib/gdirectory.h
- /usr/src/slapt-src-x86_64/network/emailrelay/emailrelay-2.3/src/glib/gdirectory.cpp