Cppcheck
Public Member Functions | Static Protected Member Functions | Private Attributes | List of all members
PathMatch Class Reference

Simple path matching for ignoring paths in CLI. More...

#include <pathmatch.h>

Public Member Functions

 PathMatch (std::vector< std::string > excludedPaths, bool caseSensitive=true)
 The constructor. More...
 
bool match (const std::string &path) const
 Match path against list of masks. More...
 

Static Protected Member Functions

static std::string removeFilename (const std::string &path)
 Remove filename part from the path. More...
 

Private Attributes

std::vector< std::string > mExcludedPaths
 
bool mCaseSensitive
 
std::vector< std::string > mWorkingDirectory
 

Detailed Description

Simple path matching for ignoring paths in CLI.

Definition at line 33 of file pathmatch.h.

Constructor & Destructor Documentation

◆ PathMatch()

PathMatch::PathMatch ( std::vector< std::string >  excludedPaths,
bool  caseSensitive = true 
)
explicit

The constructor.

Parameters
excludedPathsList of masks.
caseSensitiveMatch the case of the characters when matching paths?

Definition at line 27 of file pathmatch.cpp.

References Path::getCurrentPath(), mCaseSensitive, mExcludedPaths, mWorkingDirectory, and strTolower().

Member Function Documentation

◆ match()

bool PathMatch::match ( const std::string &  path) const

Match path against list of masks.

Parameters
pathPath to match.
Returns
true if any of the masks match the path, false otherwise.

Definition at line 36 of file pathmatch.cpp.

References endsWith(), Path::fromNativeSeparators(), Path::getRelativePath(), Path::isAbsolute(), mCaseSensitive, mExcludedPaths, mWorkingDirectory, removeFilename(), and strTolower().

Referenced by addFiles2(), and FileList::applyExcludeList().

◆ removeFilename()

std::string PathMatch::removeFilename ( const std::string &  path)
staticprotected

Remove filename part from the path.

Parameters
pathPath to edit.
Returns
path without filename part.

Definition at line 81 of file pathmatch.cpp.

Referenced by match().

Member Data Documentation

◆ mCaseSensitive

bool PathMatch::mCaseSensitive
private

Definition at line 62 of file pathmatch.h.

Referenced by match(), and PathMatch().

◆ mExcludedPaths

std::vector<std::string> PathMatch::mExcludedPaths
private

Definition at line 61 of file pathmatch.h.

Referenced by match(), and PathMatch().

◆ mWorkingDirectory

std::vector<std::string> PathMatch::mWorkingDirectory
private

Definition at line 63 of file pathmatch.h.

Referenced by match(), and PathMatch().


The documentation for this class was generated from the following files: