Loading...
Searching...
No Matches
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.
 ~directoryIterator ()
 Destructor.
bool exists () const noexcept
 Directory open succeeded.
bool good () const noexcept
 Directory pointer is valid.
void close ()
 Close directory.
const std::string & val () const noexcept
 The current item.
bool next ()
 Read next item, always ignoring "." and ".." entries.
 operator bool () const noexcept
 Same as good().
const std::string & operator* () const noexcept
 Same as val().
directoryIteratoroperator++ ()
 Same as next().

Detailed Description

A simple directory contents iterator.

Definition at line 164 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 194 of file POSIX.C.

Referenced by operator++().

Here is the caller graph for this function:

◆ ~directoryIterator()

~directoryIterator ( )
inline

Destructor.

Definition at line 213 of file POSIX.C.

References close().

Here is the call graph for this function:

Member Function Documentation

◆ exists()

bool exists ( ) const
inlinenoexcept

Directory open succeeded.

Definition at line 224 of file POSIX.C.

References Foam::noexcept.

Referenced by Foam::readDir(), and Foam::rmDir().

Here is the caller graph for this function:

◆ good()

bool good ( ) const
inlinenoexcept

Directory pointer is valid.

Definition at line 232 of file POSIX.C.

References Foam::noexcept.

Referenced by operator bool().

Here is the caller graph for this function:

◆ close()

void close ( )
inline

Close directory.

Definition at line 240 of file POSIX.C.

Referenced by next(), and ~directoryIterator().

Here is the caller graph for this function:

◆ val()

const std::string & val ( ) const
inlinenoexcept

The current item.

Definition at line 252 of file POSIX.C.

References Foam::noexcept.

Referenced by 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 263 of file POSIX.C.

References close().

Referenced by operator++().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator bool()

operator bool ( ) const
inlinenoexcept

Same as good().

Definition at line 287 of file POSIX.C.

References good(), and Foam::noexcept.

Here is the call graph for this function:

◆ operator*()

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

Same as val().

Definition at line 295 of file POSIX.C.

References Foam::noexcept, and val().

Here is the call graph for this function:

◆ operator++()

directoryIterator & operator++ ( )
inline

Same as next().

Definition at line 303 of file POSIX.C.

References directoryIterator(), and next().

Here is the call graph for this function:

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