Filter: Inherited much of Interval

This commit is contained in:
Paul Beckingham 2016-04-07 23:43:58 -04:00
parent 1501fc2ace
commit 1bad5eb856
2 changed files with 62 additions and 0 deletions

View file

@ -28,3 +28,48 @@
#include <Filter.h>
////////////////////////////////////////////////////////////////////////////////
bool Filter::empty () const
{
return _start.toEpoch () == 0 &&
_end.toEpoch () == 0 &&
_tags.size () == 0;
}
////////////////////////////////////////////////////////////////////////////////
Datetime Filter::start () const
{
return _start;
}
////////////////////////////////////////////////////////////////////////////////
void Filter::start (Datetime value)
{
_start = value;
}
////////////////////////////////////////////////////////////////////////////////
Datetime Filter::end () const
{
return _end;
}
////////////////////////////////////////////////////////////////////////////////
void Filter::end (Datetime value)
{
_end = value;
}
////////////////////////////////////////////////////////////////////////////////
std::set <std::string> Filter::tags () const
{
return _tags;
}
////////////////////////////////////////////////////////////////////////////////
void Filter::tag (const std::string& tag)
{
if (_tags.find (tag) == _tags.end ())
_tags.insert (tag);
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -27,12 +27,29 @@
#ifndef INCLUDED_FILTER
#define INCLUDED_FILTER
#include <Datetime.h>
#include <string>
#include <set>
class Filter
{
public:
Filter () = default;
bool empty () const;
Datetime start () const;
void start (Datetime);
Datetime end () const;
void end (Datetime);
std::set <std::string> tags () const;
void tag (const std::string&);
private:
Datetime _start {0};
Datetime _end {0};
std::set <std::string> _tags {};
};
#endif