Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FX::FXDirVisitor Class Reference

Directory visitor walks across all files and directories recursively, starting from the given path. More...

#include <FXDirVisitor.h>

Inheritance diagram for FX::FXDirVisitor:
FX::FXGlobVisitor FX::FXGlobCountVisitor

Public Member Functions

 FXDirVisitor ()
 Initialize directory visitor.
 
FXuint traverse (const FXString &path, FXint limit=1000)
 Start traversal at given path.
 
FXbool visiting () const
 Return true if we're actively visiting directories.
 
const FXStatinfo () const
 Return stats on current file or directory.
 
virtual FXuint enter (const FXString &path)
 Enter directory.
 
virtual FXuint visit (const FXString &path)
 Visit file.
 
virtual FXuint leave (const FXString &path)
 Leave directory.
 
virtual ~FXDirVisitor ()
 Destructor.
 

Detailed Description

Directory visitor walks across all files and directories recursively, starting from the given path.

If the path represents a directory, enter() is called to determine if the directory should be processed. The visitor then recursively processes items in the directory, and concludes by calling leave() to indicate it has left that directory. If the path represents a regular file, visit() is called to process the file. Thus the functions are called in nested fashion, and each successful call to enter() is matched with a call to leave(), and calls to visit() are made for each regular file in between. To influence processing, the three API's can return any of the following values:

0 Skip the entry and proceed to the next item. 1 Continue processing the entry. 2 Abandon processing altogether and return from traverse().

If processing is abandoned, the visitor closes off each unmatched enter() with a call to leave() and returns without visiting any further directories or files. The visitor automatically skips entries already visited or directories with unsufficient permissions. Recursion may be optionally limited with the limit parameter; setting limit equal to 1 traverses the given path only; a setting of 2 traverses the path and its immediate children, but stops there. A limit of 0 does nothing at all. The function info() returns information about the current file or directory being visited; valid only while in enter(), leave(), or visit() callbacks.


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

Copyright © 1997-2022 Jeroen van der Zijp