Path: blob/jdk8u272-b10-aarch32-20201026/jdk/src/share/native/common/unicode/dtintrv.h
48773 views
// © 2016 and later: Unicode, Inc. and others.1// License & terms of use: http://www.unicode.org/copyright.html2/*3*******************************************************************************4* Copyright (C) 2008-2009, International Business Machines Corporation and5* others. All Rights Reserved.6*******************************************************************************7*8* File DTINTRV.H9*10*******************************************************************************11*/1213#ifndef __DTINTRV_H__14#define __DTINTRV_H__1516#include "unicode/utypes.h"17#include "unicode/uobject.h"1819/**20* \file21* \brief C++ API: Date Interval data type22*/232425U_NAMESPACE_BEGIN262728/**29* This class represents a date interval.30* It is a pair of UDate representing from UDate 1 to UDate 2.31* @stable ICU 4.032**/33class U_COMMON_API DateInterval : public UObject {34public:3536/**37* Construct a DateInterval given a from date and a to date.38* @param fromDate The from date in date interval.39* @param toDate The to date in date interval.40* @stable ICU 4.041*/42DateInterval(UDate fromDate, UDate toDate);4344/**45* destructor46* @stable ICU 4.047*/48virtual ~DateInterval();4950/**51* Get the from date.52* @return the from date in dateInterval.53* @stable ICU 4.054*/55inline UDate getFromDate() const;5657/**58* Get the to date.59* @return the to date in dateInterval.60* @stable ICU 4.061*/62inline UDate getToDate() const;636465/**66* Return the class ID for this class. This is useful only for comparing to67* a return value from getDynamicClassID(). For example:68* <pre>69* . Base* polymorphic_pointer = createPolymorphicObject();70* . if (polymorphic_pointer->getDynamicClassID() ==71* . derived::getStaticClassID()) ...72* </pre>73* @return The class ID for all objects of this class.74* @stable ICU 4.075*/76static UClassID U_EXPORT2 getStaticClassID(void);7778/**79* Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This80* method is to implement a simple version of RTTI, since not all C++81* compilers support genuine RTTI. Polymorphic operator==() and clone()82* methods call this method.83*84* @return The class ID for this object. All objects of a85* given class have the same class ID. Objects of86* other classes have different class IDs.87* @stable ICU 4.088*/89virtual UClassID getDynamicClassID(void) const;909192/**93* Copy constructor.94* @stable ICU 4.095*/96DateInterval(const DateInterval& other);9798/**99* Default assignment operator100* @stable ICU 4.0101*/102DateInterval& operator=(const DateInterval&);103104/**105* Equality operator.106* @return TRUE if the two DateIntervals are the same107* @stable ICU 4.0108*/109virtual UBool operator==(const DateInterval& other) const;110111/**112* Non-equality operator113* @return TRUE if the two DateIntervals are not the same114* @stable ICU 4.0115*/116inline UBool operator!=(const DateInterval& other) const;117118119/**120* clone this object.121* The caller owns the result and should delete it when done.122* @return a cloned DateInterval123* @stable ICU 4.0124*/125virtual DateInterval* clone() const;126127private:128/**129* Default constructor, not implemented.130*/131DateInterval();132133UDate fromDate;134UDate toDate;135136} ;// end class DateInterval137138139inline UDate140DateInterval::getFromDate() const {141return fromDate;142}143144145inline UDate146DateInterval::getToDate() const {147return toDate;148}149150151inline UBool152DateInterval::operator!=(const DateInterval& other) const {153return ( !operator==(other) );154}155156157U_NAMESPACE_END158159#endif160161162