Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/common/unicode/dtintrv.h
38827 views
/*1*******************************************************************************2* Copyright (C) 2008-2009, International Business Machines Corporation and3* others. All Rights Reserved.4*******************************************************************************5*6* File DTINTRV.H7*8*******************************************************************************9*/1011#ifndef __DTINTRV_H__12#define __DTINTRV_H__1314#include "unicode/utypes.h"15#include "unicode/uobject.h"1617/**18* \file19* \brief C++ API: Date Interval data type20*/212223U_NAMESPACE_BEGIN242526/**27* This class represents a date interval.28* It is a pair of UDate representing from UDate 1 to UDate 2.29* @stable ICU 4.030**/31class U_COMMON_API DateInterval : public UObject {32public:3334/**35* Construct a DateInterval given a from date and a to date.36* @param fromDate The from date in date interval.37* @param toDate The to date in date interval.38* @stable ICU 4.039*/40DateInterval(UDate fromDate, UDate toDate);4142/**43* destructor44* @stable ICU 4.045*/46virtual ~DateInterval();4748/**49* Get the from date.50* @return the from date in dateInterval.51* @stable ICU 4.052*/53UDate getFromDate() const;5455/**56* Get the to date.57* @return the to date in dateInterval.58* @stable ICU 4.059*/60UDate getToDate() const;616263/**64* Return the class ID for this class. This is useful only for comparing to65* a return value from getDynamicClassID(). For example:66* <pre>67* . Base* polymorphic_pointer = createPolymorphicObject();68* . if (polymorphic_pointer->getDynamicClassID() ==69* . erived::getStaticClassID()) ...70* </pre>71* @return The class ID for all objects of this class.72* @stable ICU 4.073*/74static UClassID U_EXPORT2 getStaticClassID(void);7576/**77* Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This78* method is to implement a simple version of RTTI, since not all C++79* compilers support genuine RTTI. Polymorphic operator==() and clone()80* methods call this method.81*82* @return The class ID for this object. All objects of a83* given class have the same class ID. Objects of84* other classes have different class IDs.85* @stable ICU 4.086*/87virtual UClassID getDynamicClassID(void) const;888990/**91* Copy constructor.92* @stable ICU 4.093*/94DateInterval(const DateInterval& other);9596/**97* Default assignment operator98* @stable ICU 4.099*/100DateInterval& operator=(const DateInterval&);101102/**103* Equality operator.104* @return TRUE if the two DateIntervals are the same105* @stable ICU 4.0106*/107virtual UBool operator==(const DateInterval& other) const;108109/**110* Non-equality operator111* @return TRUE if the two DateIntervals are not the same112* @stable ICU 4.0113*/114UBool operator!=(const DateInterval& other) const;115116117/**118* clone this object.119* The caller owns the result and should delete it when done.120* @return a cloned DateInterval121* @stable ICU 4.0122*/123virtual DateInterval* clone() const;124125private:126/**127* Default constructor, not implemented.128*/129DateInterval();130131UDate fromDate;132UDate toDate;133134} ;// end class DateInterval135136137inline UDate138DateInterval::getFromDate() const {139return fromDate;140}141142143inline UDate144DateInterval::getToDate() const {145return toDate;146}147148149inline UBool150DateInterval::operator!=(const DateInterval& other) const {151return ( !operator==(other) );152}153154155U_NAMESPACE_END156157#endif158159160