Present  0.9
 All Classes Files Functions Variables Typedefs Friends Macros Pages
DayDelta Struct Reference

Class or struct representing a positive or negative delta of a number of days or weeks. More...

Public Member Functions

int_delta days () const
 Get the number of days represented by a DayDelta. More...
 
int_delta weeks () const
 Get the number of weeks represented by a DayDelta. More...
 
double weeks_decimal () const
 Get the number of weeks represented by a DayDelta, with a fractional part if necessary. More...
 
TimeDelta to_TimeDelta () const
 Convert a DayDelta into an equivalent TimeDelta. More...
 
bool is_negative () const
 Determine whether a DayDelta is negative. More...
 
void negate ()
 Negate a DayDelta, making it negative if it was positive or positive if it was negative. More...
 
DayDelta operator- () const
 Return the negated version of this DayDelta. More...
 
DayDeltaoperator++ ()
 Add one day to the DayDelta. More...
 
DayDelta operator++ (int)
 Add one day to the DayDelta. More...
 
DayDeltaoperator-- ()
 Subtract one day from the DayDelta. More...
 
DayDelta operator-- (int)
 Subtract one day from the DayDelta. More...
 
DayDeltaoperator*= (const long &scale_factor)
 Scale a DayDelta by multiplying it by a scale factor. More...
 
DayDeltaoperator/= (const long &scale_factor)
 Scale a DayDelta by dividing it by a scale factor. More...
 
DayDeltaoperator+= (const DayDelta &other)
 Add another DayDelta to a DayDelta. More...
 
DayDeltaoperator-= (const DayDelta &other)
 Subtract another DayDelta from a DayDelta. More...
 

Static Public Member Functions

static DayDelta from_days (int_delta days)
 Create a new DayDelta based on a positive or negative number of days. More...
 
static DayDelta from_weeks (int_delta weeks)
 Create a new DayDelta based on a positive or negative number of weeks. More...
 
static DayDelta zero ()
 Create a new DayDelta initialized to zero days. More...
 
static short compare (const DayDelta &lhs, const DayDelta &rhs)
 Compare two DayDelta instances. More...
 
static short compare (const DayDelta &lhs, const TimeDelta &rhs)
 Compare a DayDelta to a TimeDelta. More...
 
static short compare (const TimeDelta &lhs, const DayDelta &rhs)
 

Public Attributes

struct PresentDayDeltaData data_
 

Friends

const DayDelta operator* (const DayDelta &delta, const long &scale_factor)
 
const DayDelta operator/ (const DayDelta &delta, const long &scale_factor)
 
const DayDelta operator+ (const DayDelta &lhs, const DayDelta &rhs)
 
const DayDelta operator- (const DayDelta &lhs, const DayDelta &rhs)
 
bool operator== (const DayDelta &lhs, const DayDelta &rhs)
 Determine whether two DayDelta instances are equal (lhs == rhs). More...
 
bool operator== (const DayDelta &lhs, const TimeDelta &rhs)
 Determine whether a DayDelta equals a TimeDelta (lhs == rhs). More...
 
bool operator!= (const DayDelta &lhs, const DayDelta &rhs)
 
bool operator!= (const DayDelta &lhs, const TimeDelta &rhs)
 
bool operator< (const DayDelta &lhs, const DayDelta &rhs)
 Determine whether a DayDelta is less than another DayDelta (lhs < rhs). More...
 
bool operator< (const DayDelta &lhs, const TimeDelta &rhs)
 Determine whether a DayDelta is less than a TimeDelta (lhs < rhs). More...
 
bool operator<= (const DayDelta &lhs, const DayDelta &rhs)
 Determine whether a DayDelta is less than or equal to another DayDelta (lhs <= rhs). More...
 
bool operator<= (const DayDelta &lhs, const TimeDelta &rhs)
 Determine whether a DayDelta is less than or equal to a TimeDelta (lhs <= rhs). More...
 
bool operator> (const DayDelta &lhs, const DayDelta &rhs)
 Determine whether a DayDelta is greater than another DayDelta (lhs > rhs). More...
 
bool operator> (const DayDelta &lhs, const TimeDelta &rhs)
 Determine whether a DayDelta is greater than a TimeDelta (lhs > rhs). More...
 
bool operator>= (const DayDelta &lhs, const DayDelta &rhs)
 Determine whether a DayDelta is greater than or equal to another DayDelta (lhs >= rhs). More...
 
bool operator>= (const DayDelta &lhs, const TimeDelta &rhs)
 Determine whether a DayDelta is greater than or equal to a TimeDelta (lhs >= rhs). More...
 

Detailed Description

Class or struct representing a positive or negative delta of a number of days or weeks.

Member Function Documentation

static DayDelta DayDelta::from_days ( int_delta  days)
static

Create a new DayDelta based on a positive or negative number of days.

static DayDelta DayDelta::from_weeks ( int_delta  weeks)
static

Create a new DayDelta based on a positive or negative number of weeks.

