| 143 | } |
| 144 | |
| 145 | bool CvsIgnoreList::matches(const QString& dir, const QString& text, bool bCaseSensitive) const |
| 146 | { |
| 147 | const auto ignorePatternsIt = m_ignorePatterns.find(dir); |
| 148 | if(ignorePatternsIt == m_ignorePatterns.end()) |
| 149 | { |
| 150 | return false; |
| 151 | } |
| 152 | //Do not use QStringList::indexof here it has no case flag |
| 153 | if(ignorePatternsIt->second.m_exactPatterns.contains(text, bCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive)) |
| 154 | { |
| 155 | return true; |
| 156 | } |
| 157 | |
| 158 | for(const QString& startPattern: ignorePatternsIt->second.m_startPatterns) |
| 159 | { |
| 160 | if(text.startsWith(startPattern, bCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive)) |
| 161 | { |
| 162 | return true; |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | for(const QString& endPattern: ignorePatternsIt->second.m_endPatterns) |
| 167 | { |
| 168 | if(text.endsWith(endPattern, bCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive)) |
| 169 | { |
| 170 | return true; |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | for(const QString& globStr: ignorePatternsIt->second.m_generalPatterns) |
| 175 | { |
| 176 | QRegularExpression pattern(QRegularExpression::wildcardToRegularExpression(globStr), bCaseSensitive ? QRegularExpression::UseUnicodePropertiesOption : QRegularExpression::UseUnicodePropertiesOption | QRegularExpression::CaseInsensitiveOption); |
| 177 | if(pattern.match(text).hasMatch()) |
| 178 | return true; |
| 179 | } |
| 180 | |
| 181 | return false; |
| 182 | } |
| 183 | |
| 184 | bool CvsIgnoreList::ignoreExists(const DirectoryList& pDirList) |
| 185 | { |