mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Range: Added ::open and ::close to manipulate ranges in common ways
This commit is contained in:
parent
e1e1a30a98
commit
10fb92e97f
2 changed files with 24 additions and 0 deletions
|
@ -47,6 +47,26 @@ bool Range::operator== (const Range& other) const
|
||||||
end == other.end;
|
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
|
bool Range::is_open () const
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,6 +37,10 @@ public:
|
||||||
Range (const Datetime&, const Datetime&);
|
Range (const Datetime&, const Datetime&);
|
||||||
bool operator== (const Range&) const;
|
bool operator== (const Range&) const;
|
||||||
|
|
||||||
|
void open ();
|
||||||
|
void open (const Datetime&);
|
||||||
|
void close ();
|
||||||
|
|
||||||
bool is_open () const;
|
bool is_open () const;
|
||||||
bool is_started () const;
|
bool is_started () const;
|
||||||
bool is_ended () const;
|
bool is_ended () const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue