Files
2026-04-17 20:09:41 +03:00

55 lines
1.1 KiB
C++

/**
* ReXGlue native filesystem layer
* Part of the AC6 Recompilation project
*/
#pragma once
#include <iterator>
#include <memory>
#include <string>
#include <vector>
#include <rex/string.h>
namespace rex {
namespace filesystem {
class WildcardFlags {
public:
bool FromStart : 1, ToEnd : 1, ExactLength : 1;
WildcardFlags();
WildcardFlags(bool start, bool end, bool exact_length);
static WildcardFlags FIRST;
static WildcardFlags LAST;
static WildcardFlags ANY;
static WildcardFlags FIRST_AND_LAST;
};
class WildcardRule {
public:
WildcardRule(const std::string_view match, const WildcardFlags& flags);
bool Check(const std::string_view lower, std::string_view::size_type* offset) const;
private:
std::string match_;
WildcardFlags rules_;
};
class WildcardEngine {
public:
void SetRule(const std::string_view pattern);
// Always ignoring case
bool Match(const std::string_view str) const;
private:
std::vector<WildcardRule> rules_;
void PreparePattern(const std::string_view pattern);
};
} // namespace filesystem
} // namespace rex