E-MailRelay
Public Member Functions | List of all members
G::DirectoryIterator Class Reference

A iterator that returns unsorted filenames in a directory. More...

#include <gdirectory.h>

Public Member Functions

 DirectoryIterator (const Directory &dir)
 Constructor taking a directory reference. More...
 
 ~DirectoryIterator ()
 Destructor.
 
bool error () const
 Returns true on error. The caller should stop the iteration. More...
 
bool more ()
 Returns true if more and advances by one. More...
 
bool isDir () const
 Returns true if the current item is a directory or a symlink to a directory. More...
 
bool isLink () const
 Returns true if the current item is a symlink. More...
 
std::string sizeString () const
 Returns the file size as a decimal string. More...
 
Path filePath () const
 Returns the path of the current item. More...
 
std::string fileName () const
 Returns the name of the current item. More...
 
 DirectoryIterator (const DirectoryIterator &)=delete
 
 DirectoryIterator (DirectoryIterator &&) noexcept=default
 
DirectoryIteratoroperator= (const DirectoryIterator &)=delete
 
DirectoryIteratoroperator= (DirectoryIterator &&) noexcept=default
 

Detailed Description

A iterator that returns unsorted filenames in a directory.

The iteration model is:

while(iter.more()) { auto path = iter.filePath() ; }

Definition at line 98 of file gdirectory.h.

Constructor & Destructor Documentation

◆ DirectoryIterator()

G::DirectoryIterator::DirectoryIterator ( const Directory dir)
explicit

Constructor taking a directory reference.

Iterates over all files in the directory.

Definition at line 105 of file gdirectory_unix.cpp.

Member Function Documentation

◆ error()

bool G::DirectoryIterator::error ( ) const

Returns true on error. The caller should stop the iteration.

Definition at line 113 of file gdirectory_unix.cpp.

◆ fileName()

std::string G::DirectoryIterator::fileName ( ) const

Returns the name of the current item.

On Windows any characters that cannot be represented in the active code page are replaced by '?'.

Definition at line 128 of file gdirectory_unix.cpp.

◆ filePath()

G::Path G::DirectoryIterator::filePath ( ) const

Returns the path of the current item.

Definition at line 123 of file gdirectory_unix.cpp.

◆ isDir()

bool G::DirectoryIterator::isDir ( ) const

Returns true if the current item is a directory or a symlink to a directory.

Definition at line 138 of file gdirectory_unix.cpp.

◆ isLink()

bool G::DirectoryIterator::isLink ( ) const

Returns true if the current item is a symlink.

Definition at line 133 of file gdirectory_unix.cpp.

◆ more()

bool G::DirectoryIterator::more ( )

Returns true if more and advances by one.

Definition at line 118 of file gdirectory_unix.cpp.

◆ sizeString()

std::string G::DirectoryIterator::sizeString ( ) const

Returns the file size as a decimal string.

The value may be bigger than any integer type can hold.

Definition at line 144 of file gdirectory_unix.cpp.


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