DirectoryWalk
is used to iterate the entries of a directory in the file system.
foo(const Location & crclLocation, bool bRecurseSubdirs) { DirectoryWalk clDirWalk(crclLocation); while(clDirWalk.isValid()) { if(clDirWalk.isDirectory()) cout << "Directory entry: " << clDirWalk.getNameWithoutPath(); else if(clDirWalk.isFile()) cout << "File: " << clDirWalk.getNameWithoutPath(); else cout << "Weird? " << clDirWalk.getNameWithoutPath(); if(clDirWalk.matchesWildcardPattern("*.cpp")) cout << " C++ source file;"; cout << endl clDirWalk.setToNext(); } }
Public Member Functions | |
~DirectoryWalk (void) | |
Constructors | |
DirectoryWalk (const char *crclDirectory) | |
create a new instance of a directory walker based on a directory | |
Properties | |
bool | isValid (void) const |
return TRUE if the current entry is a valid directory entry | |
bool | isFile (void) const |
return TRUE if the current entry represents a regular file entry | |
bool | isDirectory (void) const |
return TRUE if the current entry represents a directory entry | |
const char * | getNameWithoutPath (void) const |
return the name part of the filename of the current entry | |
bool | matchesWildcardPattern (const char *cpszPattern) const |
return TRUE if the current entry matches the specified wildcard pattern | |
Miscellaneous | |
bool | setToNext (void) |
walk to the next directory entry and return TRUE if there is one |
|
create a new instance of a directory walker based on a directory
|
|
|
|
return TRUE if the current entry is a valid directory entry
|
|
return TRUE if the current entry represents a regular file entry
|
|
return TRUE if the current entry represents a directory entry
|
|
return the name part of the filename of the current entry
|
|
return TRUE if the current entry matches the specified wildcard pattern
|
|
walk to the next directory entry and return TRUE if there is one
|