17 #include "present/internal/cpp-guard.h"
18 #include "present/internal/header-utils.h"
21 #include "present/internal/present-month-delta-data.h"
23 #ifndef _PRESENT_MONTH_DELTA_H_
24 #define _PRESENT_MONTH_DELTA_H_
40 struct PresentMonthDeltaData data_;
59 double years_decimal()
const;
62 bool is_negative()
const;
83 MonthDelta & operator*=(
const long & scale_factor);
85 MonthDelta & operator/=(
const long & scale_factor);
90 const long & scale_factor);
94 const long & scale_factor);
int_month_delta months() const
Get the number of months represented by a MonthDelta.
present_int32 int_year_delta
Definition: types.h:91
present_bool MonthDelta_is_negative(const struct MonthDelta *const self)
Determine whether a MonthDelta is negative.
present_bool MonthDelta_less_than(const struct MonthDelta *const lhs, const struct MonthDelta *const rhs)
Determine whether a MonthDelta is less than another MonthDelta (lhs < rhs).
void MonthDelta_subtract(struct MonthDelta *const self, const struct MonthDelta *const other)
Subtract another MonthDelta from a MonthDelta.
int_month_delta MonthDelta_months(const struct MonthDelta *const self)
Get the number of months represented by a MonthDelta.
void MonthDelta_negate(struct MonthDelta *const self)
Negate a MonthDelta, making it negative if it was positive or positive if it was negative.
present_bool MonthDelta_equal(const struct MonthDelta *const lhs, const struct MonthDelta *const rhs)
Determine whether two MonthDelta instances are equal (lhs == rhs).
void MonthDelta_ptr_zero(struct MonthDelta *const result)
Create a new MonthDelta initialized to zero months.
struct MonthDelta MonthDelta_from_months(int_month_delta months)
Create a new MonthDelta based on a positive or negative number of months.
struct MonthDelta MonthDelta_from_years(int_year_delta years)
Create a new MonthDelta based on a positive or negative number of years.
present_bool MonthDelta_less_than_or_equal(const struct MonthDelta *const lhs, const struct MonthDelta *const rhs)
Determine whether a MonthDelta is less than or equal to another MonthDelta (lhs <= rhs)...
void MonthDelta_divide_by(struct MonthDelta *const self, long scale_factor)
Scale a MonthDelta by dividing it by a scale factor.
int_year_delta years() const
Get the number of years represented by a MonthDelta.
present_int32 int_month_delta
Definition: types.h:90
present_bool MonthDelta_greater_than(const struct MonthDelta *const lhs, const struct MonthDelta *const rhs)
Determine whether a MonthDelta is greater than another MonthDelta (lhs > rhs).
void MonthDelta_multiply_by(struct MonthDelta *const self, long scale_factor)
Scale a MonthDelta by multiplying it by a scale factor.
short MonthDelta_compare(const struct MonthDelta *const lhs, const struct MonthDelta *const rhs)
Compare two MonthDelta instances.
double MonthDelta_years_decimal(const struct MonthDelta *const self)
Get the number of years represented by a MonthDelta, with a fractional part if necessary.
void MonthDelta_add(struct MonthDelta *const self, const struct MonthDelta *const other)
Add another MonthDelta to a MonthDelta.
void MonthDelta_ptr_from_months(struct MonthDelta *const result, int_month_delta months)
Create a new MonthDelta based on a positive or negative number of months.
void MonthDelta_ptr_from_years(struct MonthDelta *const result, int_year_delta years)
Create a new MonthDelta based on a positive or negative number of years.
struct MonthDelta MonthDelta_zero(void)
Create a new MonthDelta initialized to zero months.
bool present_bool
Definition: types.h:21
int_year_delta MonthDelta_years(const struct MonthDelta *const self)
Get the number of years represented by a MonthDelta.
Class or struct representing a positive or negative delta of a number of months or years...
Definition: month-delta.h:38
present_bool MonthDelta_greater_than_or_equal(const struct MonthDelta *const lhs, const struct MonthDelta *const rhs)
Determine whether a MonthDelta is greater than or equal to another MonthDelta (lhs >= rhs)...