Loading...
Searching...
No Matches
DateDuration.h
Go to the documentation of this file.
1/* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2
3 This file is part of the TerraLib - a Framework for building GIS enabled applications.
4
5 TerraLib is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 TerraLib is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with TerraLib. See COPYING. If not, write to
17 TerraLib Team at <terralib-team@terralib.org>.
18 */
19
20/*!
21 \file terralib/datatype/DateDuration.h
22
23 \brief A class to represent date duration.
24*/
25
26#ifndef __TERRALIB_DATATYPE_INTERNAL_DATEDURATION_H
27#define __TERRALIB_DATATYPE_INTERNAL_DATEDURATION_H
28
29// TerraLib
30#include "DateTime.h"
31
32#include <memory>
33
34namespace boost
35{
36 namespace gregorian
37 {
38 class date_duration;
39 }
40}
41
42namespace te
43{
44 namespace dt
45 {
46 class DateDurationImpl;
47 /*!
48 \class DateDuration
49
50 \brief A class to represent date duration.
51
52 A date duration is a simple day count used for arithmetic with date,
53 based on the Gregorian Calendar. Internally, it uses the datetime boost
54 library to represent gregorian date duration,
55 by using the data type boost::gregorian::date_duration.
56
57 \sa DateTime, Date, DatePeriod, TimeDuration, TimeInstant, TimeInstantTZ, TimePeriod, TimePeriodTZ
58 */
60 {
61 public:
62
63 /*! \brief Empty constructor. */
65
66 /*!
67 \brief Constructor.
68
69 \param dd A date duration in days.
70 */
71 DateDuration(long dd);
72
73 /*!
74 \brief Constructor.
75
76 \param dd A date duration.
77 */
78 DateDuration(const boost::gregorian::date_duration& dd);
79
80 /*!
81 \brief Copy Constructor.
82 */
84
85 /*!
86 \brief It returns the boost date duration type.
87
88 \return The boost date duration type.
89 */
90 const boost::gregorian::date_duration& getDateDuration() const;
91
92 /*!
93 \brief It returns the boost date duration type.
94
95 \return The boost date duration type.
96 */
97 boost::gregorian::date_duration& getDateDuration();
98
99 /*!
100 \brief Operator =
101
102 \param rhs The date to be assigned.
103
104 \return It returns the new value for the assigned object
105 */
106 DateDuration& operator= (const DateDuration& date);
107
108 /*!
109 \brief Operator ==
110
111 \param rhs The date duration to be compared.
112
113 \return It returns true if the two date durations are equal. Otherwise, it returns false.
114 */
115 bool operator==(const DateTime& rhs) const;
116
117 /*!
118 \brief Operator !=
119
120 \param rhs The date duration to be compared.
121
122 \return It returns true if the two date durations are not equal. Otherwise, it returns false.
123 */
124 bool operator!=(const DateTime& rhs) const;
125
126 /*!
127 \brief Operator <
128
129 \param rhs The right-hand-side date duration to be compared.
130
131 \return It returns true if the right-hand-side date duration is greater than the lefth side one. Otherwise, it returns false.
132 */
133 bool operator<(const DateTime& rhs) const;
134
135 /*!
136 \brief Operator >
137
138 \param rhs The right-hand-side date duration to be compared.
139
140 \return It returns true if the right-hand-side date duration is less than the lefth side one. Otherwise, it returns false.
141 */
142 bool operator>(const DateTime& rhs) const;
143
144 /*!
145 \brief It returns a clone of this object.
146
147 \return A clone of this object.
148 */
150
151 /*!
152 \brief It returns the date duration in a textual format.
153
154 \return The date duration in a textual format.
155 */
156 std::string toString() const;
157
158 /*!
159 \brief It returns the subtype of the date and time type.
160
161 \return The subtype of the date and time type.
162 */
164
165 /*!
166 \brief Destructor
167 */
168 virtual ~DateDuration();
169
170 protected:
171
172 std::unique_ptr<DateDurationImpl> m_dateDurationImpl; //!< Date duration information.
173 };
174
175 } // end namespace dt
176} // end namespace te
177
178#endif // __TERRALIB_DATATYPE_INTERNAL_DATEDURATION_H
179
An abstract class for date and time types.
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:56
A class to represent date duration.
Definition: DateDuration.h:60
virtual ~DateDuration()
Destructor.
DateDuration()
Empty constructor.
DateDuration(const te::dt::DateDuration &rhs)
Copy Constructor.
const boost::gregorian::date_duration & getDateDuration() const
It returns the boost date duration type.
DateDuration(const boost::gregorian::date_duration &dd)
Constructor.
DateDuration(long dd)
Constructor.
bool operator>(const DateTime &rhs) const
Operator >
bool operator==(const DateTime &rhs) const
Operator ==.
boost::gregorian::date_duration & getDateDuration()
It returns the boost date duration type.
AbstractData * clone() const
It returns a clone of this object.
DateTimeType getDateTimeType() const
It returns the subtype of the date and time type.
Definition: DateDuration.h:163
bool operator<(const DateTime &rhs) const
Operator <.
bool operator!=(const DateTime &rhs) const
Operator !=.
std::string toString() const
It returns the date duration in a textual format.
std::unique_ptr< DateDurationImpl > m_dateDurationImpl
Date duration information.
Definition: DateDuration.h:172
DateTimeType
The subtype of date and time type, based on ISO 8621.
Definition: Enums.h:46
@ DATE_DURATION
Definition: Enums.h:49
TerraLib.
#define TEDATATYPEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61