Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
michael@0 | 1 | /* |
michael@0 | 2 | ******************************************************************************* |
michael@0 | 3 | * Copyright (C) 2007-2008, International Business Machines Corporation and * |
michael@0 | 4 | * others. All Rights Reserved. * |
michael@0 | 5 | ******************************************************************************* |
michael@0 | 6 | */ |
michael@0 | 7 | #ifndef TZTRANS_H |
michael@0 | 8 | #define TZTRANS_H |
michael@0 | 9 | |
michael@0 | 10 | /** |
michael@0 | 11 | * \file |
michael@0 | 12 | * \brief C++ API: Time zone transition |
michael@0 | 13 | */ |
michael@0 | 14 | |
michael@0 | 15 | #include "unicode/utypes.h" |
michael@0 | 16 | |
michael@0 | 17 | #if !UCONFIG_NO_FORMATTING |
michael@0 | 18 | |
michael@0 | 19 | #include "unicode/uobject.h" |
michael@0 | 20 | |
michael@0 | 21 | U_NAMESPACE_BEGIN |
michael@0 | 22 | |
michael@0 | 23 | // Forward declaration |
michael@0 | 24 | class TimeZoneRule; |
michael@0 | 25 | |
michael@0 | 26 | /** |
michael@0 | 27 | * <code>TimeZoneTransition</code> is a class representing a time zone transition. |
michael@0 | 28 | * An instance has a time of transition and rules for both before and after the transition. |
michael@0 | 29 | * @stable ICU 3.8 |
michael@0 | 30 | */ |
michael@0 | 31 | class U_I18N_API TimeZoneTransition : public UObject { |
michael@0 | 32 | public: |
michael@0 | 33 | /** |
michael@0 | 34 | * Constructs a <code>TimeZoneTransition</code> with the time and the rules before/after |
michael@0 | 35 | * the transition. |
michael@0 | 36 | * |
michael@0 | 37 | * @param time The time of transition in milliseconds since the base time. |
michael@0 | 38 | * @param from The time zone rule used before the transition. |
michael@0 | 39 | * @param to The time zone rule used after the transition. |
michael@0 | 40 | * @stable ICU 3.8 |
michael@0 | 41 | */ |
michael@0 | 42 | TimeZoneTransition(UDate time, const TimeZoneRule& from, const TimeZoneRule& to); |
michael@0 | 43 | |
michael@0 | 44 | /** |
michael@0 | 45 | * Constructs an empty <code>TimeZoneTransition</code> |
michael@0 | 46 | * @stable ICU 3.8 |
michael@0 | 47 | */ |
michael@0 | 48 | TimeZoneTransition(); |
michael@0 | 49 | |
michael@0 | 50 | /** |
michael@0 | 51 | * Copy constructor. |
michael@0 | 52 | * @param source The TimeZoneTransition object to be copied. |
michael@0 | 53 | * @stable ICU 3.8 |
michael@0 | 54 | */ |
michael@0 | 55 | TimeZoneTransition(const TimeZoneTransition& source); |
michael@0 | 56 | |
michael@0 | 57 | /** |
michael@0 | 58 | * Destructor. |
michael@0 | 59 | * @stable ICU 3.8 |
michael@0 | 60 | */ |
michael@0 | 61 | ~TimeZoneTransition(); |
michael@0 | 62 | |
michael@0 | 63 | /** |
michael@0 | 64 | * Clone this TimeZoneTransition object polymorphically. The caller owns the result and |
michael@0 | 65 | * should delete it when done. |
michael@0 | 66 | * @return A copy of the object. |
michael@0 | 67 | * @stable ICU 3.8 |
michael@0 | 68 | */ |
michael@0 | 69 | TimeZoneTransition* clone(void) const; |
michael@0 | 70 | |
michael@0 | 71 | /** |
michael@0 | 72 | * Assignment operator. |
michael@0 | 73 | * @param right The object to be copied. |
michael@0 | 74 | * @stable ICU 3.8 |
michael@0 | 75 | */ |
michael@0 | 76 | TimeZoneTransition& operator=(const TimeZoneTransition& right); |
michael@0 | 77 | |
michael@0 | 78 | /** |
michael@0 | 79 | * Return true if the given TimeZoneTransition objects are semantically equal. Objects |
michael@0 | 80 | * of different subclasses are considered unequal. |
michael@0 | 81 | * @param that The object to be compared with. |
michael@0 | 82 | * @return true if the given TimeZoneTransition objects are semantically equal. |
michael@0 | 83 | * @stable ICU 3.8 |
michael@0 | 84 | */ |
michael@0 | 85 | UBool operator==(const TimeZoneTransition& that) const; |
michael@0 | 86 | |
michael@0 | 87 | /** |
michael@0 | 88 | * Return true if the given TimeZoneTransition objects are semantically unequal. Objects |
michael@0 | 89 | * of different subclasses are considered unequal. |
michael@0 | 90 | * @param that The object to be compared with. |
michael@0 | 91 | * @return true if the given TimeZoneTransition objects are semantically unequal. |
michael@0 | 92 | * @stable ICU 3.8 |
michael@0 | 93 | */ |
michael@0 | 94 | UBool operator!=(const TimeZoneTransition& that) const; |
michael@0 | 95 | |
michael@0 | 96 | /** |
michael@0 | 97 | * Returns the time of transition in milliseconds. |
michael@0 | 98 | * @return The time of the transition in milliseconds since the 1970 Jan 1 epoch time. |
michael@0 | 99 | * @stable ICU 3.8 |
michael@0 | 100 | */ |
michael@0 | 101 | UDate getTime(void) const; |
michael@0 | 102 | |
michael@0 | 103 | /** |
michael@0 | 104 | * Sets the time of transition in milliseconds. |
michael@0 | 105 | * @param time The time of the transition in milliseconds since the 1970 Jan 1 epoch time. |
michael@0 | 106 | * @stable ICU 3.8 |
michael@0 | 107 | */ |
michael@0 | 108 | void setTime(UDate time); |
michael@0 | 109 | |
michael@0 | 110 | /** |
michael@0 | 111 | * Returns the rule used before the transition. |
michael@0 | 112 | * @return The time zone rule used after the transition. |
michael@0 | 113 | * @stable ICU 3.8 |
michael@0 | 114 | */ |
michael@0 | 115 | const TimeZoneRule* getFrom(void) const; |
michael@0 | 116 | |
michael@0 | 117 | /** |
michael@0 | 118 | * Sets the rule used before the transition. The caller remains |
michael@0 | 119 | * responsible for deleting the <code>TimeZoneRule</code> object. |
michael@0 | 120 | * @param from The time zone rule used before the transition. |
michael@0 | 121 | * @stable ICU 3.8 |
michael@0 | 122 | */ |
michael@0 | 123 | void setFrom(const TimeZoneRule& from); |
michael@0 | 124 | |
michael@0 | 125 | /** |
michael@0 | 126 | * Adopts the rule used before the transition. The caller must |
michael@0 | 127 | * not delete the <code>TimeZoneRule</code> object passed in. |
michael@0 | 128 | * @param from The time zone rule used before the transition. |
michael@0 | 129 | * @stable ICU 3.8 |
michael@0 | 130 | */ |
michael@0 | 131 | void adoptFrom(TimeZoneRule* from); |
michael@0 | 132 | |
michael@0 | 133 | /** |
michael@0 | 134 | * Sets the rule used after the transition. The caller remains |
michael@0 | 135 | * responsible for deleting the <code>TimeZoneRule</code> object. |
michael@0 | 136 | * @param to The time zone rule used after the transition. |
michael@0 | 137 | * @stable ICU 3.8 |
michael@0 | 138 | */ |
michael@0 | 139 | void setTo(const TimeZoneRule& to); |
michael@0 | 140 | |
michael@0 | 141 | /** |
michael@0 | 142 | * Adopts the rule used after the transition. The caller must |
michael@0 | 143 | * not delete the <code>TimeZoneRule</code> object passed in. |
michael@0 | 144 | * @param to The time zone rule used after the transition. |
michael@0 | 145 | * @stable ICU 3.8 |
michael@0 | 146 | */ |
michael@0 | 147 | void adoptTo(TimeZoneRule* to); |
michael@0 | 148 | |
michael@0 | 149 | /** |
michael@0 | 150 | * Returns the rule used after the transition. |
michael@0 | 151 | * @return The time zone rule used after the transition. |
michael@0 | 152 | * @stable ICU 3.8 |
michael@0 | 153 | */ |
michael@0 | 154 | const TimeZoneRule* getTo(void) const; |
michael@0 | 155 | |
michael@0 | 156 | private: |
michael@0 | 157 | UDate fTime; |
michael@0 | 158 | TimeZoneRule* fFrom; |
michael@0 | 159 | TimeZoneRule* fTo; |
michael@0 | 160 | |
michael@0 | 161 | public: |
michael@0 | 162 | /** |
michael@0 | 163 | * Return the class ID for this class. This is useful only for comparing to |
michael@0 | 164 | * a return value from getDynamicClassID(). For example: |
michael@0 | 165 | * <pre> |
michael@0 | 166 | * . Base* polymorphic_pointer = createPolymorphicObject(); |
michael@0 | 167 | * . if (polymorphic_pointer->getDynamicClassID() == |
michael@0 | 168 | * . erived::getStaticClassID()) ... |
michael@0 | 169 | * </pre> |
michael@0 | 170 | * @return The class ID for all objects of this class. |
michael@0 | 171 | * @stable ICU 3.8 |
michael@0 | 172 | */ |
michael@0 | 173 | static UClassID U_EXPORT2 getStaticClassID(void); |
michael@0 | 174 | |
michael@0 | 175 | /** |
michael@0 | 176 | * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This |
michael@0 | 177 | * method is to implement a simple version of RTTI, since not all C++ |
michael@0 | 178 | * compilers support genuine RTTI. Polymorphic operator==() and clone() |
michael@0 | 179 | * methods call this method. |
michael@0 | 180 | * |
michael@0 | 181 | * @return The class ID for this object. All objects of a |
michael@0 | 182 | * given class have the same class ID. Objects of |
michael@0 | 183 | * other classes have different class IDs. |
michael@0 | 184 | * @stable ICU 3.8 |
michael@0 | 185 | */ |
michael@0 | 186 | virtual UClassID getDynamicClassID(void) const; |
michael@0 | 187 | }; |
michael@0 | 188 | |
michael@0 | 189 | U_NAMESPACE_END |
michael@0 | 190 | |
michael@0 | 191 | #endif /* #if !UCONFIG_NO_FORMATTING */ |
michael@0 | 192 | |
michael@0 | 193 | #endif // TZTRANS_H |
michael@0 | 194 | |
michael@0 | 195 | //eof |