Glob.hh 487 B

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