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 |
uima::util::DirectoryWalk::DirectoryWalk | ( | const char * | crclDirectory | ) | [inline] |
create a new instance of a directory walker based on a directory
References setToNext(), UIMA_ERR_ENGINE_OUT_OF_MEMORY, UIMA_EXC_THROW_NEW, and uima::ErrorInfo::unrecoverable.
uima::util::DirectoryWalk::~DirectoryWalk | ( | void | ) | [inline] |
bool uima::util::DirectoryWalk::isValid | ( | void | ) | const [inline] |
return TRUE if the current entry is a valid directory entry
bool uima::util::DirectoryWalk::isFile | ( | void | ) | const [inline] |
return TRUE if the current entry represents a regular file entry
bool uima::util::DirectoryWalk::isDirectory | ( | void | ) | const [inline] |
return TRUE if the current entry represents a directory entry
const char * uima::util::DirectoryWalk::getNameWithoutPath | ( | void | ) | const [inline] |
return the name part of the filename of the current entry
bool uima::util::DirectoryWalk::matchesWildcardPattern | ( | const char * | cpszPattern | ) | const [inline] |
return TRUE if the current entry matches the specified wildcard pattern
bool uima::util::DirectoryWalk::setToNext | ( | void | ) | [inline] |