Skip to content

Commit c4bd702

Browse files
committed
GUI: Rename methods in FileList and PathMatch
1 parent 24bdd6d commit c4bd702

File tree

5 files changed

+36
-36
lines changed

5 files changed

+36
-36
lines changed

gui/filelist.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@
2424
#include "path.h"
2525
#include "pathmatch.h"
2626

27-
QStringList FileList::GetDefaultFilters()
27+
QStringList FileList::getDefaultFilters()
2828
{
2929
QStringList extensions;
3030
extensions << "*.cpp" << "*.cxx" << "*.cc" << "*.c" << "*.c++" << "*.txx" << "*.tpp";
3131
return extensions;
3232
}
3333

34-
bool FileList::FilterMatches(const QFileInfo &inf)
34+
bool FileList::filterMatches(const QFileInfo &inf)
3535
{
3636
if (inf.isFile()) {
37-
const QStringList filters = FileList::GetDefaultFilters();
37+
const QStringList filters = FileList::getDefaultFilters();
3838
QString ext("*.");
3939
ext += inf.suffix();
4040
if (filters.contains(ext, Qt::CaseInsensitive))
@@ -43,18 +43,18 @@ bool FileList::FilterMatches(const QFileInfo &inf)
4343
return false;
4444
}
4545

46-
void FileList::AddFile(const QString &filepath)
46+
void FileList::addFile(const QString &filepath)
4747
{
4848
QFileInfo inf(filepath);
49-
if (FilterMatches(inf))
49+
if (filterMatches(inf))
5050
mFileList << inf;
5151
}
5252

53-
void FileList::AddDirectory(const QString &directory, bool recursive)
53+
void FileList::addDirectory(const QString &directory, bool recursive)
5454
{
5555
QDir dir(directory);
5656
dir.setSorting(QDir::Name);
57-
const QStringList filters = FileList::GetDefaultFilters();
57+
const QStringList filters = FileList::getDefaultFilters();
5858
const QStringList origNameFilters = dir.nameFilters();
5959
dir.setNameFilters(filters);
6060
if (!recursive) {
@@ -72,24 +72,24 @@ void FileList::AddDirectory(const QString &directory, bool recursive)
7272
QFileInfo item;
7373
foreach (item, list) {
7474
const QString path = item.canonicalFilePath();
75-
AddDirectory(path, recursive);
75+
addDirectory(path, recursive);
7676
}
7777
}
7878
}
7979

80-
void FileList::AddPathList(const QStringList &paths)
80+
void FileList::addPathList(const QStringList &paths)
8181
{
8282
QString path;
8383
foreach (path, paths) {
8484
QFileInfo inf(path);
8585
if (inf.isFile())
86-
AddFile(path);
86+
addFile(path);
8787
else
88-
AddDirectory(path, true);
88+
addDirectory(path, true);
8989
}
9090
}
9191

92-
QStringList FileList::GetFileList() const
92+
QStringList FileList::getFileList() const
9393
{
9494
if (mExcludedPaths.empty()) {
9595
QStringList names;
@@ -99,11 +99,11 @@ QStringList FileList::GetFileList() const
9999
}
100100
return names;
101101
} else {
102-
return ApplyExcludeList();
102+
return applyExcludeList();
103103
}
104104
}
105105

106-
void FileList::AddExcludeList(const QStringList &paths)
106+
void FileList::addExcludeList(const QStringList &paths)
107107
{
108108
mExcludedPaths = paths;
109109
}
@@ -117,7 +117,7 @@ static std::vector<std::string> toStdStringList(const QStringList &stringList)
117117
return ret;
118118
}
119119

