| 1 |
#ifndef GLOB_H |
| 2 |
#define GLOB_H |
| 3 |
|
| 4 |
#include <unordered_set> |
| 5 |
#include <regex> |
| 6 |
|
| 7 |
struct Glob { |
| 8 |
std::size_t mHash; |
| 9 |
std::string mRaw; |
| 10 |
#ifndef __wasm32__ |
| 11 |
std::regex mRegex; |
| 12 |
#endif |
| 13 |
|
| 14 |
Glob(std::string raw); |
| 15 |
|
| 16 |
bool operator==(const Glob &other) const { |
| 17 |
return mHash == other.mHash && mRaw == other.mRaw; |
| 18 |
} |
| 19 |
|
| 20 |
bool isIgnored(std::string relative_path) const; |
| 21 |
}; |
| 22 |
|
| 23 |
namespace std |
| 24 |
{ |
| 25 |
template <> |
| 26 |
struct hash<Glob> |
| 27 |
{ |
| 28 |
size_t operator()(const Glob& g) const { |
| 29 |
return g.mHash; |
| 30 |
} |
| 31 |
}; |
| 32 |
} |
| 33 |
|
| 34 |
#endif |