Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

DirectoryReader Class Reference

Reads what files/folders are in a directory. More...

#include <directoryreader.h>

List of all members.

Public Member Functions

 DirectoryReader ()
 Constructor.
 DirectoryReader (PMString directoryName)
 Constructor that opens directoryName.
 ~DirectoryReader ()
 Destructor.
std::vector< PMStringListDir (PMString directoryName)
 Return vector of PMStrings of files in directoryName.
void openDir (PMString directoryName)
 Open directoryName.
void closeDir ()
 Close current directory.
PMString getFileName ()
 Get the next filename in the directory.
PMString getFileName (int index)
 Get the filename located at index in the list ( starting at 0 ).
dirent ** getDirent ()
 Return the dirent.

Protected Member Functions

void _freeDirent ()
 Free the memory used by dirent.

Protected Attributes

int _currentFileNameIndex
 The index of the file last sent by getFileName().
int _filesInDirectory
 The number of files in the scanned directory.
dirent ** _dirList
 The dirent.


Detailed Description

Class that reads in directories and will provide a vector of all the files within that directory.


Constructor & Destructor Documentation

DirectoryReader::DirectoryReader  ) 
 

Empty Constructor.

DirectoryReader::DirectoryReader PMString  directoryName  ) 
 

Constructor that opens a directory straight away.

Parameters:
directoryName Opens the directory at directoryName.
Exceptions:
DirectoryException(scanf_error,directoryName) if scanf returns with an error.

DirectoryReader::~DirectoryReader  ) 
 

Destructor, makes sure we have freed.


Member Function Documentation

void DirectoryReader::_freeDirent  )  [protected]
 

Free the dirent.

void DirectoryReader::closeDir  ) 
 

Close the dir.

dirent ** DirectoryReader::getDirent  ) 
 

Get the dirent.

Returns:
The dirent. The underlying C struct used by scanf().

PMString DirectoryReader::getFileName int  index  ) 
 

Returns the numbered filename from the list. Throws DirectoryException when the filename does not exist.

Parameters:
index The filename to get.
Exceptions:
DirectoryException(0) if the filename is out of bounds.

PMString DirectoryReader::getFileName  ) 
 

Returns the next filename from the list. Throws DirectoryException when there are no more filenames to get.

Returns:
The next filename in the directory.
Exceptions:
DirectoryException(0) if there are no more filenames to give.

std::vector< PMString > DirectoryReader::ListDir PMString  directoryName  ) 
 

Get a vector full of the files in directory in directoryName in alphabetical order.

Parameters:
directoryName The directory to scan.
Returns:
A vector of all the filenames in the directory.
Exceptions:
DirectoryException(scanf_error,directoryName) if scanf returns with an error.

void DirectoryReader::openDir PMString  directoryName  ) 
 

Open a directory, throws a DirectoryException if error opening a directory.

Parameters:
directoryName The directory to open.
Exceptions:
DirectoryException(scanf_error,directoryName) if scanf returns with an error.


The documentation for this class was generated from the following files:
Generated on Wed May 25 15:29:54 2005 for Package Management System for Gentoo Linux by  doxygen 1.4.1