2 *******************************************************************************
3 * Copyright (C) 2008-2009, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 *******************************************************************************
9 *******************************************************************************
15 #include "unicode/utypes.h"
16 #include "unicode/uobject.h"
20 * \brief C++ API: Date Interval data type
28 * This class represents a date interval.
29 * It is a pair of UDate representing from UDate 1 to UDate 2.
32 class U_COMMON_API DateInterval
: public UObject
{
36 * Construct a DateInterval given a from date and a to date.
37 * @param fromDate The from date in date interval.
38 * @param toDate The to date in date interval.
41 DateInterval(UDate fromDate
, UDate toDate
);
47 virtual ~DateInterval();
51 * @return the from date in dateInterval.
54 UDate
getFromDate() const;
58 * @return the to date in dateInterval.
61 UDate
getToDate() const;
65 * Return the class ID for this class. This is useful only for comparing to
66 * a return value from getDynamicClassID(). For example:
68 * . Base* polymorphic_pointer = createPolymorphicObject();
69 * . if (polymorphic_pointer->getDynamicClassID() ==
70 * . erived::getStaticClassID()) ...
72 * @return The class ID for all objects of this class.
75 static UClassID U_EXPORT2
getStaticClassID(void);
78 * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
79 * method is to implement a simple version of RTTI, since not all C++
80 * compilers support genuine RTTI. Polymorphic operator==() and clone()
81 * methods call this method.
83 * @return The class ID for this object. All objects of a
84 * given class have the same class ID. Objects of
85 * other classes have different class IDs.
88 virtual UClassID
getDynamicClassID(void) const;
95 DateInterval(const DateInterval
& other
);
98 * Default assignment operator
101 DateInterval
& operator=(const DateInterval
&);
105 * @return TRUE if the two DateIntervals are the same
108 virtual UBool
operator==(const DateInterval
& other
) const;
111 * Non-equality operator
112 * @return TRUE if the two DateIntervals are not the same
115 UBool
operator!=(const DateInterval
& other
) const;
120 * The caller owns the result and should delete it when done.
121 * @return a cloned DateInterval
124 virtual DateInterval
* clone() const;
128 * Default constructor, not implemented.
135 } ;// end class DateInterval
139 DateInterval::getFromDate() const {
145 DateInterval::getToDate() const {
151 DateInterval::operator!=(const DateInterval
& other
) const {
152 return ( !operator==(other
) );