1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/i18n/unicode/tztrans.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,195 @@ 1.4 +/* 1.5 +******************************************************************************* 1.6 +* Copyright (C) 2007-2008, International Business Machines Corporation and * 1.7 +* others. All Rights Reserved. * 1.8 +******************************************************************************* 1.9 +*/ 1.10 +#ifndef TZTRANS_H 1.11 +#define TZTRANS_H 1.12 + 1.13 +/** 1.14 + * \file 1.15 + * \brief C++ API: Time zone transition 1.16 + */ 1.17 + 1.18 +#include "unicode/utypes.h" 1.19 + 1.20 +#if !UCONFIG_NO_FORMATTING 1.21 + 1.22 +#include "unicode/uobject.h" 1.23 + 1.24 +U_NAMESPACE_BEGIN 1.25 + 1.26 +// Forward declaration 1.27 +class TimeZoneRule; 1.28 + 1.29 +/** 1.30 + * <code>TimeZoneTransition</code> is a class representing a time zone transition. 1.31 + * An instance has a time of transition and rules for both before and after the transition. 1.32 + * @stable ICU 3.8 1.33 + */ 1.34 +class U_I18N_API TimeZoneTransition : public UObject { 1.35 +public: 1.36 + /** 1.37 + * Constructs a <code>TimeZoneTransition</code> with the time and the rules before/after 1.38 + * the transition. 1.39 + * 1.40 + * @param time The time of transition in milliseconds since the base time. 1.41 + * @param from The time zone rule used before the transition. 1.42 + * @param to The time zone rule used after the transition. 1.43 + * @stable ICU 3.8 1.44 + */ 1.45 + TimeZoneTransition(UDate time, const TimeZoneRule& from, const TimeZoneRule& to); 1.46 + 1.47 + /** 1.48 + * Constructs an empty <code>TimeZoneTransition</code> 1.49 + * @stable ICU 3.8 1.50 + */ 1.51 + TimeZoneTransition(); 1.52 + 1.53 + /** 1.54 + * Copy constructor. 1.55 + * @param source The TimeZoneTransition object to be copied. 1.56 + * @stable ICU 3.8 1.57 + */ 1.58 + TimeZoneTransition(const TimeZoneTransition& source); 1.59 + 1.60 + /** 1.61 + * Destructor. 1.62 + * @stable ICU 3.8 1.63 + */ 1.64 + ~TimeZoneTransition(); 1.65 + 1.66 + /** 1.67 + * Clone this TimeZoneTransition object polymorphically. The caller owns the result and 1.68 + * should delete it when done. 1.69 + * @return A copy of the object. 1.70 + * @stable ICU 3.8 1.71 + */ 1.72 + TimeZoneTransition* clone(void) const; 1.73 + 1.74 + /** 1.75 + * Assignment operator. 1.76 + * @param right The object to be copied. 1.77 + * @stable ICU 3.8 1.78 + */ 1.79 + TimeZoneTransition& operator=(const TimeZoneTransition& right); 1.80 + 1.81 + /** 1.82 + * Return true if the given TimeZoneTransition objects are semantically equal. Objects 1.83 + * of different subclasses are considered unequal. 1.84 + * @param that The object to be compared with. 1.85 + * @return true if the given TimeZoneTransition objects are semantically equal. 1.86 + * @stable ICU 3.8 1.87 + */ 1.88 + UBool operator==(const TimeZoneTransition& that) const; 1.89 + 1.90 + /** 1.91 + * Return true if the given TimeZoneTransition objects are semantically unequal. Objects 1.92 + * of different subclasses are considered unequal. 1.93 + * @param that The object to be compared with. 1.94 + * @return true if the given TimeZoneTransition objects are semantically unequal. 1.95 + * @stable ICU 3.8 1.96 + */ 1.97 + UBool operator!=(const TimeZoneTransition& that) const; 1.98 + 1.99 + /** 1.100 + * Returns the time of transition in milliseconds. 1.101 + * @return The time of the transition in milliseconds since the 1970 Jan 1 epoch time. 1.102 + * @stable ICU 3.8 1.103 + */ 1.104 + UDate getTime(void) const; 1.105 + 1.106 + /** 1.107 + * Sets the time of transition in milliseconds. 1.108 + * @param time The time of the transition in milliseconds since the 1970 Jan 1 epoch time. 1.109 + * @stable ICU 3.8 1.110 + */ 1.111 + void setTime(UDate time); 1.112 + 1.113 + /** 1.114 + * Returns the rule used before the transition. 1.115 + * @return The time zone rule used after the transition. 1.116 + * @stable ICU 3.8 1.117 + */ 1.118 + const TimeZoneRule* getFrom(void) const; 1.119 + 1.120 + /** 1.121 + * Sets the rule used before the transition. The caller remains 1.122 + * responsible for deleting the <code>TimeZoneRule</code> object. 1.123 + * @param from The time zone rule used before the transition. 1.124 + * @stable ICU 3.8 1.125 + */ 1.126 + void setFrom(const TimeZoneRule& from); 1.127 + 1.128 + /** 1.129 + * Adopts the rule used before the transition. The caller must 1.130 + * not delete the <code>TimeZoneRule</code> object passed in. 1.131 + * @param from The time zone rule used before the transition. 1.132 + * @stable ICU 3.8 1.133 + */ 1.134 + void adoptFrom(TimeZoneRule* from); 1.135 + 1.136 + /** 1.137 + * Sets the rule used after the transition. The caller remains 1.138 + * responsible for deleting the <code>TimeZoneRule</code> object. 1.139 + * @param to The time zone rule used after the transition. 1.140 + * @stable ICU 3.8 1.141 + */ 1.142 + void setTo(const TimeZoneRule& to); 1.143 + 1.144 + /** 1.145 + * Adopts the rule used after the transition. The caller must 1.146 + * not delete the <code>TimeZoneRule</code> object passed in. 1.147 + * @param to The time zone rule used after the transition. 1.148 + * @stable ICU 3.8 1.149 + */ 1.150 + void adoptTo(TimeZoneRule* to); 1.151 + 1.152 + /** 1.153 + * Returns the rule used after the transition. 1.154 + * @return The time zone rule used after the transition. 1.155 + * @stable ICU 3.8 1.156 + */ 1.157 + const TimeZoneRule* getTo(void) const; 1.158 + 1.159 +private: 1.160 + UDate fTime; 1.161 + TimeZoneRule* fFrom; 1.162 + TimeZoneRule* fTo; 1.163 + 1.164 +public: 1.165 + /** 1.166 + * Return the class ID for this class. This is useful only for comparing to 1.167 + * a return value from getDynamicClassID(). For example: 1.168 + * <pre> 1.169 + * . Base* polymorphic_pointer = createPolymorphicObject(); 1.170 + * . if (polymorphic_pointer->getDynamicClassID() == 1.171 + * . erived::getStaticClassID()) ... 1.172 + * </pre> 1.173 + * @return The class ID for all objects of this class. 1.174 + * @stable ICU 3.8 1.175 + */ 1.176 + static UClassID U_EXPORT2 getStaticClassID(void); 1.177 + 1.178 + /** 1.179 + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This 1.180 + * method is to implement a simple version of RTTI, since not all C++ 1.181 + * compilers support genuine RTTI. Polymorphic operator==() and clone() 1.182 + * methods call this method. 1.183 + * 1.184 + * @return The class ID for this object. All objects of a 1.185 + * given class have the same class ID. Objects of 1.186 + * other classes have different class IDs. 1.187 + * @stable ICU 3.8 1.188 + */ 1.189 + virtual UClassID getDynamicClassID(void) const; 1.190 +}; 1.191 + 1.192 +U_NAMESPACE_END 1.193 + 1.194 +#endif /* #if !UCONFIG_NO_FORMATTING */ 1.195 + 1.196 +#endif // TZTRANS_H 1.197 + 1.198 +//eof