Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* |
michael@0 | 2 | ******************************************************************************* |
michael@0 | 3 | * Copyright (C) 2008-2009, International Business Machines Corporation and |
michael@0 | 4 | * others. All Rights Reserved. |
michael@0 | 5 | ******************************************************************************* |
michael@0 | 6 | * |
michael@0 | 7 | * File DTINTRV.H |
michael@0 | 8 | * |
michael@0 | 9 | ******************************************************************************* |
michael@0 | 10 | */ |
michael@0 | 11 | |
michael@0 | 12 | #ifndef __DTINTRV_H__ |
michael@0 | 13 | #define __DTINTRV_H__ |
michael@0 | 14 | |
michael@0 | 15 | #include "unicode/utypes.h" |
michael@0 | 16 | #include "unicode/uobject.h" |
michael@0 | 17 | |
michael@0 | 18 | /** |
michael@0 | 19 | * \file |
michael@0 | 20 | * \brief C++ API: Date Interval data type |
michael@0 | 21 | */ |
michael@0 | 22 | |
michael@0 | 23 | |
michael@0 | 24 | U_NAMESPACE_BEGIN |
michael@0 | 25 | |
michael@0 | 26 | |
michael@0 | 27 | /** |
michael@0 | 28 | * This class represents a date interval. |
michael@0 | 29 | * It is a pair of UDate representing from UDate 1 to UDate 2. |
michael@0 | 30 | * @stable ICU 4.0 |
michael@0 | 31 | **/ |
michael@0 | 32 | class U_COMMON_API DateInterval : public UObject { |
michael@0 | 33 | public: |
michael@0 | 34 | |
michael@0 | 35 | /** |
michael@0 | 36 | * Construct a DateInterval given a from date and a to date. |
michael@0 | 37 | * @param fromDate The from date in date interval. |
michael@0 | 38 | * @param toDate The to date in date interval. |
michael@0 | 39 | * @stable ICU 4.0 |
michael@0 | 40 | */ |
michael@0 | 41 | DateInterval(UDate fromDate, UDate toDate); |
michael@0 | 42 | |
michael@0 | 43 | /** |
michael@0 | 44 | * destructor |
michael@0 | 45 | * @stable ICU 4.0 |
michael@0 | 46 | */ |
michael@0 | 47 | virtual ~DateInterval(); |
michael@0 | 48 | |
michael@0 | 49 | /** |
michael@0 | 50 | * Get the from date. |
michael@0 | 51 | * @return the from date in dateInterval. |
michael@0 | 52 | * @stable ICU 4.0 |
michael@0 | 53 | */ |
michael@0 | 54 | UDate getFromDate() const; |
michael@0 | 55 | |
michael@0 | 56 | /** |
michael@0 | 57 | * Get the to date. |
michael@0 | 58 | * @return the to date in dateInterval. |
michael@0 | 59 | * @stable ICU 4.0 |
michael@0 | 60 | */ |
michael@0 | 61 | UDate getToDate() const; |
michael@0 | 62 | |
michael@0 | 63 | |
michael@0 | 64 | /** |
michael@0 | 65 | * Return the class ID for this class. This is useful only for comparing to |
michael@0 | 66 | * a return value from getDynamicClassID(). For example: |
michael@0 | 67 | * <pre> |
michael@0 | 68 | * . Base* polymorphic_pointer = createPolymorphicObject(); |
michael@0 | 69 | * . if (polymorphic_pointer->getDynamicClassID() == |
michael@0 | 70 | * . erived::getStaticClassID()) ... |
michael@0 | 71 | * </pre> |
michael@0 | 72 | * @return The class ID for all objects of this class. |
michael@0 | 73 | * @stable ICU 4.0 |
michael@0 | 74 | */ |
michael@0 | 75 | static UClassID U_EXPORT2 getStaticClassID(void); |
michael@0 | 76 | |
michael@0 | 77 | /** |
michael@0 | 78 | * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This |
michael@0 | 79 | * method is to implement a simple version of RTTI, since not all C++ |
michael@0 | 80 | * compilers support genuine RTTI. Polymorphic operator==() and clone() |
michael@0 | 81 | * methods call this method. |
michael@0 | 82 | * |
michael@0 | 83 | * @return The class ID for this object. All objects of a |
michael@0 | 84 | * given class have the same class ID. Objects of |
michael@0 | 85 | * other classes have different class IDs. |
michael@0 | 86 | * @stable ICU 4.0 |
michael@0 | 87 | */ |
michael@0 | 88 | virtual UClassID getDynamicClassID(void) const; |
michael@0 | 89 | |
michael@0 | 90 | |
michael@0 | 91 | /** |
michael@0 | 92 | * Copy constructor. |
michael@0 | 93 | * @stable ICU 4.0 |
michael@0 | 94 | */ |
michael@0 | 95 | DateInterval(const DateInterval& other); |
michael@0 | 96 | |
michael@0 | 97 | /** |
michael@0 | 98 | * Default assignment operator |
michael@0 | 99 | * @stable ICU 4.0 |
michael@0 | 100 | */ |
michael@0 | 101 | DateInterval& operator=(const DateInterval&); |
michael@0 | 102 | |
michael@0 | 103 | /** |
michael@0 | 104 | * Equality operator. |
michael@0 | 105 | * @return TRUE if the two DateIntervals are the same |
michael@0 | 106 | * @stable ICU 4.0 |
michael@0 | 107 | */ |
michael@0 | 108 | virtual UBool operator==(const DateInterval& other) const; |
michael@0 | 109 | |
michael@0 | 110 | /** |
michael@0 | 111 | * Non-equality operator |
michael@0 | 112 | * @return TRUE if the two DateIntervals are not the same |
michael@0 | 113 | * @stable ICU 4.0 |
michael@0 | 114 | */ |
michael@0 | 115 | UBool operator!=(const DateInterval& other) const; |
michael@0 | 116 | |
michael@0 | 117 | |
michael@0 | 118 | /** |
michael@0 | 119 | * clone this object. |
michael@0 | 120 | * The caller owns the result and should delete it when done. |
michael@0 | 121 | * @return a cloned DateInterval |
michael@0 | 122 | * @stable ICU 4.0 |
michael@0 | 123 | */ |
michael@0 | 124 | virtual DateInterval* clone() const; |
michael@0 | 125 | |
michael@0 | 126 | private: |
michael@0 | 127 | /** |
michael@0 | 128 | * Default constructor, not implemented. |
michael@0 | 129 | */ |
michael@0 | 130 | DateInterval(); |
michael@0 | 131 | |
michael@0 | 132 | UDate fromDate; |
michael@0 | 133 | UDate toDate; |
michael@0 | 134 | |
michael@0 | 135 | } ;// end class DateInterval |
michael@0 | 136 | |
michael@0 | 137 | |
michael@0 | 138 | inline UDate |
michael@0 | 139 | DateInterval::getFromDate() const { |
michael@0 | 140 | return fromDate; |
michael@0 | 141 | } |
michael@0 | 142 | |
michael@0 | 143 | |
michael@0 | 144 | inline UDate |
michael@0 | 145 | DateInterval::getToDate() const { |
michael@0 | 146 | return toDate; |
michael@0 | 147 | } |
michael@0 | 148 | |
michael@0 | 149 | |
michael@0 | 150 | inline UBool |
michael@0 | 151 | DateInterval::operator!=(const DateInterval& other) const { |
michael@0 | 152 | return ( !operator==(other) ); |
michael@0 | 153 | } |
michael@0 | 154 | |
michael@0 | 155 | |
michael@0 | 156 | U_NAMESPACE_END |
michael@0 | 157 | |
michael@0 | 158 | #endif |