Range: Added ::open and ::close to manipulate ranges in common ways

This commit is contained in:
Paul Beckingham 2016-05-12 17:26:01 -04:00
parent e1e1a30a98
commit 10fb92e97f
2 changed files with 24 additions and 0 deletions

View file

@ -47,6 +47,26 @@ bool Range::operator== (const Range& other) const
end == other.end;
}
////////////////////////////////////////////////////////////////////////////////
void Range::open ()
{
start = Datetime ();
end = Datetime (0);
}
////////////////////////////////////////////////////////////////////////////////
void Range::open (const Datetime& value)
{
start = value;
end = Datetime (0);
}
////////////////////////////////////////////////////////////////////////////////
void Range::close ()
{
end = Datetime ();
}
////////////////////////////////////////////////////////////////////////////////
bool Range::is_open () const
{

View file

@ -37,6 +37,10 @@ public:
Range (const Datetime&, const Datetime&);
bool operator== (const Range&) const;
void open ();
void open (const Datetime&);
void close ();
bool is_open () const;
bool is_started () const;
bool is_ended () const;