C++ Utilities  4.17.0
Useful C++ classes and routines such as argument parser, IO and conversion utilities
period.h
Go to the documentation of this file.
1 #ifndef CHRONO_UTILITIES_PERIOD_H
2 #define CHRONO_UTILITIES_PERIOD_H
3 
4 #include "./datetime.h"
5 
6 namespace ChronoUtilities {
7 
9 public:
10  Period(const DateTime &begin, const DateTime &end);
11  int years() const;
12  int months() const;
13  int days() const;
14 
15 private:
16  int m_years;
17  int m_months;
18  int m_days;
19 };
20 
24 inline int Period::years() const
25 {
26  return m_years;
27 }
28 
32 inline int Period::months() const
33 {
34  return m_months;
35 }
36 
40 inline int Period::days() const
41 {
42  return m_days;
43 }
44 
46 
47 } // namespace ChronoUtilities
48 
49 #endif // CHRONO_UTILITIES_PERIOD_H
DateTime CPP_UTILITIES_EXPORT operator+(DateTime begin, Period period)
Adds the specified period to the specified date.
Definition: period.cpp:62
#define CPP_UTILITIES_EXPORT
Represents an instant in time, typically expressed as a date and time of day.
Definition: datetime.h:52
Contains classes providing a means for handling date and time information.
Definition: datetime.h:12
Represents a period of time.
Definition: period.h:8
int days() const
Returns the days component of the period represented by the current instance.
Definition: period.h:40
int years() const
Returns the years component of the period represented by the current instance.
Definition: period.h:24
int months() const
Returns the months component of the period represented by the current instance.
Definition: period.h:32