Enhancement - Filters
- Filter implemented. - Unit tests started, need more as Att::match matures.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user