xmltooling::DirectoryWalker Class Reference

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>

List of all members.

Public Types

typedef void(* DirectoryWalkerCallback )(const char *pathname, struct stat &stat_buf, void *data)
 Callback function, passed the file pathname, stat buffer, and optional callback data.

Public Member Functions

 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.

Detailed Description

Portable directory walker that invokes a callback function for every file in a directory, optionally doing depth-first recursion of nested directories.


Member Typedef Documentation

typedef void(* xmltooling::DirectoryWalker::DirectoryWalkerCallback)(const char *pathname, struct stat &stat_buf, void *data)

Callback function, passed the file pathname, stat buffer, and optional callback data.


Constructor & Destructor Documentation

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

Member Function Documentation

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:

Generated on 24 Jan 2020 for xmltooling by  doxygen 1.6.1