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