Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 09:26:58

0001 // © 2016 and later: Unicode, Inc. and others.
0002 // License & terms of use: http://www.unicode.org/copyright.html
0003 /*
0004 *******************************************************************************
0005 * Copyright (C) 2008-2009, International Business Machines Corporation and
0006 * others. All Rights Reserved.
0007 *******************************************************************************
0008 *
0009 * File DTINTRV.H 
0010 *
0011 *******************************************************************************
0012 */
0013 
0014 #ifndef __DTINTRV_H__
0015 #define __DTINTRV_H__
0016 
0017 #include "unicode/utypes.h"
0018 
0019 #if U_SHOW_CPLUSPLUS_API
0020 
0021 #include "unicode/uobject.h"
0022 
0023 /**
0024  * \file
0025  * \brief C++ API: Date Interval data type
0026  */
0027 
0028 U_NAMESPACE_BEGIN
0029 
0030 
0031 /**
0032  * This class represents a date interval.
0033  * It is a pair of UDate representing from UDate 1 to UDate 2.
0034  * @stable ICU 4.0
0035 **/
0036 class U_COMMON_API DateInterval : public UObject {
0037 public:
0038 
0039     /** 
0040      * Construct a DateInterval given a from date and a to date.
0041      * @param fromDate  The from date in date interval.
0042      * @param toDate    The to date in date interval.
0043      * @stable ICU 4.0
0044      */
0045     DateInterval(UDate fromDate, UDate toDate);
0046 
0047     /**
0048      * destructor
0049      * @stable ICU 4.0
0050      */
0051     virtual ~DateInterval();
0052  
0053     /** 
0054      * Get the from date.
0055      * @return  the from date in dateInterval.
0056      * @stable ICU 4.0
0057      */
0058     inline UDate getFromDate() const;
0059 
0060     /** 
0061      * Get the to date.
0062      * @return  the to date in dateInterval.
0063      * @stable ICU 4.0
0064      */
0065     inline UDate getToDate() const;
0066 
0067 
0068     /**
0069      * Return the class ID for this class. This is useful only for comparing to
0070      * a return value from getDynamicClassID(). For example:
0071      * <pre>
0072      * .   Base* polymorphic_pointer = createPolymorphicObject();
0073      * .   if (polymorphic_pointer->getDynamicClassID() ==
0074      * .       derived::getStaticClassID()) ...
0075      * </pre>
0076      * @return          The class ID for all objects of this class.
0077      * @stable ICU 4.0
0078      */
0079     static UClassID U_EXPORT2 getStaticClassID();
0080 
0081     /**
0082      * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
0083      * method is to implement a simple version of RTTI, since not all C++
0084      * compilers support genuine RTTI. Polymorphic operator==() and clone()
0085      * methods call this method.
0086      *
0087      * @return          The class ID for this object. All objects of a
0088      *                  given class have the same class ID.  Objects of
0089      *                  other classes have different class IDs.
0090      * @stable ICU 4.0
0091      */
0092     virtual UClassID getDynamicClassID() const override;
0093 
0094     /**
0095      * Copy constructor.
0096      * @stable ICU 4.0
0097      */
0098     DateInterval(const DateInterval& other);
0099 
0100     /**
0101      * Default assignment operator
0102      * @stable ICU 4.0
0103      */
0104     DateInterval& operator=(const DateInterval&);
0105 
0106     /**
0107      * Equality operator.
0108      * @return true if the two DateIntervals are the same
0109      * @stable ICU 4.0
0110      */
0111     virtual bool operator==(const DateInterval& other) const;
0112 
0113     /**
0114      * Non-equality operator
0115      * @return true if the two DateIntervals are not the same
0116      * @stable ICU 4.0
0117      */
0118     inline bool operator!=(const DateInterval& other) const;
0119 
0120 
0121     /**
0122      * clone this object. 
0123      * The caller owns the result and should delete it when done.
0124      * @return a cloned DateInterval
0125      * @stable ICU 4.0
0126      */
0127      virtual DateInterval* clone() const;
0128 
0129 private:
0130     /** 
0131      * Default constructor, not implemented.
0132      */
0133     DateInterval() = delete;
0134 
0135     UDate fromDate;
0136     UDate toDate;
0137 
0138 } ;// end class DateInterval
0139 
0140 
0141 inline UDate 
0142 DateInterval::getFromDate() const { 
0143     return fromDate; 
0144 }
0145 
0146 
0147 inline UDate 
0148 DateInterval::getToDate() const { 
0149     return toDate; 
0150 }
0151 
0152 
0153 inline bool
0154 DateInterval::operator!=(const DateInterval& other) const { 
0155     return ( !operator==(other) );
0156 }
0157 
0158 
0159 U_NAMESPACE_END
0160 
0161 #endif /* U_SHOW_CPLUSPLUS_API */
0162 
0163 #endif