|
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. | |
| void | AddDirectory (const QString &directory, bool recursive=false) |
| Add files in the directory to the list. | |
| void | AddPathList (const QStringList &paths) |
| Add list of filenames and directories to the list. | |
| QStringList | GetFileList () const |
| Return list of filenames (to check). | |
| void | AddExcludeList (const QStringList &paths) |
| Add list of paths to exclusion list. | |
Protected Member Functions | |
| QStringList | ApplyExcludeList () const |
| Get filtered list of paths. | |
| bool | Match (const QString &path) const |
| Test if path matches any of the exclude filters. | |
Static Protected Member Functions | |
| static QStringList | GetDefaultFilters () |
| Return list of default filename extensions included. | |
| static bool | FilterMatches (const QFileInfo &inf) |
| Test if filename matches the filename extensions filtering. | |
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 37 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 51 of file filelist.cpp.
References GetDefaultFilters(), and mFileList.
Referenced by AddPathList().
| void FileList::AddExcludeList | ( | const QStringList & | paths | ) |
Add list of paths to exclusion list.
| paths | Paths to exclude. |
Definition at line 104 of file filelist.cpp.
References mExcludedPaths.
Referenced by MainWindow::DoCheckFiles().
| void FileList::AddFile | ( | const QString & | filepath | ) |
Add filename to the list.
| filepath | Full path to the file. |
Definition at line 44 of file filelist.cpp.
References FilterMatches(), and mFileList.
Referenced by AddPathList().
| void FileList::AddPathList | ( | const QStringList & | paths | ) |
Add list of filenames and directories to the list.
| paths | List of paths to add. |
Definition at line 78 of file filelist.cpp.
References AddDirectory(), and AddFile().
Referenced by MainWindow::DoCheckFiles().
| QStringList FileList::ApplyExcludeList | ( | ) | const [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 109 of file filelist.cpp.
References Match(), and mFileList.
Referenced by GetFileList().
| bool FileList::FilterMatches | ( | const QFileInfo & | inf | ) | [static, protected] |
Test if filename matches the filename extensions filtering.
Definition at line 32 of file filelist.cpp.
References GetDefaultFilters().
Referenced by AddFile().
| QStringList FileList::GetDefaultFilters | ( | ) | [static, protected] |
Return list of default filename extensions included.
Definition at line 25 of file filelist.cpp.
Referenced by AddDirectory(), and FilterMatches().
| QStringList FileList::GetFileList | ( | ) | const |
Return list of filenames (to check).
Definition at line 90 of file filelist.cpp.
References ApplyExcludeList(), mExcludedPaths, and mFileList.
Referenced by MainWindow::DoCheckFiles().
| bool FileList::Match | ( | const QString & | path | ) | const [protected] |
Test if path matches any of the exclude filters.
| path | Path to test against exclude filters. |
Definition at line 120 of file filelist.cpp.
References mExcludedPaths.
Referenced by ApplyExcludeList().
QStringList FileList::mExcludedPaths [private] |
Definition at line 103 of file filelist.h.
Referenced by AddExcludeList(), GetFileList(), and Match().
QFileInfoList FileList::mFileList [private] |
Definition at line 102 of file filelist.h.
Referenced by AddDirectory(), AddFile(), ApplyExcludeList(), and GetFileList().
1.7.6.1