directoryIterator Class Reference

A simple directory contents iterator. More...

Public Member Functions

 directoryIterator (const std::string &dirName, bool allowHidden=false)
 Construct for dirName, optionally allowing hidden files/dirs. More...
 
 ~directoryIterator ()
 Destructor. More...
 
bool exists () const noexcept
 Directory open succeeded. More...
 
bool good () const noexcept
 Directory pointer is valid. More...
 
void close ()
 Close directory. More...
 
const std::string & val () const noexcept
 The current item. More...
 
bool next ()
 Read next item, always ignoring "." and ".." entries. More...
 
 operator bool () const noexcept
 Same as good() More...
 
const std::string & operator* () const noexcept
 Same as val() More...
 
directoryIteratoroperator++ ()
 Same as next() More...
 

Detailed Description

A simple directory contents iterator.

Definition at line 119 of file POSIX.C.

Constructor & Destructor Documentation

◆ directoryIterator()

directoryIterator ( const std::string &  dirName,
bool  allowHidden = false 
)
inline

Construct for dirName, optionally allowing hidden files/dirs.

Definition at line 145 of file POSIX.C.

References directoryIterator::next().

Here is the call graph for this function:

◆ ~directoryIterator()

~directoryIterator ( )
inline

Destructor.

Definition at line 162 of file POSIX.C.

References directoryIterator::close().

Here is the call graph for this function:

Member Function Documentation

◆ exists()

bool exists ( ) const
inlinenoexcept

Directory open succeeded.

Definition at line 171 of file POSIX.C.

◆ good()

bool good ( ) const
inlinenoexcept

Directory pointer is valid.

Definition at line 177 of file POSIX.C.

Referenced by directoryIterator::operator bool().

Here is the caller graph for this function:

◆ close()

void close ( )
inline

Close directory.

Definition at line 183 of file POSIX.C.

Referenced by directoryIterator::~directoryIterator().

Here is the caller graph for this function:

◆ val()

const std::string & val ( ) const
inlinenoexcept

The current item.

Definition at line 193 of file POSIX.C.

Referenced by directoryIterator::operator*().

Here is the caller graph for this function:

◆ next()

bool next ( )
inline

Read next item, always ignoring "." and ".." entries.

Normally also ignore hidden files/dirs (beginning with '.') Automatically close when there are no more items

Definition at line 201 of file POSIX.C.

Referenced by directoryIterator::directoryIterator(), and directoryIterator::operator++().

Here is the caller graph for this function:

◆ operator bool()

operator bool ( ) const
inlinenoexcept

Same as good()

Definition at line 223 of file POSIX.C.

References directoryIterator::good().

Here is the call graph for this function:

◆ operator*()

const std::string & operator* ( ) const
inlinenoexcept

Same as val()

Definition at line 229 of file POSIX.C.

References directoryIterator::val().

Here is the call graph for this function:

◆ operator++()

directoryIterator & operator++ ( )
inline

Same as next()

Definition at line 235 of file POSIX.C.

References directoryIterator::next().

Here is the call graph for this function:

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