All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DateDuration.cpp
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.cpp
22 
23  \brief A class to represent date duration.
24 */
25 
26 // TerraLib
27 #include "../common/StringUtils.h"
28 #include "DateDuration.h"
29 
31  : m_dateDuration()
32 {
33 }
34 
36  : m_dateDuration(dd)
37 {
38 }
39 
40 te::dt::DateDuration::DateDuration(const boost::gregorian::date_duration& dd)
41  : m_dateDuration(dd)
42 {
43 }
44 
46 {
47  const te::dt::DateDuration* t = dynamic_cast<const te::dt::DateDuration*>(&rhs);
48  return m_dateDuration == t->m_dateDuration;
49 }
50 
52 {
53  const te::dt::DateDuration* t = dynamic_cast<const te::dt::DateDuration*>(&rhs);
54  return m_dateDuration != t->m_dateDuration;
55 }
56 
58 {
59  const te::dt::DateDuration* t = dynamic_cast<const te::dt::DateDuration*>(&rhs);
60  return m_dateDuration < t->m_dateDuration;
61 }
62 
64 {
65  const te::dt::DateDuration* t = dynamic_cast<const te::dt::DateDuration*>(&rhs);
66  return m_dateDuration > t->m_dateDuration;
67 }
68 
70 {
71  return new DateDuration(*this);
72 }
73 
74 std::string te::dt::DateDuration::toString() const
75 {
76  boost::int64_t days = m_dateDuration.days();
77 
78  return te::common::Convert2String(days);
79 }
80 
82 {
83 }
84 
85 
std::string toString() const
It returns the date duration in a textual format.
bool operator==(const DateTime &rhs) const
Operator ==.
bool operator!=(const DateTime &rhs) const
Operator !=.
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:57
bool operator>(const DateTime &rhs) const
Operator >
DateDuration()
Empty constructor.
boost::gregorian::date_duration m_dateDuration
Date duration information.
Definition: DateDuration.h:150
A class to represent date duration.
Definition: DateDuration.h:51
virtual ~DateDuration()
Destructor.
std::string Convert2String(boost::int16_t value)
It converts a short integer value to a string.
Definition: StringUtils.h:51
bool operator<(const DateTime &rhs) const
Operator <.
A class to represent date duration.
AbstractData * clone() const
It returns a clone of this object.