2016-06-11 19:09:14 +02:00
|
|
|
#ifndef CHRONO_UTILITIES_PERIOD_H
|
|
|
|
#define CHRONO_UTILITIES_PERIOD_H
|
2015-04-22 18:36:40 +02:00
|
|
|
|
2015-09-06 20:19:09 +02:00
|
|
|
#include "./datetime.h"
|
2015-04-22 18:36:40 +02:00
|
|
|
|
|
|
|
namespace ChronoUtilities {
|
|
|
|
|
2017-05-01 03:13:11 +02:00
|
|
|
class CPP_UTILITIES_EXPORT Period {
|
2015-04-22 18:36:40 +02:00
|
|
|
public:
|
|
|
|
Period(const DateTime &beg, const DateTime &end);
|
|
|
|
int years() const;
|
|
|
|
int months() const;
|
|
|
|
int days() const;
|
2017-05-01 03:13:11 +02:00
|
|
|
|
2015-04-22 18:36:40 +02:00
|
|
|
private:
|
|
|
|
int m_years;
|
|
|
|
int m_months;
|
|
|
|
int m_days;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
2016-01-18 23:41:30 +01:00
|
|
|
* \brief Gets the years component of the period represented by the current instance.
|
2015-04-22 18:36:40 +02:00
|
|
|
*/
|
|
|
|
inline int Period::years() const
|
|
|
|
{
|
|
|
|
return m_years;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2016-01-18 23:41:30 +01:00
|
|
|
* \brief Gets the months component of the period represented by the current instance.
|
2015-04-22 18:36:40 +02:00
|
|
|
*/
|
|
|
|
inline int Period::months() const
|
|
|
|
{
|
|
|
|
return m_months;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2016-01-18 23:41:30 +01:00
|
|
|
* \brief Gets the days component of the period represented by the current instance.
|
2015-04-22 18:36:40 +02:00
|
|
|
*/
|
|
|
|
inline int Period::days() const
|
|
|
|
{
|
|
|
|
return m_days;
|
|
|
|
}
|
2017-09-17 21:45:23 +02:00
|
|
|
} // namespace ChronoUtilities
|
2015-04-22 18:36:40 +02:00
|
|
|
|
2016-06-11 19:09:14 +02:00
|
|
|
#endif // CHRONO_UTILITIES_PERIOD_H
|