Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/unicode/dtintrv.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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(void);
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(void) const override;
0093 
0094     
0095     /**
0096      * Copy constructor.
0097      * @stable ICU 4.0
0098      */
0099     DateInterval(const DateInterval& other);
0100 
0101     /**
0102      * Default assignment operator
0103      * @stable ICU 4.0
0104      */
0105     DateInterval& operator=(const DateInterval&);
0106 
0107     /**
0108      * Equality operator.
0109      * @return true if the two DateIntervals are the same
0110      * @stable ICU 4.0
0111      */
0112     virtual bool operator==(const DateInterval& other) const;
0113 
0114     /**
0115      * Non-equality operator
0116      * @return true if the two DateIntervals are not the same
0117      * @stable ICU 4.0
0118      */
0119     inline bool operator!=(const DateInterval& other) const;
0120 
0121 
0122     /**
0123      * clone this object. 
0124      * The caller owns the result and should delete it when done.
0125      * @return a cloned DateInterval
0126      * @stable ICU 4.0
0127      */
0128      virtual DateInterval* clone() const;
0129 
0130 private:
0131     /** 
0132      * Default constructor, not implemented.
0133      */
0134     DateInterval() = delete;
0135 
0136     UDate fromDate;
0137     UDate toDate;
0138 
0139 } ;// end class DateInterval
0140 
0141 
0142 inline UDate 
0143 DateInterval::getFromDate() const { 
0144     return fromDate; 
0145 }
0146 
0147 
0148 inline UDate 
0149 DateInterval::getToDate() const { 
0150     return toDate; 
0151 }
0152 
0153 
0154 inline bool
0155 DateInterval::operator!=(const DateInterval& other) const { 
0156     return ( !operator==(other) );
0157 }
0158 
0159 
0160 U_NAMESPACE_END
0161 
0162 #endif /* U_SHOW_CPLUSPLUS_API */
0163 
0164 #endif