1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/i18n/ztrans.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,172 @@ 1.4 +/* 1.5 +******************************************************************************* 1.6 +* Copyright (C) 2009-2011, International Business Machines Corporation and 1.7 +* others. All Rights Reserved. 1.8 +******************************************************************************* 1.9 +*/ 1.10 +#ifndef __ZTRANS_H 1.11 +#define __ZTRANS_H 1.12 + 1.13 +/** 1.14 + * \file 1.15 + * \brief C API: Time zone transition classes 1.16 + */ 1.17 + 1.18 +#include "unicode/utypes.h" 1.19 + 1.20 +#if !UCONFIG_NO_FORMATTING 1.21 + 1.22 +#ifndef UCNV_H 1.23 + 1.24 +/** 1.25 + * A TimeZoneTransition. Use the ztrans_* API to manipulate. Create with 1.26 + * ztrans_open*, and destroy with ztrans_close. 1.27 + */ 1.28 +struct ZTrans; 1.29 +typedef struct ZTrans ZTrans; 1.30 + 1.31 +#endif 1.32 + 1.33 +/** 1.34 + * Constructs a time zone transition with the time and the rules before/after 1.35 + * the transition. 1.36 + * 1.37 + * @param time The time of transition in milliseconds since the base time. 1.38 + * @param from The time zone rule used before the transition. 1.39 + * @param to The time zone rule used after the transition. 1.40 + */ 1.41 +U_CAPI ZTrans* U_EXPORT2 1.42 +ztrans_open(UDate time, const void* from, const void* to); 1.43 + 1.44 +/** 1.45 + * Constructs an empty <code>TimeZoneTransition</code> 1.46 + */ 1.47 +U_CAPI ZTrans* U_EXPORT2 1.48 +ztrans_openEmpty(); 1.49 + 1.50 +/** 1.51 + * Disposes of the storage used by a ZTrans object. This function should 1.52 + * be called exactly once for objects returned by ztrans_open*. 1.53 + * @param trans the object to dispose of 1.54 + */ 1.55 +U_CAPI void U_EXPORT2 1.56 +ztrans_close(ZTrans *trans); 1.57 + 1.58 +/** 1.59 + * Returns a copy of this object. 1.60 + * @param rule the original ZRule 1.61 + * @return the newly allocated copy of the ZRule 1.62 + */ 1.63 +U_CAPI ZTrans* U_EXPORT2 1.64 +ztrans_clone(ZTrans *trans); 1.65 + 1.66 +/** 1.67 + * Returns true if trans1 is identical to trans2 1.68 + * and vis versa. 1.69 + * @param trans1 to be checked for containment 1.70 + * @param trans2 to be checked for containment 1.71 + * @return true if the test condition is met 1.72 + */ 1.73 +U_CAPI UBool U_EXPORT2 1.74 +ztrans_equals(const ZTrans* trans1, const ZTrans* trans2); 1.75 + 1.76 +/** 1.77 + * Returns the time of transition in milliseconds. 1.78 + * param trans, the transition to use 1.79 + * @return The time of the transition in milliseconds since the 1970 Jan 1 epoch time. 1.80 + */ 1.81 +U_CAPI UDate U_EXPORT2 1.82 +ztrans_getTime(ZTrans* trans); 1.83 + 1.84 +/** 1.85 + * Sets the time of transition in milliseconds. 1.86 + * param trans, the transition to use 1.87 + * @param time The time of the transition in milliseconds since the 1970 Jan 1 epoch time. 1.88 + */ 1.89 +U_CAPI void U_EXPORT2 1.90 +ztrans_setTime(ZTrans* trans, UDate time); 1.91 + 1.92 +/** 1.93 + * Returns the rule used before the transition. 1.94 + * param trans, the transition to use 1.95 + * @return The time zone rule used after the transition. 1.96 + */ 1.97 +U_CAPI void* U_EXPORT2 1.98 +ztrans_getFrom(ZTrans* & trans); 1.99 + 1.100 +/** 1.101 + * Sets the rule used before the transition. The caller remains 1.102 + * responsible for deleting the TimeZoneRule object. 1.103 + * param trans, the transition to use 1.104 + * param trans, the transition to use 1.105 + * @param from The time zone rule used before the transition. 1.106 + */ 1.107 +U_CAPI void U_EXPORT2 1.108 +ztrans_setFrom(ZTrans* trans, const void* from); 1.109 + 1.110 +/** 1.111 + * Adopts the rule used before the transition. The caller must 1.112 + * not delete the TimeZoneRule object passed in. 1.113 + * param trans, the transition to use 1.114 + * @param from The time zone rule used before the transition. 1.115 + */ 1.116 +U_CAPI void U_EXPORT2 1.117 +ztrans_adoptFrom(ZTrans* trans, void* from); 1.118 + 1.119 +/** 1.120 + * Returns the rule used after the transition. 1.121 + * param trans, the transition to use 1.122 + * @return The time zone rule used after the transition. 1.123 + */ 1.124 +U_CAPI void* U_EXPORT2 1.125 +ztrans_getTo(ZTrans* trans); 1.126 + 1.127 +/** 1.128 + * Sets the rule used after the transition. The caller remains 1.129 + * responsible for deleting the TimeZoneRule object. 1.130 + * param trans, the transition to use 1.131 + * @param to The time zone rule used after the transition. 1.132 + */ 1.133 +U_CAPI void U_EXPORT2 1.134 +ztrans_setTo(ZTrans* trans, const void* to); 1.135 + 1.136 +/** 1.137 + * Adopts the rule used after the transition. The caller must 1.138 + * not delete the TimeZoneRule object passed in. 1.139 + * param trans, the transition to use 1.140 + * @param to The time zone rule used after the transition. 1.141 + */ 1.142 +U_CAPI void U_EXPORT2 1.143 +ztrans_adoptTo(ZTrans* trans, void* to); 1.144 + 1.145 +/** 1.146 + * Return the class ID for this class. This is useful only for comparing to 1.147 + * a return value from getDynamicClassID(). For example: 1.148 + * <pre> 1.149 + * . Base* polymorphic_pointer = createPolymorphicObject(); 1.150 + * . if (polymorphic_pointer->getDynamicClassID() == 1.151 + * . erived::getStaticClassID()) ... 1.152 + * </pre> 1.153 + * param trans, the transition to use 1.154 + * @return The class ID for all objects of this class. 1.155 + */ 1.156 +U_CAPI UClassID U_EXPORT2 1.157 +ztrans_getStaticClassID(ZTrans* trans); 1.158 + 1.159 +/** 1.160 + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This 1.161 + * method is to implement a simple version of RTTI, since not all C++ 1.162 + * compilers support genuine RTTI. Polymorphic operator==() and clone() 1.163 + * methods call this method. 1.164 + * 1.165 + * param trans, the transition to use 1.166 + * @return The class ID for this object. All objects of a 1.167 + * given class have the same class ID. Objects of 1.168 + * other classes have different class IDs. 1.169 + */ 1.170 +U_CAPI UClassID U_EXPORT2 1.171 +ztrans_getDynamicClassID(ZTrans* trans); 1.172 + 1.173 +#endif 1.174 + 1.175 +#endif