Scopira
20080306
|
#include <diriterator.h>
Public Member Functions | |
dir_iterator (void) | |
bool | failed (void) const |
bool | open (const std::string &dirname) |
void | close (void) |
bool | next (std::string &out) |
This class iterates of a collection of files in a directory, giving you a list of file names.
Typical usage of this class:
scopira::tool::dir_iterator::dir_iterator | ( | void | ) |
Constructor.
void scopira::tool::dir_iterator::close | ( | void | ) |
Closes the current iteration.
You typically never need to call this as the iterator will close the stream upon its destruction or if you open another iteration.
Referenced by failed().
|
inline |
bool scopira::tool::dir_iterator::next | ( | std::string & | out | ) |
Get the next filename in the iteration. Only the filename will be returned, there will be no path element attached. You typically put this call in a while loop. The dir_iterator must have previously been succesfully opened.
out | the output string (useful only if this call is succesful) |
Referenced by failed().
bool scopira::tool::dir_iterator::open | ( | const std::string & | dirname | ) |
Opens a directory for iteration.
dirname | the directory to open |
Referenced by failed().