MCPcopy Create free account
hub / github.com/WinMerge/winmerge / includeFile

Method includeFile

Src/FileFilterHelper.cpp:176–199  ·  view source on GitHub ↗

* @brief Check if any of filefilter rules match to filename. * * @param [in] szFileName Filename to test. * @return true unless we're suppressing this file by filter */

Source from the content-addressed store, hash-verified

174 * @return true unless we're suppressing this file by filter
175 */
176bool FileFilterHelper::includeFile(const String& szFileName) const
177{
178 // preprend a backslash if there is none
179 String strFileName = strutils::makelower(szFileName);
180 if (strFileName.empty() || strFileName[0] != '\\')
181 strFileName = _T("\\") + strFileName;
182 // append a point if there is no extension
183 std::string strFileNameUtf8Period = ucr::toUTF8(addPeriodIfNoExtension(strFileName));
184 for (const auto& filterGroup : m_filterGroups)
185 {
186 bool result = filterGroup.m_pMaskFileFilter && filterGroup.m_pMaskFileFilter->Match(strFileNameUtf8Period);
187 if (!result)
188 result = filterGroup.m_pRegexOrExpressionFilter && TestAgainstRegList(&filterGroup.m_pRegexOrExpressionFilter->filefilters, szFileName);
189 if (!result)
190 return false;
191 if (filterGroup.m_pMaskFileFilterExclude && filterGroup.m_pMaskFileFilterExclude->Match(strFileNameUtf8Period))
192 return false;
193 if (filterGroup.m_pRegexOrExpressionFilter && TestAgainstRegList(&filterGroup.m_pRegexOrExpressionFilter->filefiltersExclude, szFileName))
194 return false;
195 if (filterGroup.m_pRegexOrExpressionFilterExclude && !filterGroup.m_pRegexOrExpressionFilterExclude->TestFileNameAgainstFilter(szFileName))
196 return false;
197 }
198 return true;
199}
200
201bool FileFilterHelper::includeFile(const DIFFITEM& di) const
202{

Callers 9

IsShowableFunction · 0.45
prepAndCompareFilesMethod · 0.45
CheckTextMethod · 0.45
AddToListFunction · 0.45
ShowAutoMergeDocMethod · 0.45
mainFunction · 0.45
TEST_FFunction · 0.45

Calls 11

addPeriodIfNoExtensionFunction · 0.85
TestAgainstRegListFunction · 0.85
ConcatPathFunction · 0.85
MatchMethod · 0.80
isThreewayMethod · 0.80
makelowerFunction · 0.50
toUTF8Function · 0.50
emptyMethod · 0.45
existsMethod · 0.45

Tested by 2

CheckTextMethod · 0.36
TEST_FFunction · 0.36