#include <filevisitor.h>
Public Slots | ||||
| void | processFileList (QStringList sl) | |||
| Convenience method for processing a list of file specs. | ||||
| void | processEntry (QString pathname) | |||
| processes a single directory entry Does not care if it is a directory or a file - does all the proper checking before calling the appropriate function, processFile() on files, or processDir() on directories. | ||||
Signals | ||||
| void | foundFile (QString filename) | |||
| emitted whenever a file is found | ||||
Public Member Functions | ||||
| FileVisitor (QString nameFilter="*", bool recursive=true, bool symlinks=false) | ||||
| ||||
| FileVisitor (QStringList nameFilterList, bool recursive=true, bool symlinks=false) | ||||
| void | addNameFilter (QString nf) | |||
| ||||
| void | setFilters (QStringList filters) | |||
| void | setRecursive (bool r) | |||
| void | clearFilter () | |||
Static Public Member Functions | ||||
| static QStringList | readLines (QFile &f) | |||
| helper Function for reading all lines from a file in one line | ||||
| static QStringList | readLines (QString fn) | |||
| helper function for reading all lines from a file in one line | ||||
| static QString | expandTilde (QString path) | |||
| expands ~ only, not ~username. | ||||
Protected Member Functions | ||||
| virtual void | processFile (QString filename) | |||
| override this to customize behavior | ||||
| void | processEntry (QFileInfo finfo) | |||
| processEntry(QString) is a convenience function which calls this method. | ||||
| void | processDir (QString pathname) | |||
| Process a directory - calls processFile on each file in the directory. | ||||
| void | processDir (QDir &directory) | |||
| Process a directory - calls processFile on each file in the directory. | ||||
| virtual bool | skipDir (const QDir &dir) | |||
| override this method if you want to skip particular directories. | ||||
Protected Attributes | ||||
| QStringList | m_filterList | |||
| bool | m_Recursive | |||
| QDir::Filters | m_DirFilter | |||
Definition at line 17 of file filevisitor.h.
| FileVisitor::FileVisitor | ( | QString | nameFilter = "*", |
|
| bool | recursive = true, |
|||
| bool | symlinks = false | |||
| ) |
| nameFilter | unix glob-style fileName filter e.g. |
*.html
| recursive | if true, also process subdirectores | |
| symlinks | if true, also process symbolic links. |
Definition at line 9 of file filevisitor.cpp.
References m_DirFilter, m_filterList, and m_Recursive.
| void FileVisitor::processFileList | ( | QStringList | sl | ) | [slot] |
Convenience method for processing a list of file specs.
Useful for handling command line arguments. Calls processEntry() on each file item in list.
| sl | - stringlist of files or directories to process |
Definition at line 92 of file filevisitor.cpp.
References processEntry().
| void FileVisitor::processEntry | ( | QString | pathname | ) | [slot] |
processes a single directory entry Does not care if it is a directory or a file - does all the proper checking before calling the appropriate function, processFile() on files, or processDir() on directories.
| pathname | location of a directory or a file |
Definition at line 69 of file filevisitor.cpp.
References expandTilde().
Referenced by processDir(), and processFileList().
| void FileVisitor::foundFile | ( | QString | filename | ) | [signal] |
emitted whenever a file is found
| filename | an absolute path |
Definition at line 83 of file moc_filevisitor.cpp.
Referenced by processFile().
| void FileVisitor::processFile | ( | QString | filename | ) | [protected, virtual] |
override this to customize behavior
The operation which is performed on each file (currently, it emits foundFile() on each found file).
| filename | (absolute or relative) path of file to be processed. |
Definition at line 65 of file filevisitor.cpp.
References foundFile().
Referenced by processEntry().
| bool FileVisitor::skipDir | ( | const QDir & | dir | ) | [protected, virtual] |
override this method if you want to skip particular directories.
Definition at line 104 of file filevisitor.cpp.
Referenced by processEntry().
| QString FileVisitor::expandTilde | ( | QString | path | ) | [static] |
expands ~ only, not ~username.
| path | a location that may contain a ~ prefix. |
Definition at line 56 of file filevisitor.cpp.
Referenced by processEntry().
1.5.1