Adjustments to wildcard engine

Fixed incorrect logic when checking at the end of the string - some of
the names had an added null character
Removed case sensitivity
This commit is contained in:
x1nixmzeng
2015-02-17 22:42:01 +00:00
parent 17bc561045
commit d091f12c81
4 changed files with 25 additions and 24 deletions

View File

@@ -45,8 +45,7 @@ class WildcardFlags
public:
bool
FromStart: 1,
ToEnd : 1,
WithCase : 1; // Unused for now
ToEnd : 1;
WildcardFlags();
WildcardFlags(bool start, bool end);
@@ -58,8 +57,8 @@ public:
class WildcardRule
{
public:
WildcardRule(std::string str_match, const WildcardFlags &flags);
bool Check(std::string& str) const;
WildcardRule(const std::string& str_match, const WildcardFlags &flags);
bool Check(const std::string& str_lower, std::string::size_type& offset) const;
private:
std::string match;
@@ -70,6 +69,8 @@ class WildcardEngine
{
public:
void SetRule(const std::string &pattern);
// Always ignoring case
bool Match(const std::string &str) const;
private:
std::vector<WildcardRule> rules;