File indexing completed on 2024-12-01 13:46:42

0001 // clang-format off
0002 /**
0003  * KDiff3 - Text Diff And Merge Tool
0004  *
0005  * SPDX-FileCopyrightText: 2021 David Hallas <david@davidhallas.dk>
0006  * SPDX-License-Identifier: GPL-2.0-or-later
0007  *
0008  */
0009 // clang-format on
0010 
0011 #ifndef GIT_IGNORE_LIST_H
0012 #define GIT_IGNORE_LIST_H
0013 
0014 #include "IgnoreList.h"
0015 
0016 #include <QRegularExpression>
0017 #include <QString>
0018 
0019 #include <map>
0020 #include <vector>
0021 
0022 class GitIgnoreList : public IgnoreList
0023 {
0024   public:
0025     GitIgnoreList();
0026     ~GitIgnoreList() override;
0027     void enterDir(const QString& dir, const DirectoryList& directoryList) override;
0028     [[nodiscard]] bool matches(const QString& dir, const QString& text, bool bCaseSensitive) const override;
0029 
0030   private:
0031     [[nodiscard]] virtual QString readFile(const QString& fileName) const;
0032     void addEntries(const QString& dir, const QString& lines);
0033 
0034   private:
0035     mutable std::map<QString, std::vector<QRegularExpression>> m_patterns;
0036 };
0037 
0038 #endif