jigdo API

RecurseDir Class Reference

A filename generator; feed it names of single files or directories, it will output them, recursing depth-first through directories. More...

#include <recursedir.hh>

List of all members.


Public Member Functions

 RecurseDir ()
 ~RecurseDir ()
void addFile (const char *name)
 Provide single file/directory name to output or recurse into.
void addFile (const string &name)
 Provide single file/directory name to output or recurse into.
void addFilesFrom (const char *name)
 To read filenames from stdin, pass an empty string.
void addFilesFrom (const string &name)
bool empty () const
 Are there no filename sources present at all?
bool getName (string &result, struct stat *fileInfo=0, bool checkFiles=true) throw (RecurseError, bad_alloc)
 Returns FAILURE if no more names.

Classes

struct  DevIno
struct  Level

Detailed Description

A filename generator; feed it names of single files or directories, it will output them, recursing depth-first through directories.

It does follow symlinks, but will not output more than one name for an inode, and avoid symlink loops. If an inode can be reached both through its "normal" name and through symlinks during recursion into one directory, it is guaranteed that the normal name will be listed.


Constructor & Destructor Documentation

RecurseDir::RecurseDir (  )  [inline]

RecurseDir::~RecurseDir (  )  [inline]


Member Function Documentation

void RecurseDir::addFile ( const char *  name  )  [inline]

Provide single file/directory name to output or recurse into.

Referenced by main().

void RecurseDir::addFile ( const string &  name  )  [inline]

Provide single file/directory name to output or recurse into.

void RecurseDir::addFilesFrom ( const char *  name  )  [inline]

To read filenames from stdin, pass an empty string.

Referenced by main().

void RecurseDir::addFilesFrom ( const string &  name  )  [inline]

bool RecurseDir::empty (  )  const [inline]

Are there no filename sources present at all?

bool RecurseDir::getName ( string &  result,
struct stat *  fileInfo = 0,
bool  checkFiles = true 
) throw (RecurseError, bad_alloc)

Returns FAILURE if no more names.

After a RecurseError has been thrown, it is no problem to continue using the object.

Parameters:
result Returned filename (output only)
fileInfo getName() must call stat() for any filename it returns, in order to determine whether it is a directory. If the information returned by stat() is useful for you, supply your own struct stat for getName() to use.
checkFiles if true, normal operation, check whether files exist before using cache entries. If false, only check whether cache entry present and return it if so.

References isSymlink(), throw_RecurseError_forDir(), and throw_RecurseError_forObject().

Referenced by main(), and JigdoCache::readFilenames().


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

Generated on Tue Sep 23 14:27:43 2008 for jigdo by  doxygen 1.5.6