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) 2009-2011, International Business Machines Corporation and |
michael@0 | 4 | * others. All Rights Reserved. |
michael@0 | 5 | ******************************************************************************* |
michael@0 | 6 | */ |
michael@0 | 7 | #ifndef __ZTRANS_H |
michael@0 | 8 | #define __ZTRANS_H |
michael@0 | 9 | |
michael@0 | 10 | /** |
michael@0 | 11 | * \file |
michael@0 | 12 | * \brief C API: Time zone transition classes |
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 | #ifndef UCNV_H |
michael@0 | 20 | |
michael@0 | 21 | /** |
michael@0 | 22 | * A TimeZoneTransition. Use the ztrans_* API to manipulate. Create with |
michael@0 | 23 | * ztrans_open*, and destroy with ztrans_close. |
michael@0 | 24 | */ |
michael@0 | 25 | struct ZTrans; |
michael@0 | 26 | typedef struct ZTrans ZTrans; |
michael@0 | 27 | |
michael@0 | 28 | #endif |
michael@0 | 29 | |
michael@0 | 30 | /** |
michael@0 | 31 | * Constructs a time zone transition with the time and the rules before/after |
michael@0 | 32 | * the transition. |
michael@0 | 33 | * |
michael@0 | 34 | * @param time The time of transition in milliseconds since the base time. |
michael@0 | 35 | * @param from The time zone rule used before the transition. |
michael@0 | 36 | * @param to The time zone rule used after the transition. |
michael@0 | 37 | */ |
michael@0 | 38 | U_CAPI ZTrans* U_EXPORT2 |
michael@0 | 39 | ztrans_open(UDate time, const void* from, const void* to); |
michael@0 | 40 | |
michael@0 | 41 | /** |
michael@0 | 42 | * Constructs an empty <code>TimeZoneTransition</code> |
michael@0 | 43 | */ |
michael@0 | 44 | U_CAPI ZTrans* U_EXPORT2 |
michael@0 | 45 | ztrans_openEmpty(); |
michael@0 | 46 | |
michael@0 | 47 | /** |
michael@0 | 48 | * Disposes of the storage used by a ZTrans object. This function should |
michael@0 | 49 | * be called exactly once for objects returned by ztrans_open*. |
michael@0 | 50 | * @param trans the object to dispose of |
michael@0 | 51 | */ |
michael@0 | 52 | U_CAPI void U_EXPORT2 |
michael@0 | 53 | ztrans_close(ZTrans *trans); |
michael@0 | 54 | |
michael@0 | 55 | /** |
michael@0 | 56 | * Returns a copy of this object. |
michael@0 | 57 | * @param rule the original ZRule |
michael@0 | 58 | * @return the newly allocated copy of the ZRule |
michael@0 | 59 | */ |
michael@0 | 60 | U_CAPI ZTrans* U_EXPORT2 |
michael@0 | 61 | ztrans_clone(ZTrans *trans); |
michael@0 | 62 | |
michael@0 | 63 | /** |
michael@0 | 64 | * Returns true if trans1 is identical to trans2 |
michael@0 | 65 | * and vis versa. |
michael@0 | 66 | * @param trans1 to be checked for containment |
michael@0 | 67 | * @param trans2 to be checked for containment |
michael@0 | 68 | * @return true if the test condition is met |
michael@0 | 69 | */ |
michael@0 | 70 | U_CAPI UBool U_EXPORT2 |
michael@0 | 71 | ztrans_equals(const ZTrans* trans1, const ZTrans* trans2); |
michael@0 | 72 | |
michael@0 | 73 | /** |
michael@0 | 74 | * Returns the time of transition in milliseconds. |
michael@0 | 75 | * param trans, the transition to use |
michael@0 | 76 | * @return The time of the transition in milliseconds since the 1970 Jan 1 epoch time. |
michael@0 | 77 | */ |
michael@0 | 78 | U_CAPI UDate U_EXPORT2 |
michael@0 | 79 | ztrans_getTime(ZTrans* trans); |
michael@0 | 80 | |
michael@0 | 81 | /** |
michael@0 | 82 | * Sets the time of transition in milliseconds. |
michael@0 | 83 | * param trans, the transition to use |
michael@0 | 84 | * @param time The time of the transition in milliseconds since the 1970 Jan 1 epoch time. |
michael@0 | 85 | */ |
michael@0 | 86 | U_CAPI void U_EXPORT2 |
michael@0 | 87 | ztrans_setTime(ZTrans* trans, UDate time); |
michael@0 | 88 | |
michael@0 | 89 | /** |
michael@0 | 90 | * Returns the rule used before the transition. |
michael@0 | 91 | * param trans, the transition to use |
michael@0 | 92 | * @return The time zone rule used after the transition. |
michael@0 | 93 | */ |
michael@0 | 94 | U_CAPI void* U_EXPORT2 |
michael@0 | 95 | ztrans_getFrom(ZTrans* & trans); |
michael@0 | 96 | |
michael@0 | 97 | /** |
michael@0 | 98 | * Sets the rule used before the transition. The caller remains |
michael@0 | 99 | * responsible for deleting the TimeZoneRule object. |
michael@0 | 100 | * param trans, the transition to use |
michael@0 | 101 | * param trans, the transition to use |
michael@0 | 102 | * @param from The time zone rule used before the transition. |
michael@0 | 103 | */ |
michael@0 | 104 | U_CAPI void U_EXPORT2 |
michael@0 | 105 | ztrans_setFrom(ZTrans* trans, const void* from); |
michael@0 | 106 | |
michael@0 | 107 | /** |
michael@0 | 108 | * Adopts the rule used before the transition. The caller must |
michael@0 | 109 | * not delete the TimeZoneRule object passed in. |
michael@0 | 110 | * param trans, the transition to use |
michael@0 | 111 | * @param from The time zone rule used before the transition. |
michael@0 | 112 | */ |
michael@0 | 113 | U_CAPI void U_EXPORT2 |
michael@0 | 114 | ztrans_adoptFrom(ZTrans* trans, void* from); |
michael@0 | 115 | |
michael@0 | 116 | /** |
michael@0 | 117 | * Returns the rule used after the transition. |
michael@0 | 118 | * param trans, the transition to use |
michael@0 | 119 | * @return The time zone rule used after the transition. |
michael@0 | 120 | */ |
michael@0 | 121 | U_CAPI void* U_EXPORT2 |
michael@0 | 122 | ztrans_getTo(ZTrans* trans); |
michael@0 | 123 | |
michael@0 | 124 | /** |
michael@0 | 125 | * Sets the rule used after the transition. The caller remains |
michael@0 | 126 | * responsible for deleting the TimeZoneRule object. |
michael@0 | 127 | * param trans, the transition to use |
michael@0 | 128 | * @param to The time zone rule used after the transition. |
michael@0 | 129 | */ |
michael@0 | 130 | U_CAPI void U_EXPORT2 |
michael@0 | 131 | ztrans_setTo(ZTrans* trans, const void* to); |
michael@0 | 132 | |
michael@0 | 133 | /** |
michael@0 | 134 | * Adopts the rule used after the transition. The caller must |
michael@0 | 135 | * not delete the TimeZoneRule object passed in. |
michael@0 | 136 | * param trans, the transition to use |
michael@0 | 137 | * @param to The time zone rule used after the transition. |
michael@0 | 138 | */ |
michael@0 | 139 | U_CAPI void U_EXPORT2 |
michael@0 | 140 | ztrans_adoptTo(ZTrans* trans, void* to); |
michael@0 | 141 | |
michael@0 | 142 | /** |
michael@0 | 143 | * Return the class ID for this class. This is useful only for comparing to |
michael@0 | 144 | * a return value from getDynamicClassID(). For example: |
michael@0 | 145 | * <pre> |
michael@0 | 146 | * . Base* polymorphic_pointer = createPolymorphicObject(); |
michael@0 | 147 | * . if (polymorphic_pointer->getDynamicClassID() == |
michael@0 | 148 | * . erived::getStaticClassID()) ... |
michael@0 | 149 | * </pre> |
michael@0 | 150 | * param trans, the transition to use |
michael@0 | 151 | * @return The class ID for all objects of this class. |
michael@0 | 152 | */ |
michael@0 | 153 | U_CAPI UClassID U_EXPORT2 |
michael@0 | 154 | ztrans_getStaticClassID(ZTrans* trans); |
michael@0 | 155 | |
michael@0 | 156 | /** |
michael@0 | 157 | * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This |
michael@0 | 158 | * method is to implement a simple version of RTTI, since not all C++ |
michael@0 | 159 | * compilers support genuine RTTI. Polymorphic operator==() and clone() |
michael@0 | 160 | * methods call this method. |
michael@0 | 161 | * |
michael@0 | 162 | * param trans, the transition to use |
michael@0 | 163 | * @return The class ID for this object. All objects of a |
michael@0 | 164 | * given class have the same class ID. Objects of |
michael@0 | 165 | * other classes have different class IDs. |
michael@0 | 166 | */ |
michael@0 | 167 | U_CAPI UClassID U_EXPORT2 |
michael@0 | 168 | ztrans_getDynamicClassID(ZTrans* trans); |
michael@0 | 169 | |
michael@0 | 170 | #endif |
michael@0 | 171 | |
michael@0 | 172 | #endif |