#include <FileTraverser.h++>

Public Member Functions | |
| FileTraverser (const String &basePath, bool depthFirst=true) | |
| Construct a new FileTraverser rooted at the given base path. | |
| virtual | ~FileTraverser () throw () |
| Destructor. | |
| void | setPrunePattern (const RegExp &pattern) |
| Set a prune pattern for the traverser. | |
| bool | traverse () |
| Traverse the file tree. | |
Protected Member Functions | |
| virtual bool | processFile (const FileName &name, bool isDir, uint_t depth)=0 |
| Process the next file or directory encountered. | |
| virtual bool | handleError (const FileName &name, const IOException &ex) |
| Handle an exception during traversal. | |
This is an abstract class; subclasses must implement the processFile() function to process each file and directory encountered during the traversal.
| FileTraverser | ( | const String & | basePath, | |
| bool | depthFirst = true | |||
| ) |
Construct a new FileTraverser rooted at the given base path.
| basePath | The base path at which traversal will begin. | |
| depthFirst | If true, traversal will be depth-first; otherwise it will be breadth-first. |
| ~FileTraverser | ( | ) | throw () [virtual] |
Destructor.
| bool handleError | ( | const FileName & | name, | |
| const IOException & | ex | |||
| ) | [protected, virtual] |
Handle an exception during traversal.
The method should return true if traversal should continue, false otherwise. The default implementation is a no-op that simply returns false.
| name | The filename for which the error occurred. | |
| ex | The exception indicating the error. |
| virtual bool processFile | ( | const FileName & | name, | |
| bool | isDir, | |||
| uint_t | depth | |||
| ) | [protected, pure virtual] |
Process the next file or directory encountered.
| name | The filename. | |
| isDir | A flag indicating whether the file is a directory. | |
| depth | The current traversal depth. |
| void setPrunePattern | ( | const RegExp & | pattern | ) | [inline] |
Set a prune pattern for the traverser.
Any file or directory whose name matches the given pattern will be skipped during traversal. Setting a null pattern disables pruning.
| pattern | The prune pattern. |
| bool traverse | ( | ) |
Traverse the file tree.
1.5.9