oaDirIter Class Reference


Public Methods

 oaDirIter (const oaString &dirPathIn, oaDirIterModeEnum modeIn=oacAllDirIterMode)
 oaDirIter (const oaString &dirPathIn, const oaString &wildcardNameIn, oaDirIterModeEnum modeIn=oacAllDirIterMode)
 ~oaDirIter ()
oaBoolean getNext (oaString &name)
void reset ()

Detailed Description

The oaDirIter utility class implements a general iterator for iterating the names of items in a directory. The oaDirIter may be customized by specifying the type of objects returned to be restricted to files (oacFilesDirIterMode), restricted to directories (oacDirsDirIterMode), or unrestricted (oacAllDirIterMode).

Additionally, the user may optionally specify a wildcard string for name filtering.

Note that the oaDirIter only returns names of file system objects, and has no direct connection with the oaFSComponent class objects.


Constructor & Destructor Documentation

oaDirIter::oaDirIter const oaString &    dirPathIn,
oaDirIterModeEnum    modeIn = oacAllDirIterMode
 

This is one of the constructors for the oaDirIter class. The user can specify whether to iterate over files, directories, or both according to the value of modeIn, as follows:

oacFilesDirIterMode restrict iterator to files, oacDirsDirIterMode restrict iterator to directories oacAllDirIterMode unrestricted; iterate over both directories and files. This is the default mode.

Note that the oaDirIter only returns names of file system objects, and has no direct connection with the oaFSComponent class objects.

Parameters:
dirPathIn The directory to be iterated.
modeIn The iteration mode (see above).
Exceptions:
oacUnableToOpenDir 

oaDirIter::oaDirIter const oaString &    dirPathIn,
const oaString &    wildcardNameIn,
oaDirIterModeEnum    modeIn = oacAllDirIterMode
 

As with the first version of the oaDirIter constructor above, this version allows the user to specify whether to iterate over files, directories, or both according to the value of modeIn, as follows:

oacFilesDirIterMode restrict iterator to files oacDirsDirIterMode restrict iterator to directories oacAllDirIterMode unrestricted; iterate over both directories and files. This is the default mode.

In addition, the user may optionally specify a string wildcard for name filtering.

Note that the oaDirIter only returns names of file system objects, and has no direct connection with the oaFSComponent class objects.

Parameters:
dirPathIn The directory to be iterated.
wildcardNameIn The wildcard name, which is applied to files and subdirectories in the search path.
modeIn The iteration mode.
Exceptions:
oacUnableToOpenDir 

oaDirIter::~oaDirIter  
 

This is the destructor for the oaDirIter class.


Member Function Documentation

oaBoolean oaDirIter::getNext oaString &    name
 

This function returns the name of the next entry in the directory associated with this iterator. NULL is returned if all entries have been iterated. This function does not return the special directory entries "." and "..".

Note that the oaDirIter only returns names of file system objects, and has no direct connection with the oaFSComponent class objects.

Parameters:
name The name of the next entry.

void oaDirIter::reset  
 

This function resets the iterator, causing it to starting iterating from the beginning of the directory list again.

Exceptions:
oacUnableToOpenDir 


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

Return to top of page