Daterange: Added const and refs

This commit is contained in:
Paul Beckingham 2016-04-16 09:23:48 -04:00
parent bb4fded919
commit 5409b25f5f
2 changed files with 8 additions and 8 deletions

View file

@ -28,7 +28,7 @@
#include <Daterange.h> #include <Daterange.h>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Daterange::Daterange (const Datetime start, const Datetime end) Daterange::Daterange (const Datetime& start, const Datetime& end)
{ {
_start = start; _start = start;
_end = end; _end = end;
@ -41,7 +41,7 @@ Datetime Daterange::start () const
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Daterange::start (Datetime value) void Daterange::start (const Datetime& value)
{ {
_start = value; _start = value;
} }
@ -53,7 +53,7 @@ Datetime Daterange::end () const
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Daterange::end (Datetime value) void Daterange::end (const Datetime& value)
{ {
_end = value; _end = value;
} }
@ -91,7 +91,7 @@ bool Daterange::isEnded () const
// other |... true // other |... true
// other |... true // other |... true
// //
bool Daterange::overlap (const Daterange other) const bool Daterange::overlap (const Daterange& other) const
{ {
if (! isStarted () || if (! isStarted () ||
! other.isStarted ()) ! other.isStarted ())

View file

@ -33,17 +33,17 @@ class Daterange
{ {
public: public:
Daterange () = default; Daterange () = default;
Daterange (const Datetime, const Datetime); Daterange (const Datetime&, const Datetime&);
Datetime start () const; Datetime start () const;
void start (Datetime); void start (const Datetime&);
Datetime end () const; Datetime end () const;
void end (Datetime); void end (const Datetime&);
bool isStarted () const; bool isStarted () const;
bool isEnded () const; bool isEnded () const;
bool overlap (const Daterange) const; bool overlap (const Daterange&) const;
private: private:
Datetime _start {0}; Datetime _start {0};