libcommonc++
0.7
|
Directory reading support. More...
#include <Dir.h++>
Public Member Functions | |
Dir (const String &path) | |
Construct a new Dir object for the given path. More... | |
~Dir () | |
Destructor. More... | |
void | open (bool listHidden=false, bool listDot=false) |
Open the directory. More... | |
void | close () |
Close the directory. More... | |
void | rewind () |
Rewind the directory. More... | |
bool | isOpen () const |
Test if the directory is currently open. More... | |
bool | nextFile (String &name, FileAttributes &attrib, bool fetchPermissions=false) |
Retrieve the next file from the directory. More... | |
Directory reading support.
The class provides a means of enumerating through the files in a directory.
Construct a new Dir object for the given path.
path | The path to the directory. |
~Dir | ( | ) |
Destructor.
void close | ( | ) |
Close the directory.
If the directory is already closed, the method has no effect.
|
inline |
Test if the directory is currently open.
bool nextFile | ( | String & | name, |
FileAttributes & | attrib, | ||
bool | fetchPermissions = false |
||
) |
Retrieve the next file from the directory.
name | The String in which to place the file's name. |
attrib | The FileAttributes object in which to place the file's attributes. |
fetchPermissions | A flag indicating whether the file permissions should be fetched for the file. This is a very slow operation on Windows, hence by default this option is disabled. On POSIX systems, this flag is ignored because fetching the file permissions has no overhead. |
void open | ( | bool | listHidden = false , |
bool | listDot = false |
||
) |
Open the directory.
If the directory is already open, the method has no effect.
listHidden | A flag indicating whether hidden files (as defined for the host platform) should be listed or ignored. |
listDot | A flag indicating whether the files '.' and '..' should be listed or ignored. |
IOException | If the directory could not be opened. |
void rewind | ( | ) |
Rewind the directory.
On some platforms this entails closing and re-opening the directory.
IOException | If the directory could not be rewound. |