Support for wildcard queries

Provides support for persistent wildcard file requests, as described in
#96
Also moved CanonicalizePath into common code (poly::fs)
This commit is contained in:
x1nixmzeng
2015-02-13 23:41:19 +00:00
parent 3d980dd294
commit 4f7761c5e2
13 changed files with 327 additions and 144 deletions

View File

@@ -100,6 +100,20 @@ STFSEntry::STFSEntry()
update_timestamp(0),
access_timestamp(0) {}
STFSEntry* STFSEntry::GetChild(const poly::fs::WildcardEngine& engine, child_it_t& ref_it)
{
STFSEntry* child_entry(nullptr);
while (ref_it != children.end()) {
if (engine.Match((*ref_it)->name)) {
child_entry = (*ref_it).get();
++ref_it;
break;
}
++ref_it;
}
return child_entry;
}
STFSEntry* STFSEntry::GetChild(const char* name) {
// TODO(benvanik): a faster search
for (const auto& entry : children) {