Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

FileScan Class Reference

List of all members.

Public Types

typedef read opCall
typedef bool(* Filter )(FilePath)

Public Member Functions

FileScan read (char[] path, char[] ext)
FileScan read (FilePath path, char[] ext)
FileScan read (FilePath path, Filter filter)
FileScan files (void(*visit)(File))
FileScan directories (void(*visit)(FilePath))

Private Member Functions

bool simpleFilter (FilePath fp)
void scanFiles (inout Dependencies deps, FilePath base)

Private Attributes

char[] ext
Dependencies deps
Filter filter

Classes

struct  Dependencies

Detailed Description

Recursively scan files and directories, adding filtered files to an output structure as we go. This can be used to produce a list of subdirectories and the files contained therein. Usage example:

        void files (File file)
        {
                Stdout (file.getPath) (CR);
        }

        void dirs (FilePath path)
        {
                Stdout (path) (CR);
        }

        FileScan scan = new FileScan;

        // find all files with a 'd' extension
        scan ((args.length == 2) ? args[1] : ".", "d");

        Stdout ("directories:") (CR);
        scan.directories (&dirs);

        Stdout (CR) ("files:") (CR);
        scan.files (&files);       

Definition at line 77 of file FileScan.d.


Member Typedef Documentation

typedef read opCall
 

Definition at line 79 of file FileScan.d.

typedef bool(* Filter)(FilePath)
 

Definition at line 85 of file FileScan.d.


Member Function Documentation

FileScan read char[]  path,
char[]  ext
[inline]
 

Read a set of files and directories from the given parent path, where the files are filtered by the given extension.

Definition at line 106 of file FileScan.d.

References FilePath.

Referenced by read().

FileScan read FilePath  path,
char[]  ext
[inline]
 

Read a set of files and directories from the given parent path, where the files are filtered by the given extension.

Definition at line 118 of file FileScan.d.

References ext, read(), and simpleFilter().

FileScan read FilePath  path,
Filter  filter
[inline]
 

Read a set of files and directories from the given parent path, where the files are filtered by the provided delegate.

Definition at line 131 of file FileScan.d.

References deps, FileScan::Dependencies::mods, FileScan::Dependencies::pkgs, and scanFiles().

FileScan files void(*)(File visit  )  [inline]
 

Visit all the files found in the last scan. The delegate should return false to terminate early.

Definition at line 147 of file FileScan.d.

References deps, File, and FileScan::Dependencies::mods.

FileScan directories void(*)(FilePath visit  )  [inline]
 

Visit all directories found in the last scan. The delegate should return false to terminate early.

Definition at line 161 of file FileScan.d.

References deps, FilePath, and FileScan::Dependencies::pkgs.

bool simpleFilter FilePath  fp  )  [inline, private]
 

Local delegate for filtering files based upon a provided extension

Definition at line 175 of file FileScan.d.

References ext, FilePath::getExtension(), and FilePath::getName().

Referenced by read().

void scanFiles inout Dependencies  deps,
FilePath  base
[inline, private]
 

Recursive routine to locate files and sub-directories.

Definition at line 192 of file FileScan.d.

References File, FilePath, filter, and FileProxy::toList().

Referenced by read().


Member Data Documentation

char [] ext [private]
 

Definition at line 81 of file FileScan.d.

Referenced by read(), and simpleFilter().

Dependencies deps [private]
 

Definition at line 82 of file FileScan.d.

Referenced by directories(), files(), and read().

Filter filter [private]
 

Definition at line 83 of file FileScan.d.

Referenced by scanFiles().


The documentation for this class was generated from the following file:
Generated on Fri May 27 18:12:00 2005 for Mango by  doxygen 1.4.0