#pragma once #include #include #include #include class Glob { private: std::regex re_; public: explicit Glob(std::string glob) { for (size_t i = glob.find('.'); i != std::string::npos; i = glob.find('.', i + 2)) { glob.insert(glob.begin() + i, '\\'); } for (size_t i = glob.find('*'); i != std::string::npos; i = glob.find('*', i + 2)) { glob.insert(glob.begin() + i, '.'); } re_ = std::regex(glob); } bool operator==(std::string const & str) const { return std::regex_search(str, re_); } }; struct RecursiveTestFilter { std::vector whitelist; std::vector blacklist; bool accepts(std::string const & str) const { return std::count(blacklist.begin(), blacklist.end(), str) == 0 and (whitelist.empty() or std::count(whitelist.begin(), whitelist.end(), str) > 0); } };