Enhancement - Attribute modifiers

- Implemented half the modifiers.  The easy half.
- Implemented unit tests that don't all pass yet, and are incomplete.
This commit is contained in:
Paul Beckingham
2009-06-05 01:49:53 -04:00
parent 2aa43fe4fe
commit 0ec3b4b6af
3 changed files with 150 additions and 33 deletions

View File

@@ -38,9 +38,17 @@ bool Filter::pass (const Record& record) const
// If record doesn't have the attribute, fail. If it does have the attribute
// but it doesn't match, fail.
foreach (att, (*this))
if ((r = record.find (att->name ())) == record.end () ||
! att->match (r->second))
{
// If the record doesn't have the attribute, match against a default one.
// This is because "att" may contain a modifier like "name.not:X".
if ((r = record.find (att->name ())) == record.end ())
{
if (! att->match (Att ()))
return false;
}
else if (! att->match (r->second))
return false;
}
return true;
}