jpayne@69: // © 2016 and later: Unicode, Inc. and others. jpayne@69: // License & terms of use: http://www.unicode.org/copyright.html jpayne@69: /* jpayne@69: ******************************************************************************* jpayne@69: * Copyright (C) 2007-2008, International Business Machines Corporation and * jpayne@69: * others. All Rights Reserved. * jpayne@69: ******************************************************************************* jpayne@69: */ jpayne@69: #ifndef TZTRANS_H jpayne@69: #define TZTRANS_H jpayne@69: jpayne@69: /** jpayne@69: * \file jpayne@69: * \brief C++ API: Time zone transition jpayne@69: */ jpayne@69: jpayne@69: #include "unicode/utypes.h" jpayne@69: jpayne@69: #if U_SHOW_CPLUSPLUS_API jpayne@69: jpayne@69: #if !UCONFIG_NO_FORMATTING jpayne@69: jpayne@69: #include "unicode/uobject.h" jpayne@69: jpayne@69: U_NAMESPACE_BEGIN jpayne@69: jpayne@69: // Forward declaration jpayne@69: class TimeZoneRule; jpayne@69: jpayne@69: /** jpayne@69: * TimeZoneTransition is a class representing a time zone transition. jpayne@69: * An instance has a time of transition and rules for both before and after the transition. jpayne@69: * @stable ICU 3.8 jpayne@69: */ jpayne@69: class U_I18N_API TimeZoneTransition : public UObject { jpayne@69: public: jpayne@69: /** jpayne@69: * Constructs a TimeZoneTransition with the time and the rules before/after jpayne@69: * the transition. jpayne@69: * jpayne@69: * @param time The time of transition in milliseconds since the base time. jpayne@69: * @param from The time zone rule used before the transition. jpayne@69: * @param to The time zone rule used after the transition. jpayne@69: * @stable ICU 3.8 jpayne@69: */ jpayne@69: TimeZoneTransition(UDate time, const TimeZoneRule& from, const TimeZoneRule& to); jpayne@69: jpayne@69: /** jpayne@69: * Constructs an empty TimeZoneTransition jpayne@69: * @stable ICU 3.8 jpayne@69: */ jpayne@69: TimeZoneTransition(); jpayne@69: jpayne@69: /** jpayne@69: * Copy constructor. jpayne@69: * @param source The TimeZoneTransition object to be copied. jpayne@69: * @stable ICU 3.8 jpayne@69: */ jpayne@69: TimeZoneTransition(const TimeZoneTransition& source); jpayne@69: jpayne@69: /** jpayne@69: * Destructor. jpayne@69: * @stable ICU 3.8 jpayne@69: */ jpayne@69: ~TimeZoneTransition(); jpayne@69: jpayne@69: /** jpayne@69: * Clone this TimeZoneTransition object polymorphically. The caller owns the result and jpayne@69: * should delete it when done. jpayne@69: * @return A copy of the object. jpayne@69: * @stable ICU 3.8 jpayne@69: */ jpayne@69: TimeZoneTransition* clone() const; jpayne@69: jpayne@69: /** jpayne@69: * Assignment operator. jpayne@69: * @param right The object to be copied. jpayne@69: * @stable ICU 3.8 jpayne@69: */ jpayne@69: TimeZoneTransition& operator=(const TimeZoneTransition& right); jpayne@69: jpayne@69: /** jpayne@69: * Return true if the given TimeZoneTransition objects are semantically equal. Objects jpayne@69: * of different subclasses are considered unequal. jpayne@69: * @param that The object to be compared with. jpayne@69: * @return true if the given TimeZoneTransition objects are semantically equal. jpayne@69: * @stable ICU 3.8 jpayne@69: */ jpayne@69: UBool operator==(const TimeZoneTransition& that) const; jpayne@69: jpayne@69: /** jpayne@69: * Return true if the given TimeZoneTransition objects are semantically unequal. Objects jpayne@69: * of different subclasses are considered unequal. jpayne@69: * @param that The object to be compared with. jpayne@69: * @return true if the given TimeZoneTransition objects are semantically unequal. jpayne@69: * @stable ICU 3.8 jpayne@69: */ jpayne@69: UBool operator!=(const TimeZoneTransition& that) const; jpayne@69: jpayne@69: /** jpayne@69: * Returns the time of transition in milliseconds. jpayne@69: * @return The time of the transition in milliseconds since the 1970 Jan 1 epoch time. jpayne@69: * @stable ICU 3.8 jpayne@69: */ jpayne@69: UDate getTime(void) const; jpayne@69: jpayne@69: /** jpayne@69: * Sets the time of transition in milliseconds. jpayne@69: * @param time The time of the transition in milliseconds since the 1970 Jan 1 epoch time. jpayne@69: * @stable ICU 3.8 jpayne@69: */ jpayne@69: void setTime(UDate time); jpayne@69: jpayne@69: /** jpayne@69: * Returns the rule used before the transition. jpayne@69: * @return The time zone rule used after the transition. jpayne@69: * @stable ICU 3.8 jpayne@69: */ jpayne@69: const TimeZoneRule* getFrom(void) const; jpayne@69: jpayne@69: /** jpayne@69: * Sets the rule used before the transition. The caller remains jpayne@69: * responsible for deleting the TimeZoneRule object. jpayne@69: * @param from The time zone rule used before the transition. jpayne@69: * @stable ICU 3.8 jpayne@69: */ jpayne@69: void setFrom(const TimeZoneRule& from); jpayne@69: jpayne@69: /** jpayne@69: * Adopts the rule used before the transition. The caller must jpayne@69: * not delete the TimeZoneRule object passed in. jpayne@69: * @param from The time zone rule used before the transition. jpayne@69: * @stable ICU 3.8 jpayne@69: */ jpayne@69: void adoptFrom(TimeZoneRule* from); jpayne@69: jpayne@69: /** jpayne@69: * Sets the rule used after the transition. The caller remains jpayne@69: * responsible for deleting the TimeZoneRule object. jpayne@69: * @param to The time zone rule used after the transition. jpayne@69: * @stable ICU 3.8 jpayne@69: */ jpayne@69: void setTo(const TimeZoneRule& to); jpayne@69: jpayne@69: /** jpayne@69: * Adopts the rule used after the transition. The caller must jpayne@69: * not delete the TimeZoneRule object passed in. jpayne@69: * @param to The time zone rule used after the transition. jpayne@69: * @stable ICU 3.8 jpayne@69: */ jpayne@69: void adoptTo(TimeZoneRule* to); jpayne@69: jpayne@69: /** jpayne@69: * Returns the rule used after the transition. jpayne@69: * @return The time zone rule used after the transition. jpayne@69: * @stable ICU 3.8 jpayne@69: */ jpayne@69: const TimeZoneRule* getTo(void) const; jpayne@69: jpayne@69: private: jpayne@69: UDate fTime; jpayne@69: TimeZoneRule* fFrom; jpayne@69: TimeZoneRule* fTo; jpayne@69: jpayne@69: public: jpayne@69: /** jpayne@69: * Return the class ID for this class. This is useful only for comparing to jpayne@69: * a return value from getDynamicClassID(). For example: jpayne@69: *
jpayne@69:      * .   Base* polymorphic_pointer = createPolymorphicObject();
jpayne@69:      * .   if (polymorphic_pointer->getDynamicClassID() ==
jpayne@69:      * .       erived::getStaticClassID()) ...
jpayne@69:      * 
jpayne@69: * @return The class ID for all objects of this class. jpayne@69: * @stable ICU 3.8 jpayne@69: */ jpayne@69: static UClassID U_EXPORT2 getStaticClassID(void); jpayne@69: jpayne@69: /** jpayne@69: * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This jpayne@69: * method is to implement a simple version of RTTI, since not all C++ jpayne@69: * compilers support genuine RTTI. Polymorphic operator==() and clone() jpayne@69: * methods call this method. jpayne@69: * jpayne@69: * @return The class ID for this object. All objects of a jpayne@69: * given class have the same class ID. Objects of jpayne@69: * other classes have different class IDs. jpayne@69: * @stable ICU 3.8 jpayne@69: */ jpayne@69: virtual UClassID getDynamicClassID(void) const; jpayne@69: }; jpayne@69: jpayne@69: U_NAMESPACE_END jpayne@69: jpayne@69: #endif /* #if !UCONFIG_NO_FORMATTING */ jpayne@69: jpayne@69: #endif /* U_SHOW_CPLUSPLUS_API */ jpayne@69: jpayne@69: #endif // TZTRANS_H jpayne@69: jpayne@69: //eof