xmltooling  3.2.0
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>

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. More...
 

Public Member Functions

 DirectoryWalker (logging::Category &log, const char *path, bool recurse=false)
 Constructor. More...
 
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. More...
 

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

◆ DirectoryWalkerCallback

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

◆ DirectoryWalker()

xmltooling::DirectoryWalker::DirectoryWalker ( logging::Category &  log,
const char *  path,
bool  recurse = false 
)

Constructor.

Parameters
loglog category
pathdirectory path to walk
recursetrue iff nested directories should be processed

Member Function Documentation

◆ 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_fncallback function to invoke for each match
callback_dataoptional pointer to pass to callback
startsWithoptional prefix matching, skipping non-matching entries
endsWithoptional suffix matching, skipping non-matching entries

The documentation for this class was generated from the following file: