Cppcheck
|
A class for listing files and directories to check. More...
#include <filelist.h>
Public Member Functions | |
void | addFile (const QString &filepath) |
Add filename to the list. More... | |
void | addDirectory (const QString &directory, bool recursive=false) |
Add files in the directory to the list. More... | |
void | addPathList (const QStringList &paths) |
Add list of filenames and directories to the list. More... | |
QStringList | getFileList () const |
Return list of filenames (to check). More... | |
void | addExcludeList (const QStringList &paths) |
Add list of paths to exclusion list. More... | |
Static Public Member Functions | |
static QStringList | getDefaultFilters () |
Return list of default filename extensions included. More... | |
Protected Member Functions | |
QStringList | applyExcludeList () const |
Get filtered list of paths. More... | |
Static Protected Member Functions | |
static bool | filterMatches (const QFileInfo &inf) |
Test if filename matches the filename extensions filtering. More... | |
Private Attributes | |
QFileInfoList | mFileList |
QStringList | mExcludedPaths |
A class for listing files and directories to check.
This class creates a list of files to check. If directory name is given then all files in the directory matching the filter will be added. The directory can be also added recursively when all files in subdirectories are added too. The filenames are matched against the filter and only those files whose filename extension is included in the filter list are added.
This class also handles filtering of paths against ignore filters given. If there is ignore filters then only paths not matching those filters are returned.
Definition at line 39 of file filelist.h.
void FileList::addDirectory | ( | const QString & | directory, |
bool | recursive = false |
||
) |
Add files in the directory to the list.
directory | Full pathname to directory to add. |
recursive | If true also files in subdirectories are added. |
Definition at line 57 of file filelist.cpp.
References getDefaultFilters(), mFileList, and CppcheckXml::Name.
Referenced by addPathList().
void FileList::addExcludeList | ( | const QStringList & | paths | ) |
Add list of paths to exclusion list.
paths | Paths to exclude. |
Definition at line 106 of file filelist.cpp.
References mExcludedPaths.
Referenced by MainWindow::doAnalyzeFiles(), and MainWindow::reAnalyzeSelected().
void FileList::addFile | ( | const QString & | filepath | ) |
Add filename to the list.
filepath | Full path to the file. |
Definition at line 50 of file filelist.cpp.
References filterMatches(), and mFileList.
Referenced by addPathList(), and ComplianceReportDialog::save().
void FileList::addPathList | ( | const QStringList & | paths | ) |
Add list of filenames and directories to the list.
paths | List of paths to add. |
Definition at line 82 of file filelist.cpp.
References addDirectory(), and addFile().
Referenced by MainWindow::doAnalyzeFiles(), MainWindow::reAnalyzeSelected(), and ComplianceReportDialog::save().
|
protected |
Get filtered list of paths.
This method takes the list of paths and applies the exclude lists to it. And then returns the list of paths that did not match the exclude filters.
Definition at line 120 of file filelist.cpp.
References PathMatch::match(), mExcludedPaths, mFileList, and toStdStringList().
Referenced by getFileList().
|
staticprotected |
Test if filename matches the filename extensions filtering.
Definition at line 38 of file filelist.cpp.
References getDefaultFilters().
Referenced by addFile().
|
static |
Return list of default filename extensions included.
Definition at line 31 of file filelist.cpp.
Referenced by addDirectory(), filterMatches(), and MainWindow::selectFilesToAnalyze().
QStringList FileList::getFileList | ( | ) | const |
Return list of filenames (to check).
Definition at line 93 of file filelist.cpp.
References applyExcludeList(), mExcludedPaths, and mFileList.
Referenced by MainWindow::doAnalyzeFiles(), MainWindow::reAnalyzeSelected(), and ComplianceReportDialog::save().
|
private |
Definition at line 98 of file filelist.h.
Referenced by addExcludeList(), applyExcludeList(), and getFileList().
|
private |
Definition at line 97 of file filelist.h.
Referenced by addDirectory(), addFile(), applyExcludeList(), and getFileList().