File indexing completed on 2024-05-26 13:37:24

0001 // clang-format off
0002 /*
0003  * This file is part of KDiff3
0004  *
0005  * SPDX-FileCopyrightText: 2021-2021 David Hallas, david@davidhallas.dk
0006  * SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 // clang-format on
0009 
0010 #include "CompositeIgnoreList.h"
0011 
0012 #include <algorithm>  // for max
0013 #include <memory>
0014 #include <utility>    // for move
0015 
0016 void CompositeIgnoreList::enterDir(const QString& dir, const DirectoryList& directoryList)
0017 {
0018     for(const std::unique_ptr<IgnoreList>& ignoreList : m_ignoreLists)
0019     {
0020         ignoreList->enterDir(dir, directoryList);
0021     }
0022 }
0023 
0024 bool CompositeIgnoreList::matches(const QString& dir, const QString& text, bool bCaseSensitive) const
0025 {
0026     for(const std::unique_ptr<IgnoreList>& ignoreList : m_ignoreLists)
0027     {
0028         if(ignoreList->matches(dir, text, bCaseSensitive))
0029         {
0030             return true;
0031         }
0032     }
0033     return false;
0034 }
0035 
0036 void CompositeIgnoreList::addIgnoreList(std::unique_ptr<IgnoreList> ignoreList)
0037 {
0038     m_ignoreLists.push_back(std::move(ignoreList));
0039 }