OLD | NEW |
(Empty) | |
| 1 /* |
| 2 ******************************************************************************* |
| 3 * Copyright (C) 2008-2009, International Business Machines Corporation and |
| 4 * others. All Rights Reserved. |
| 5 ******************************************************************************* |
| 6 * |
| 7 * File DTINTRV.H |
| 8 * |
| 9 ******************************************************************************* |
| 10 */ |
| 11 |
| 12 #ifndef __DTINTRV_H__ |
| 13 #define __DTINTRV_H__ |
| 14 |
| 15 #include "unicode/utypes.h" |
| 16 #include "unicode/uobject.h" |
| 17 |
| 18 /** |
| 19 * \file |
| 20 * \brief C++ API: Date Interval data type |
| 21 */ |
| 22 |
| 23 |
| 24 U_NAMESPACE_BEGIN |
| 25 |
| 26 |
| 27 /** |
| 28 * This class represents a date interval. |
| 29 * It is a pair of UDate representing from UDate 1 to UDate 2. |
| 30 * @stable ICU 4.0 |
| 31 **/ |
| 32 class U_COMMON_API DateInterval : public UObject { |
| 33 public: |
| 34 |
| 35 /** |
| 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. |
| 39 * @stable ICU 4.0 |
| 40 */ |
| 41 DateInterval(UDate fromDate, UDate toDate); |
| 42 |
| 43 /** |
| 44 * destructor |
| 45 * @stable ICU 4.0 |
| 46 */ |
| 47 virtual ~DateInterval(); |
| 48 |
| 49 /** |
| 50 * Get the from date. |
| 51 * @return the from date in dateInterval. |
| 52 * @stable ICU 4.0 |
| 53 */ |
| 54 UDate getFromDate() const; |
| 55 |
| 56 /** |
| 57 * Get the to date. |
| 58 * @return the to date in dateInterval. |
| 59 * @stable ICU 4.0 |
| 60 */ |
| 61 UDate getToDate() const; |
| 62 |
| 63 |
| 64 /** |
| 65 * Return the class ID for this class. This is useful only for comparing to |
| 66 * a return value from getDynamicClassID(). For example: |
| 67 * <pre> |
| 68 * . Base* polymorphic_pointer = createPolymorphicObject(); |
| 69 * . if (polymorphic_pointer->getDynamicClassID() == |
| 70 * . erived::getStaticClassID()) ... |
| 71 * </pre> |
| 72 * @return The class ID for all objects of this class. |
| 73 * @stable ICU 4.0 |
| 74 */ |
| 75 static UClassID U_EXPORT2 getStaticClassID(void); |
| 76 |
| 77 /** |
| 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. |
| 82 * |
| 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. |
| 86 * @stable ICU 4.0 |
| 87 */ |
| 88 virtual UClassID getDynamicClassID(void) const; |
| 89 |
| 90 |
| 91 /** |
| 92 * Copy constructor. |
| 93 * @stable ICU 4.0 |
| 94 */ |
| 95 DateInterval(const DateInterval& other); |
| 96 |
| 97 /** |
| 98 * Default assignment operator |
| 99 * @stable ICU 4.0 |
| 100 */ |
| 101 DateInterval& operator=(const DateInterval&); |
| 102 |
| 103 /** |
| 104 * Equality operator. |
| 105 * @return TRUE if the two DateIntervals are the same |
| 106 * @stable ICU 4.0 |
| 107 */ |
| 108 virtual UBool operator==(const DateInterval& other) const; |
| 109 |
| 110 /** |
| 111 * Non-equality operator |
| 112 * @return TRUE if the two DateIntervals are not the same |
| 113 * @stable ICU 4.0 |
| 114 */ |
| 115 UBool operator!=(const DateInterval& other) const; |
| 116 |
| 117 |
| 118 /** |
| 119 * clone this object. |
| 120 * The caller owns the result and should delete it when done. |
| 121 * @return a cloned DateInterval |
| 122 * @stable ICU 4.0 |
| 123 */ |
| 124 virtual DateInterval* clone() const; |
| 125 |
| 126 private: |
| 127 /** |
| 128 * Default constructor, not implemented. |
| 129 */ |
| 130 DateInterval(); |
| 131 |
| 132 UDate fromDate; |
| 133 UDate toDate; |
| 134 |
| 135 } ;// end class DateInterval |
| 136 |
| 137 |
| 138 inline UDate |
| 139 DateInterval::getFromDate() const { |
| 140 return fromDate; |
| 141 } |
| 142 |
| 143 |
| 144 inline UDate |
| 145 DateInterval::getToDate() const { |
| 146 return toDate; |
| 147 } |
| 148 |
| 149 |
| 150 inline UBool |
| 151 DateInterval::operator!=(const DateInterval& other) const { |
| 152 return ( !operator==(other) ); |
| 153 } |
| 154 |
| 155 |
| 156 U_NAMESPACE_END |
| 157 |
| 158 #endif |
OLD | NEW |