Class or struct representing a positive or negative delta of a number of months or years. More...
Public Member Functions | |
| int_month_delta | months () const |
| Get the number of months represented by a MonthDelta. More... | |
| int_year_delta | years () const |
| Get the number of years represented by a MonthDelta. More... | |
| double | years_decimal () const |
| Get the number of years represented by a MonthDelta, with a fractional part if necessary. More... | |
| bool | is_negative () const |
| Determine whether a MonthDelta is negative. More... | |
| void | negate () |
| Negate a MonthDelta, making it negative if it was positive or positive if it was negative. More... | |
| MonthDelta | operator- () const |
| Return the negated version of this MonthDelta. More... | |
| MonthDelta & | operator++ () |
| Add one month to the MonthDelta. More... | |
| MonthDelta | operator++ (int) |
| Add one month to the MonthDelta. More... | |
| MonthDelta & | operator-- () |
| Subtract one month from the MonthDelta. More... | |
| MonthDelta | operator-- (int) |
| Subtract one month from the MonthDelta. More... | |
| MonthDelta & | operator*= (const long &scale_factor) |
| Scale a MonthDelta by multiplying it by a scale factor. More... | |
| MonthDelta & | operator/= (const long &scale_factor) |
| Scale a MonthDelta by dividing it by a scale factor. More... | |
| MonthDelta & | operator+= (const MonthDelta &other) |
| Add another MonthDelta to a MonthDelta. More... | |
| MonthDelta & | operator-= (const MonthDelta &other) |
| Subtract another MonthDelta from a MonthDelta. More... | |
Static Public Member Functions | |
| static MonthDelta | from_months (int_month_delta months) |
| Create a new MonthDelta based on a positive or negative number of months. More... | |
| static MonthDelta | from_years (int_year_delta years) |
| Create a new MonthDelta based on a positive or negative number of years. More... | |
| static MonthDelta | zero () |
| Create a new MonthDelta initialized to zero months. More... | |
| static short | compare (const MonthDelta &lhs, const MonthDelta &rhs) |
| Compare two MonthDelta instances. More... | |
Public Attributes | |
| struct PresentMonthDeltaData | data_ |
Friends | |
| const MonthDelta | operator* (const MonthDelta &delta, const long &scale_factor) |
| const MonthDelta | operator/ (const MonthDelta &delta, const long &scale_factor) |
| const MonthDelta | operator+ (const MonthDelta &lhs, const MonthDelta &rhs) |
| const MonthDelta | operator- (const MonthDelta &lhs, const MonthDelta &rhs) |
| bool | operator== (const MonthDelta &, const MonthDelta &rhs) |
| Determine whether two MonthDelta instances are equal (lhs == rhs). More... | |
| bool | operator!= (const MonthDelta &, const MonthDelta &rhs) |
| bool | operator< (const MonthDelta &lhs, const MonthDelta &rhs) |
| Determine whether a MonthDelta is less than another MonthDelta (lhs < rhs). More... | |
| bool | operator<= (const MonthDelta &lhs, const MonthDelta &rhs) |
| Determine whether a MonthDelta is less than or equal to another MonthDelta (lhs <= rhs). More... | |
| bool | operator> (const MonthDelta &lhs, const MonthDelta &rhs) |
| Determine whether a MonthDelta is greater than another MonthDelta (lhs > rhs). More... | |
| bool | operator>= (const MonthDelta &lhs, const MonthDelta &rhs) |
| Determine whether a MonthDelta is greater than or equal to another MonthDelta (lhs >= rhs). More... | |
Class or struct representing a positive or negative delta of a number of months or years.
|
static |
Create a new MonthDelta based on a positive or negative number of months.
|
static |
Create a new MonthDelta based on a positive or negative number of years.
|
static |
Create a new MonthDelta initialized to zero months.
| int_month_delta MonthDelta::months | ( | ) | const |
Get the number of months represented by a MonthDelta.
| int_year_delta MonthDelta::years | ( | ) | const |
Get the number of years represented by a MonthDelta.
If the MonthDelta does not represent an exact number of years, the number of years will be truncated.
| double MonthDelta::years_decimal | ( | ) | const |
Get the number of years represented by a MonthDelta, with a fractional part if necessary.
| bool MonthDelta::is_negative | ( | ) | const |
Determine whether a MonthDelta is negative.
| void MonthDelta::negate | ( | ) |
Negate a MonthDelta, making it negative if it was positive or positive if it was negative.
| MonthDelta MonthDelta::operator- | ( | ) | const |
Return the negated version of this MonthDelta.
| MonthDelta& MonthDelta::operator++ | ( | ) |
Add one month to the MonthDelta.
| MonthDelta MonthDelta::operator++ | ( | int | ) |
Add one month to the MonthDelta.
| MonthDelta& MonthDelta::operator-- | ( | ) |
Subtract one month from the MonthDelta.
| MonthDelta MonthDelta::operator-- | ( | int | ) |
Subtract one month from the MonthDelta.
| MonthDelta& MonthDelta::operator*= | ( | const long & | scale_factor | ) |
Scale a MonthDelta by multiplying it by a scale factor.
| MonthDelta& MonthDelta::operator/= | ( | const long & | scale_factor | ) |
Scale a MonthDelta by dividing it by a scale factor.
| MonthDelta& MonthDelta::operator+= | ( | const MonthDelta & | other | ) |
Add another MonthDelta to a MonthDelta.
The second MonthDelta parameter is added to the first.
| MonthDelta& MonthDelta::operator-= | ( | const MonthDelta & | other | ) |
Subtract another MonthDelta from a MonthDelta.
The second MonthDelta parameter is subtracted from the first.
|
static |
Compare two MonthDelta instances.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
Determine whether two MonthDelta instances are equal (lhs == rhs).
|
friend |
|
friend |
Determine whether a MonthDelta is less than another MonthDelta (lhs < rhs).
|
friend |
Determine whether a MonthDelta is less than or equal to another MonthDelta (lhs <= rhs).
|
friend |
Determine whether a MonthDelta is greater than another MonthDelta (lhs > rhs).
|
friend |
Determine whether a MonthDelta is greater than or equal to another MonthDelta (lhs >= rhs).
| struct PresentMonthDeltaData MonthDelta::data_ |