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 existed for opening. 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 111 of file MSwindows.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 135 of file MSwindows.C.

References directoryIterator::good(), and directoryIterator::next().

Here is the call graph for this function:

◆ ~directoryIterator()

~directoryIterator ( )
inline

Destructor.

Definition at line 164 of file MSwindows.C.

References directoryIterator::close().

Here is the call graph for this function:

Member Function Documentation

◆ exists()

bool exists ( ) const
inlinenoexcept

Directory existed for opening.

Definition at line 173 of file MSwindows.C.

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 179 of file MSwindows.C.

Referenced by directoryIterator::close(), directoryIterator::directoryIterator(), and directoryIterator::operator bool().

Here is the caller graph for this function:

◆ close()

void close ( )
inline

Close directory.

Definition at line 185 of file MSwindows.C.

References directoryIterator::good().

Referenced by directoryIterator::~directoryIterator().

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

◆ val()

const std::string & val ( ) const
inlinenoexcept

The current item.

Definition at line 195 of file MSwindows.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 it runs out of items

Definition at line 203 of file MSwindows.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 228 of file MSwindows.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 234 of file MSwindows.C.

References directoryIterator::val().

Here is the call graph for this function:

◆ operator++()

directoryIterator & operator++ ( )
inline

Same as next()

Definition at line 240 of file MSwindows.C.

References directoryIterator::next().

Here is the call graph for this function:

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