Portable directory walker that invokes a callback function for every file in a directory, optionally doing depth-first recursion of nested directories.
More...
#include <xmltooling/util/DirectoryWalker.h>
|
typedef void(*) | DirectoryWalkerCallback(const char *pathname, struct stat &stat_buf, void *data) |
| Callback function, passed the file pathname, stat buffer, and optional callback data.
|
|
|
| DirectoryWalker (logging::Category &log, const char *path, bool recurse=false) |
| Constructor.
|
|
void | walk (const DirectoryWalkerCallback &callback_fn, void *callback_data=0, const char *startsWith=0, const char *endsWith=0) const |
| Perform a depth-first traversal of the directory.
|
|
Portable directory walker that invokes a callback function for every file in a directory, optionally doing depth-first recursion of nested directories.
◆ DirectoryWalker()
xmltooling::DirectoryWalker::DirectoryWalker |
( |
logging::Category & | log, |
|
|
const char * | path, |
|
|
bool | recurse = false ) |
Constructor.
- Parameters
-
log | log category |
path | directory path to walk |
recurse | true iff nested directories should be processed |
◆ walk()
void xmltooling::DirectoryWalker::walk |
( |
const DirectoryWalkerCallback & | callback_fn, |
|
|
void * | callback_data = 0, |
|
|
const char * | startsWith = 0, |
|
|
const char * | endsWith = 0 ) const |
|
inline |
Perform a depth-first traversal of the directory.
- Parameters
-
callback_fn | callback function to invoke for each match |
callback_data | optional pointer to pass to callback |
startsWith | optional prefix matching, skipping non-matching entries |
endsWith | optional suffix matching, skipping non-matching entries |
The documentation for this class was generated from the following file: