annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/unicode/tztrans.h @ 69:33d812a61356

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