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

directoryreader.h

Go to the documentation of this file.
00001 /*!\file directoryreader.h
00002         \brief Declerations for the DirectoryReader.
00003         Should be included wherever it is used.*/
00004 
00005 #ifndef __DIRECTORYREADER_H__
00006 #define __DIRECTORYREADER_H__
00007 
00008 #include <dirent.h>
00009 #include "pmstring.h"
00010 #include <vector>
00011 
00012 //!Reads what files/folders are in a directory.
00013 /*!Class that reads in directories and will provide a vector
00014   of all the files within that directory.*/
00015 class DirectoryReader
00016 {
00017         public:
00018                 DirectoryReader();                                                      //!<Constructor.
00019                 DirectoryReader(PMString directoryName);        //!<Constructor that opens directoryName.
00020                 ~DirectoryReader();                                                     //!<Destructor.
00021         
00022                 std::vector<PMString> ListDir(PMString directoryName);  //!<Return vector of PMStrings of files in directoryName.
00023                 void openDir(PMString directoryName);                                   //!<Open directoryName.
00024                 void closeDir();                                                                                //!<Close current directory.
00025                 PMString getFileName();                                                                 //!<Get the next filename in the directory.
00026                 PMString getFileName(int index);                                                //!<Get the filename located at index in the list ( starting at 0 ).
00027                 dirent **getDirent();                                                                   //!<Return the dirent.
00028         
00029         protected:
00030                 void _freeDirent();                     //!<Free the memory used by dirent.
00031                 int _currentFileNameIndex;      //!<The index of the file last sent by getFileName().
00032                 int _filesInDirectory;          //!<The number of files in the scanned directory.
00033                 dirent **_dirList;                      //!<The dirent.
00034 };
00035 
00036 #endif

Generated on Wed May 25 15:29:54 2005 for Package Management System for Gentoo Linux by  doxygen 1.4.1