YGP::PathDirectorySearch Class Reference

Class to search for files in directories listed in a path. More...

Inherits YGP::DirectorySearch.

List of all members.

Public Member Functions

void setPath (const std::string &newPath)
Section manager-functions
 PathDirectorySearch ()
 PathDirectorySearch (const std::string &srcPath)
 PathDirectorySearch (const std::string &srcPath, const std::string &search)
virtual ~PathDirectorySearch ()
Searching
const Filefind (const std::string &path, const std::string &search, unsigned long attribs=FILE_NORMAL)
const Filefind (const std::string &search, unsigned long attribs=FILE_NORMAL)
virtual const Filefind (unsigned long attribs=FILE_NORMAL)
virtual const Filenext ()


Detailed Description

Class to search for files in directories listed in a path.

This search can be restricted to files matching certain name-criterias or by attributes.

The name-part of the files to search supports UNIX-like wildcards; that are the asterisk (*) for any number of any characters, the question-mark for any single character and a set of characters in brackets (([) and (])). This set can contain a list of characters (like [abcde]) or a region (like [a-e]). To invert this set use a leading caret (^) or a leading exclamation mark (!), like ([^a-e]).

The found (and matching) files are retrieved by objects of type File.

Note: The class does not do any word expansion for the search-path (like expanding the tilde (~) to the home-directory)!


Constructor & Destructor Documentation

YGP::PathDirectorySearch::PathDirectorySearch (  )  [inline]

Default constructur; creates an empty object, not ready to search for files.

YGP::PathDirectorySearch::PathDirectorySearch ( const std::string &  srcPath  )  [inline]

Constructur; creates an object with an path to files in.

Parameters:
srcPath Path to search files in

YGP::PathDirectorySearch::PathDirectorySearch ( const std::string &  srcPath,
const std::string &  search 
) [inline]

Constructur; creates an object with a path to files in and the files to search for.

Parameters:
path srcPath to search files in
search Specification of files to search in path

YGP::PathDirectorySearch::~PathDirectorySearch (  )  [virtual]

Destructor.


Member Function Documentation

const File * YGP::PathDirectorySearch::find ( unsigned long  attribs = FILE_NORMAL  )  [virtual]

Searches for first file matching the input specified by the constructor(s) or the set-methods.

If a search within a node of the path returns an error, continue with the next node.

Parameters:
attribs Attributes the file must contain
Returns:
const File* Pointer to found file-object
Precondition:
The values to search for must have been set before!
Remarks:
Every node of the path is tilde-expanded (UNIX-like to the home directory).

Reimplemented from YGP::DirectorySearch.

const File* YGP::PathDirectorySearch::find ( const std::string &  search,
unsigned long  attribs = FILE_NORMAL 
) [inline]

Searches for the specified files with the passed attributes in all the nodes specified by path.

Returns:
const File* Pointer to found file or NULL

Reimplemented from YGP::DirectorySearch.

const File* YGP::PathDirectorySearch::find ( const std::string &  path,
const std::string &  search,
unsigned long  attribs = FILE_NORMAL 
) [inline]

Searches for the specified files with the passed attributes in all the nodes specified by path.

Returns:
const File* Pointer to found file or NULL

const File * YGP::PathDirectorySearch::next (  )  [virtual]

Returns the next matching file according to parameters specified in earlier find-calls.

If a search within a node of the path returns an error, continue with the next node.

Returns:
const File* Pointer to found file-object or NULL
Precondition:
The search must have already been started by a find!
Remarks:
Every node of the path is tilde-expanded (UNIX-like to the home directory).

Reimplemented from YGP::DirectorySearch.

void YGP::PathDirectorySearch::setPath ( const std::string &  newPath  )  [inline]

Sets/Changes the path to search in.


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

YGP Version 0.9.31 - Generated on Wed Nov 18 11:25:28 2009 by doxygen 1.5.8