120-
QStringList FileList::ApplyExcludeList() const
120+
QStringList FileList::applyExcludeList() const
121121
{
122122
#ifdef _WIN32
123123
const PathMatch pathMatch(toStdStringList(mExcludedPaths), true);
@@ -128,7 +128,7 @@ QStringList FileList::ApplyExcludeList() const
128128
QStringList paths;
129129
foreach (QFileInfo item, mFileList) {
130130
QString name = QDir::fromNativeSeparators(item.canonicalFilePath());
131-
if (!pathMatch.Match(name.toStdString()))
131+
if (!pathMatch.match(name.toStdString()))
132132
paths << name;
133133
}
134134
return paths;

gui/filelist.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,46 +41,46 @@ class FileList {
4141
* @brief Add filename to the list.
4242
* @param filepath Full path to the file.
4343
*/
44-
void AddFile(const QString &filepath);
44+
void addFile(const QString &filepath);
4545

4646
/**
4747
* @brief Add files in the directory to the list.
4848
* @param directory Full pathname to directory to add.
4949
* @param recursive If true also files in subdirectories are added.
5050
*/
51-
void AddDirectory(const QString &directory, bool recursive = false);
51+
void addDirectory(const QString &directory, bool recursive = false);
5252

5353
/**
5454
* @brief Add list of filenames and directories to the list.
5555
* @param paths List of paths to add.
5656
*/
57-
void AddPathList(const QStringList &paths);
57+
void addPathList(const QStringList &paths);
5858

5959
/**
6060
* @brief Return list of filenames (to check).
6161
* @return list of filenames to check.
6262
*/
63-
QStringList GetFileList() const;
63+
QStringList getFileList() const;
6464

6565
/**
6666
* @brief Add list of paths to exclusion list.
6767
* @param paths Paths to exclude.
6868
*/
69-
void AddExcludeList(const QStringList &paths);
69+
void addExcludeList(const QStringList &paths);
7070

7171
/**
7272
* @brief Return list of default filename extensions included.
7373
* @return list of default filename extensions included.
7474
*/
75-
static QStringList GetDefaultFilters();
75+
static QStringList getDefaultFilters();
7676

7777
protected:
7878

7979
/**
8080
* @brief Test if filename matches the filename extensions filtering.
8181
* @return true if filename matches filtering.
8282
*/
83-
static bool FilterMatches(const QFileInfo &inf);
83+
static bool filterMatches(const QFileInfo &inf);
8484

8585
/**
8686
* @brief Get filtered list of paths.
@@ -89,7 +89,7 @@ class FileList {
8989
* exclude filters.
9090
* @return Filtered list of paths.
9191
*/
92-
QStringList ApplyExcludeList() const;
92+
QStringList applyExcludeList() const;
9393

9494
private:
9595
QFileInfoList mFileList;

gui/mainwindow.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -407,13 +407,13 @@ void MainWindow::doCheckFiles(const QStringList &files)
407407

408408
mIsLogfileLoaded = false;
409409
FileList pathList;
410-
pathList.AddPathList(files);
410+
pathList.addPathList(files);
411411
if (mProject) {
412-
pathList.AddExcludeList(mProject->getProjectFile()->getExcludedPaths());
412+
pathList.addExcludeList(mProject->getProjectFile()->getExcludedPaths());
413413
} else {
414414
enableProjectActions(false);
415415
}
416-
QStringList fileNames = pathList.GetFileList();
416+
QStringList fileNames = pathList.getFileList();
417417

418418
mUI.mResults->Clear(true);
419419
mThread->ClearFiles();
@@ -503,7 +503,7 @@ QStringList MainWindow::selectFilesToCheck(QFileDialog::FileMode mode)
503503
tr("Select files to check"),
504504
GetPath(SETTINGS_LAST_CHECK_PATH),
505505
tr("C/C++ Source, Compile database, Visual Studio (%1 %2 *.sln *.vcxproj)")
506-
.arg(FileList::GetDefaultFilters().join(" "))
506+
.arg(FileList::getDefaultFilters().join(" "))
507507
.arg(compile_commands_json));
508508
if (selected.isEmpty())
509509
mCurrentDirectory.clear();
@@ -931,10 +931,10 @@ void MainWindow::reCheckSelected(QStringList files, bool all)
931931

932932
mCurrentDirectory = mUI.mResults->GetCheckDirectory();
933933
FileList pathList;
934-
pathList.AddPathList(files);
934+
pathList.addPathList(files);
935935
if (mProject)
936-
pathList.AddExcludeList(mProject->getProjectFile()->getExcludedPaths());
937-
QStringList fileNames = pathList.GetFileList();
936+
pathList.addExcludeList(mProject->getProjectFile()->getExcludedPaths());
937+
QStringList fileNames = pathList.getFileList();
938938
checkLockDownUI(); // lock UI while checking
939939
mUI.mResults->CheckingStarted(fileNames.size());
940940
mThread->SetCheckFiles(fileNames);

lib/pathmatch.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ PathMatch::PathMatch(const std::vector<std::string> &excludedPaths, bool caseSen
3434
_workingDirectory.push_back(Path::getCurrentPath());
3535
}
3636

37-
bool PathMatch::Match(const std::string &path) const
37+
bool PathMatch::match(const std::string &path) const
3838
{
3939
if (path.empty())
4040
return false;
@@ -49,7 +49,7 @@ bool PathMatch::Match(const std::string &path) const
4949
// Filtering directory name
5050
if (endsWith(excludedPath,'/')) {
5151
if (!endsWith(findpath,'/'))
52-
findpath = RemoveFilename(findpath);
52+
findpath = removeFilename(findpath);
5353

5454
if (excludedPath.length() > findpath.length())
5555
continue;
@@ -78,7 +78,7 @@ bool PathMatch::Match(const std::string &path) const
7878
return false;
7979
}
8080

81-
std::string PathMatch::RemoveFilename(const std::string &path)
81+
std::string PathMatch::removeFilename(const std::string &path)
8282
{
8383
const std::size_t ind = path.find_last_of('/');
8484
return path.substr(0, ind + 1);

lib/pathmatch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class CPPCHECKLIB PathMatch {
4646
* @param path Path to match.
4747
* @return true if any of the masks match the path, false otherwise.
4848
*/
49-
bool Match(const std::string &path) const;
49+
bool match(const std::string &path) const;
5050

5151
protected:
5252

@@ -55,7 +55,7 @@ class CPPCHECKLIB PathMatch {
5555
* @param path Path to edit.
5656
* @return path without filename part.
5757
*/
58-
static std::string RemoveFilename(const std::string &path);
58+
static std::string removeFilename(const std::string &path);
5959

6060
private:
6161
std::vector<std::string> _excludedPaths;

0 commit comments

Comments
 (0)