Dir Class Reference

Directory reading support. More...

#include <Dir.h++>

Collaboration diagram for Dir:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Dir (const String &path)
 Construct a new Dir object for the given path.
 ~Dir () throw ()
 Destructor.
void open (bool listHidden=false, bool listDot=false) throw (IOException)
 Open the directory.
void close () throw ()
 Close the directory.
void rewind () throw (IOException)
 Rewind the directory.
bool isOpen () const throw ()
 Test if the directory is currently open.
bool nextFile (String &name, FileAttributes &attrib, bool fetchPermissions=false)
 Retrieve the next file from the directory.


Detailed Description

Directory reading support.

The class provides a means of enumerating through the files in a directory.

Author:
Mark Lindner

Constructor & Destructor Documentation

Dir ( const String path  ) 

Construct a new Dir object for the given path.

Parameters:
path The path to the directory.

~Dir (  )  throw ()

Destructor.


Member Function Documentation

void close (  )  throw ()

Close the directory.

If the directory is already closed, the method has no effect.

bool isOpen (  )  const throw () [inline]

Test if the directory is currently open.

bool nextFile ( String name,
FileAttributes attrib,
bool  fetchPermissions = false 
)

Retrieve the next file from the directory.

Parameters:
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.
Returns:
true if the information was successfully retrieved, false if the end of the directory has been reached.

void open ( bool  listHidden = false,
bool  listDot = false 
) throw (IOException)

Open the directory.

If the directory is already open, the method has no effect.

Parameters:
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.
Exceptions:
IOException If the directory could not be opened.

void rewind (  )  throw (IOException)

Rewind the directory.

On some platforms this entails closing and re-opening the directory.

Exceptions:
IOException If the directory could not be rewound.


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

Generated on Sat Apr 17 23:03:08 2010 for libcommonc++ by  doxygen 1.5.9