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

A iterator that returns 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. 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
 
void operator= (const DirectoryIterator &)=delete
 
DirectoryIteratoroperator= (DirectoryIterator &&) noexcept=default
 

Detailed Description

A iterator that returns filenames in a directory.

The iteration model is:

while(iter.more()) { (void)iter.filePath() ; }

Definition at line 99 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 103 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 111 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 126 of file gdirectory_unix.cpp.

◆ filePath()

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

Returns the path of the current item.

Definition at line 121 of file gdirectory_unix.cpp.

◆ isDir()

bool G::DirectoryIterator::isDir ( ) const

Returns true if the current item is a directory.

Definition at line 131 of file gdirectory_unix.cpp.

◆ more()

bool G::DirectoryIterator::more ( )

Returns true if more and advances by one.

Definition at line 116 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 136 of file gdirectory_unix.cpp.


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