Enhancement - Filters

- Filter implemented.
- Unit tests started, need more as Att::match matures.
This commit is contained in:
Paul Beckingham
2009-06-05 00:15:00 -04:00
parent 531cffdc7f
commit a60d54be61
7 changed files with 95 additions and 54 deletions

View File

@@ -26,45 +26,21 @@
////////////////////////////////////////////////////////////////////////////////
#include "Filter.h"
#include "util.h"
////////////////////////////////////////////////////////////////////////////////
Filter::Filter ()
// For every Att in the filter, lookup the equivalent in Record, and perform a
// match. Aren't filters easy now that everything is an attribute?
bool Filter::pass (const Record& record) const
{
}
Record::const_iterator r;
////////////////////////////////////////////////////////////////////////////////
Filter::Filter (const Filter& other)
{
throw std::string ("unimplemented Filter::Filter");
*this = other;
}
////////////////////////////////////////////////////////////////////////////////
Filter& Filter::operator= (const Filter& other)
{
throw std::string ("unimplemented Filter::operator=");
if (this != &other)
{
*this = other;
}
return *this;
}
////////////////////////////////////////////////////////////////////////////////
Filter::~Filter ()
{
}
////////////////////////////////////////////////////////////////////////////////
bool Filter::pass (Record& record)
{
throw std::string ("unimplemented Filter::pass");
/*
// If record doesn't have the attribute, fail. If it does have the attribute
// but it doesn't match, fail.
foreach (att, (*this))
if (! att->match (record))
return false;
*/
if ((r = record.find (att->name ())) == record.end () ||
! att->match (r->second))
return false;
return true;
}