#include <dirscanner.h>

Classes | |
| class | DirPos |
Public Member Functions | |
| DirectoryScanner (QString extension) | |
| DirectoryScanner (QString dir, QString extension, bool rec=true) | |
| virtual void | reset (const QString dirname, unsigned4 files_per_turn=0xffffffff) |
| void | set_file_per_turn (unsigned4 fpt) |
| virtual unsigned4 | scan () |
Static Public Member Functions | |
| static bool | goodName (QString name) |
Protected Member Functions | |
| virtual void | recursing (const QString dir) |
| virtual void | checkfile (const QString dir, const QString filename)=0 |
| virtual bool | matchextension (const QString filename) |
| virtual | ~DirectoryScanner () |
Protected Attributes | |
| bool | recurse |
| int | prefix_length |
| QString | required_extension |
The directory scanner provides the possibility to scan a directory tree in specific chunk sizes. For each filename it will check its extension, and if it matches it will call the checkFile virtual function.
| virtual DirectoryScanner::~DirectoryScanner | ( | ) | [inline, protected, virtual] |
| DirectoryScanner::DirectoryScanner | ( | QString | extension | ) |
Will create a directory scanner which will target the required extension. To use it first reset it to a certain directory and then use scan()
| DirectoryScanner::DirectoryScanner | ( | QString | dir, | |
| QString | extension, | |||
| bool | rec = true | |||
| ) |
Creates a directory scanner that will target the given extension and start searching for files under
References reset().
| virtual void DirectoryScanner::checkfile | ( | const QString | dir, | |
| const QString | filename | |||
| ) | [protected, pure virtual] |
Called for each file that has a proper extension.
Implemented in RawScanner, FragScanner, IndexScanner, LogViewer, MusicScanner, and RenamerLogic.
| bool DirectoryScanner::goodName | ( | QString | name | ) | [static] |
References goodExtension(), IdxExt, and OneSpace.
Referenced by RenamerLogic::add().
| bool DirectoryScanner::matchextension | ( | const QString | filename | ) | [protected, virtual] |
The function used to check whether the extension matches If the extension does not match the file is not sent to checkfile. The standard function will check the required_extension.
Reimplemented in MusicScanner, and RenamerLogic.
References required_extension.
| void DirectoryScanner::recursing | ( | const QString | dir | ) | [protected, virtual] |
| void DirectoryScanner::reset | ( | const QString | dirname, | |
| unsigned4 | files_per_turn = 0xffffffff | |||
| ) | [virtual] |
Will reset the scanner into a certain directory. Normally all files will be scanned at once. If necessary to use smaller chunk sizes use the files_per_turn argument.
References prefix_length.
Referenced by DirectoryScanner(), MusicScanner::MusicScanner(), and RenamerLogic::scan().
| unsigned4 DirectoryScanner::scan | ( | ) | [virtual] |
Will scan a collection of files. It returns the number of files found, which is not the same as the number of satisfactory files found. If this function returns 0, then the process has ended.
References recurse, recursing(), and slash.
Referenced by SongSelectorLogic::importSongs(), LogViewer::LogViewer(), main(), RenamerLogic::scan(), and ActiveIndexReader::thunk().
| void DirectoryScanner::set_file_per_turn | ( | unsigned4 | fpt | ) | [inline] |
Referenced by ActiveIndexReader::start().
int DirectoryScanner::prefix_length [protected] |
The length of the initial directory. This can be used in check_file to strip the common root from the files that are being checked
Referenced by MusicScanner::checkfile(), and reset().
bool DirectoryScanner::recurse [protected] |
Should we recurse into sub directories
Referenced by scan().
QString DirectoryScanner::required_extension [protected] |
The required extension before a file can be send to checkFile
Referenced by matchextension().
1.6.2