michael@0: /* michael@0: ******************************************************************************* michael@0: * Copyright (C) 2008-2009, International Business Machines Corporation and michael@0: * others. All Rights Reserved. michael@0: ******************************************************************************* michael@0: * michael@0: * File DTINTRV.H michael@0: * michael@0: ******************************************************************************* michael@0: */ michael@0: michael@0: #ifndef __DTINTRV_H__ michael@0: #define __DTINTRV_H__ michael@0: michael@0: #include "unicode/utypes.h" michael@0: #include "unicode/uobject.h" michael@0: michael@0: /** michael@0: * \file michael@0: * \brief C++ API: Date Interval data type michael@0: */ michael@0: michael@0: michael@0: U_NAMESPACE_BEGIN michael@0: michael@0: michael@0: /** michael@0: * This class represents a date interval. michael@0: * It is a pair of UDate representing from UDate 1 to UDate 2. michael@0: * @stable ICU 4.0 michael@0: **/ michael@0: class U_COMMON_API DateInterval : public UObject { michael@0: public: michael@0: michael@0: /** michael@0: * Construct a DateInterval given a from date and a to date. michael@0: * @param fromDate The from date in date interval. michael@0: * @param toDate The to date in date interval. michael@0: * @stable ICU 4.0 michael@0: */ michael@0: DateInterval(UDate fromDate, UDate toDate); michael@0: michael@0: /** michael@0: * destructor michael@0: * @stable ICU 4.0 michael@0: */ michael@0: virtual ~DateInterval(); michael@0: michael@0: /** michael@0: * Get the from date. michael@0: * @return the from date in dateInterval. michael@0: * @stable ICU 4.0 michael@0: */ michael@0: UDate getFromDate() const; michael@0: michael@0: /** michael@0: * Get the to date. michael@0: * @return the to date in dateInterval. michael@0: * @stable ICU 4.0 michael@0: */ michael@0: UDate getToDate() const; michael@0: michael@0: michael@0: /** michael@0: * Return the class ID for this class. This is useful only for comparing to michael@0: * a return value from getDynamicClassID(). For example: michael@0: *
michael@0:      * .   Base* polymorphic_pointer = createPolymorphicObject();
michael@0:      * .   if (polymorphic_pointer->getDynamicClassID() ==
michael@0:      * .       erived::getStaticClassID()) ...
michael@0:      * 
michael@0: * @return The class ID for all objects of this class. michael@0: * @stable ICU 4.0 michael@0: */ michael@0: static UClassID U_EXPORT2 getStaticClassID(void); michael@0: michael@0: /** michael@0: * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This michael@0: * method is to implement a simple version of RTTI, since not all C++ michael@0: * compilers support genuine RTTI. Polymorphic operator==() and clone() michael@0: * methods call this method. michael@0: * michael@0: * @return The class ID for this object. All objects of a michael@0: * given class have the same class ID. Objects of michael@0: * other classes have different class IDs. michael@0: * @stable ICU 4.0 michael@0: */ michael@0: virtual UClassID getDynamicClassID(void) const; michael@0: michael@0: michael@0: /** michael@0: * Copy constructor. michael@0: * @stable ICU 4.0 michael@0: */ michael@0: DateInterval(const DateInterval& other); michael@0: michael@0: /** michael@0: * Default assignment operator michael@0: * @stable ICU 4.0 michael@0: */ michael@0: DateInterval& operator=(const DateInterval&); michael@0: michael@0: /** michael@0: * Equality operator. michael@0: * @return TRUE if the two DateIntervals are the same michael@0: * @stable ICU 4.0 michael@0: */ michael@0: virtual UBool operator==(const DateInterval& other) const; michael@0: michael@0: /** michael@0: * Non-equality operator michael@0: * @return TRUE if the two DateIntervals are not the same michael@0: * @stable ICU 4.0 michael@0: */ michael@0: UBool operator!=(const DateInterval& other) const; michael@0: michael@0: michael@0: /** michael@0: * clone this object. michael@0: * The caller owns the result and should delete it when done. michael@0: * @return a cloned DateInterval michael@0: * @stable ICU 4.0 michael@0: */ michael@0: virtual DateInterval* clone() const; michael@0: michael@0: private: michael@0: /** michael@0: * Default constructor, not implemented. michael@0: */ michael@0: DateInterval(); michael@0: michael@0: UDate fromDate; michael@0: UDate toDate; michael@0: michael@0: } ;// end class DateInterval michael@0: michael@0: michael@0: inline UDate michael@0: DateInterval::getFromDate() const { michael@0: return fromDate; michael@0: } michael@0: michael@0: michael@0: inline UDate michael@0: DateInterval::getToDate() const { michael@0: return toDate; michael@0: } michael@0: michael@0: michael@0: inline UBool michael@0: DateInterval::operator!=(const DateInterval& other) const { michael@0: return ( !operator==(other) ); michael@0: } michael@0: michael@0: michael@0: U_NAMESPACE_END michael@0: michael@0: #endif