Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/unicode/tztrans.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // © 2016 and later: Unicode, Inc. and others.
0002 // License & terms of use: http://www.unicode.org/copyright.html
0003 /*
0004 *******************************************************************************
0005 * Copyright (C) 2007-2008, International Business Machines Corporation and         *
0006 * others. All Rights Reserved.                                                *
0007 *******************************************************************************
0008 */
0009 #ifndef TZTRANS_H
0010 #define TZTRANS_H
0011 
0012 /**
0013  * \file 
0014  * \brief C++ API: Time zone transition
0015  */
0016 
0017 #include "unicode/utypes.h"
0018 
0019 #if U_SHOW_CPLUSPLUS_API
0020 
0021 #if !UCONFIG_NO_FORMATTING
0022 
0023 #include "unicode/uobject.h"
0024 
0025 U_NAMESPACE_BEGIN
0026 
0027 // Forward declaration
0028 class TimeZoneRule;
0029 
0030 /**
0031  * <code>TimeZoneTransition</code> is a class representing a time zone transition.
0032  * An instance has a time of transition and rules for both before and after the transition.
0033  * @stable ICU 3.8
0034  */
0035 class U_I18N_API TimeZoneTransition : public UObject {
0036 public:
0037     /**
0038      * Constructs a <code>TimeZoneTransition</code> with the time and the rules before/after
0039      * the transition.
0040      * 
0041      * @param time  The time of transition in milliseconds since the base time.
0042      * @param from  The time zone rule used before the transition.
0043      * @param to    The time zone rule used after the transition.
0044      * @stable ICU 3.8
0045      */
0046     TimeZoneTransition(UDate time, const TimeZoneRule& from, const TimeZoneRule& to);
0047 
0048     /**
0049      * Constructs an empty <code>TimeZoneTransition</code>
0050      * @stable ICU 3.8
0051      */
0052     TimeZoneTransition();
0053 
0054     /**
0055      * Copy constructor.
0056      * @param source    The TimeZoneTransition object to be copied.
0057      * @stable ICU 3.8
0058      */
0059     TimeZoneTransition(const TimeZoneTransition& source);
0060 
0061     /**
0062      * Destructor.
0063      * @stable ICU 3.8
0064      */
0065     ~TimeZoneTransition();
0066 
0067     /**
0068      * Clone this TimeZoneTransition object polymorphically. The caller owns the result and
0069      * should delete it when done.
0070      * @return  A copy of the object.
0071      * @stable ICU 3.8
0072      */
0073     TimeZoneTransition* clone() const;
0074 
0075     /**
0076      * Assignment operator.
0077      * @param right The object to be copied.
0078      * @stable ICU 3.8
0079      */
0080     TimeZoneTransition& operator=(const TimeZoneTransition& right);
0081 
0082     /**
0083      * Return true if the given TimeZoneTransition objects are semantically equal. Objects
0084      * of different subclasses are considered unequal.
0085      * @param that  The object to be compared with.
0086      * @return  true if the given TimeZoneTransition objects are semantically equal.
0087      * @stable ICU 3.8
0088      */
0089     bool operator==(const TimeZoneTransition& that) const;
0090 
0091     /**
0092      * Return true if the given TimeZoneTransition objects are semantically unequal. Objects
0093      * of different subclasses are considered unequal.
0094      * @param that  The object to be compared with.
0095      * @return  true if the given TimeZoneTransition objects are semantically unequal.
0096      * @stable ICU 3.8
0097      */
0098     bool operator!=(const TimeZoneTransition& that) const;
0099 
0100     /**
0101      * Returns the time of transition in milliseconds.
0102      * @return The time of the transition in milliseconds since the 1970 Jan 1 epoch time.
0103      * @stable ICU 3.8
0104      */
0105     UDate getTime(void) const;
0106 
0107     /**
0108      * Sets the time of transition in milliseconds.
0109      * @param time The time of the transition in milliseconds since the 1970 Jan 1 epoch time.
0110      * @stable ICU 3.8
0111      */
0112     void setTime(UDate time);
0113 
0114     /**
0115      * Returns the rule used before the transition.
0116      * @return The time zone rule used after the transition.
0117      * @stable ICU 3.8
0118      */
0119     const TimeZoneRule* getFrom(void) const;
0120 
0121     /**
0122      * Sets the rule used before the transition.  The caller remains
0123      * responsible for deleting the <code>TimeZoneRule</code> object.
0124      * @param from The time zone rule used before the transition.
0125      * @stable ICU 3.8
0126      */
0127     void setFrom(const TimeZoneRule& from);
0128 
0129     /**
0130      * Adopts the rule used before the transition.  The caller must
0131      * not delete the <code>TimeZoneRule</code> object passed in.
0132      * @param from The time zone rule used before the transition.
0133      * @stable ICU 3.8
0134      */
0135     void adoptFrom(TimeZoneRule* from);
0136 
0137     /**
0138      * Sets the rule used after the transition.  The caller remains
0139      * responsible for deleting the <code>TimeZoneRule</code> object.
0140      * @param to The time zone rule used after the transition.
0141      * @stable ICU 3.8
0142      */
0143     void setTo(const TimeZoneRule& to);
0144 
0145     /**
0146      * Adopts the rule used after the transition.  The caller must
0147      * not delete the <code>TimeZoneRule</code> object passed in.
0148      * @param to The time zone rule used after the transition.
0149      * @stable ICU 3.8
0150      */
0151     void adoptTo(TimeZoneRule* to);
0152 
0153     /**
0154      * Returns the rule used after the transition.
0155      * @return The time zone rule used after the transition.
0156      * @stable ICU 3.8
0157      */
0158     const TimeZoneRule* getTo(void) const;
0159 
0160 private:
0161     UDate   fTime;
0162     TimeZoneRule*   fFrom;
0163     TimeZoneRule*   fTo;
0164 
0165 public:
0166     /**
0167      * Return the class ID for this class. This is useful only for comparing to
0168      * a return value from getDynamicClassID(). For example:
0169      * <pre>
0170      * .   Base* polymorphic_pointer = createPolymorphicObject();
0171      * .   if (polymorphic_pointer->getDynamicClassID() ==
0172      * .       erived::getStaticClassID()) ...
0173      * </pre>
0174      * @return          The class ID for all objects of this class.
0175      * @stable ICU 3.8
0176      */
0177     static UClassID U_EXPORT2 getStaticClassID(void);
0178 
0179     /**
0180      * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
0181      * method is to implement a simple version of RTTI, since not all C++
0182      * compilers support genuine RTTI. Polymorphic operator==() and clone()
0183      * methods call this method.
0184      *
0185      * @return          The class ID for this object. All objects of a
0186      *                  given class have the same class ID.  Objects of
0187      *                  other classes have different class IDs.
0188      * @stable ICU 3.8
0189      */
0190     virtual UClassID getDynamicClassID(void) const override;
0191 };
0192 
0193 U_NAMESPACE_END
0194 
0195 #endif /* #if !UCONFIG_NO_FORMATTING */
0196 
0197 #endif /* U_SHOW_CPLUSPLUS_API */
0198 
0199 #endif // TZTRANS_H
0200 
0201 //eof