static DayDelta DayDelta::zero ( )
static

Create a new DayDelta initialized to zero days.

int_delta DayDelta::days ( ) const

Get the number of days represented by a DayDelta.

int_delta DayDelta::weeks ( ) const

Get the number of weeks represented by a DayDelta.

If the DayDelta does not represent an exact number of weeks, the number of weeks will be truncated.

double DayDelta::weeks_decimal ( ) const

Get the number of weeks represented by a DayDelta, with a fractional part if necessary.

TimeDelta DayDelta::to_TimeDelta ( ) const

Convert a DayDelta into an equivalent TimeDelta.

bool DayDelta::is_negative ( ) const

Determine whether a DayDelta is negative.

void DayDelta::negate ( )

Negate a DayDelta, making it negative if it was positive or positive if it was negative.

DayDelta DayDelta::operator- ( ) const

Return the negated version of this DayDelta.

See Also
DayDelta::negate
DayDelta& DayDelta::operator++ ( )

Add one day to the DayDelta.

DayDelta DayDelta::operator++ ( int  )

Add one day to the DayDelta.

DayDelta& DayDelta::operator-- ( )

Subtract one day from the DayDelta.

DayDelta DayDelta::operator-- ( int  )

Subtract one day from the DayDelta.

DayDelta& DayDelta::operator*= ( const long &  scale_factor)

Scale a DayDelta by multiplying it by a scale factor.

DayDelta& DayDelta::operator/= ( const long &  scale_factor)

Scale a DayDelta by dividing it by a scale factor.

DayDelta& DayDelta::operator+= ( const DayDelta other)

Add another DayDelta to a DayDelta.

The second DayDelta parameter is added to the first.

DayDelta& DayDelta::operator-= ( const DayDelta other)

Subtract another DayDelta from a DayDelta.

The second DayDelta parameter is added to the first.

static short DayDelta::compare ( const DayDelta lhs,
const DayDelta rhs 
)
static

Compare two DayDelta instances.

  • If lhs < rhs, then a negative integer will be returned.
  • If lhs == rhs, then 0 will be returned.
  • If lhs > rhs, then a positive integer will be returned.
static short DayDelta::compare ( const DayDelta lhs,
const TimeDelta rhs 
)
static

Compare a DayDelta to a TimeDelta.

  • If lhs < rhs, then a negative integer will be returned.
  • If lhs == rhs, then 0 will be returned.
  • If lhs > rhs, then a positive integer will be returned.
static short DayDelta::compare ( const TimeDelta lhs,
const DayDelta rhs 
)
static

Friends And Related Function Documentation

const DayDelta operator* ( const DayDelta delta,
const long &  scale_factor 
)
friend
const DayDelta operator/ ( const DayDelta delta,
const long &  scale_factor 
)
friend
const DayDelta operator+ ( const DayDelta lhs,
const DayDelta rhs 
)
friend
const DayDelta operator- ( const DayDelta lhs,
const DayDelta rhs 
)
friend
bool operator== ( const DayDelta lhs,
const DayDelta rhs 
)
friend

Determine whether two DayDelta instances are equal (lhs == rhs).

bool operator== ( const DayDelta lhs,
const TimeDelta rhs 
)
friend

Determine whether a DayDelta equals a TimeDelta (lhs == rhs).

bool operator!= ( const DayDelta lhs,
const DayDelta rhs 
)
friend
bool operator!= ( const DayDelta lhs,
const TimeDelta rhs 
)
friend
bool operator< ( const DayDelta lhs,
const DayDelta rhs 
)
friend

Determine whether a DayDelta is less than another DayDelta (lhs < rhs).

bool operator< ( const DayDelta lhs,
const TimeDelta rhs 
)
friend

Determine whether a DayDelta is less than a TimeDelta (lhs < rhs).

bool operator<= ( const DayDelta lhs,
const DayDelta rhs 
)
friend

Determine whether a DayDelta is less than or equal to another DayDelta (lhs <= rhs).

bool operator<= ( const DayDelta lhs,
const TimeDelta rhs 
)
friend

Determine whether a DayDelta is less than or equal to a TimeDelta (lhs <= rhs).

bool operator> ( const DayDelta lhs,
const DayDelta rhs 
)
friend

Determine whether a DayDelta is greater than another DayDelta (lhs > rhs).

bool operator> ( const DayDelta lhs,
const TimeDelta rhs 
)
friend

Determine whether a DayDelta is greater than a TimeDelta (lhs > rhs).

bool operator>= ( const DayDelta lhs,
const DayDelta rhs 
)
friend

Determine whether a DayDelta is greater than or equal to another DayDelta (lhs >= rhs).

bool operator>= ( const DayDelta lhs,
const TimeDelta rhs 
)
friend

Determine whether a DayDelta is greater than or equal to a TimeDelta (lhs >= rhs).

Member Data Documentation

struct PresentDayDeltaData DayDelta::data_

The documentation for this struct was generated from the following file: