intl/icu/source/common/unicode/dtintrv.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu/source/common/unicode/dtintrv.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,158 @@
     1.4 +/*
     1.5 +*******************************************************************************
     1.6 +* Copyright (C) 2008-2009, International Business Machines Corporation and
     1.7 +* others. All Rights Reserved.
     1.8 +*******************************************************************************
     1.9 +*
    1.10 +* File DTINTRV.H 
    1.11 +*
    1.12 +*******************************************************************************
    1.13 +*/
    1.14 +
    1.15 +#ifndef __DTINTRV_H__
    1.16 +#define __DTINTRV_H__
    1.17 +
    1.18 +#include "unicode/utypes.h"
    1.19 +#include "unicode/uobject.h"
    1.20 +
    1.21 +/**
    1.22 + * \file
    1.23 + * \brief C++ API: Date Interval data type
    1.24 + */
    1.25 +
    1.26 +
    1.27 +U_NAMESPACE_BEGIN
    1.28 +
    1.29 +
    1.30 +/**
    1.31 + * This class represents a date interval.
    1.32 + * It is a pair of UDate representing from UDate 1 to UDate 2.
    1.33 + * @stable ICU 4.0
    1.34 +**/
    1.35 +class U_COMMON_API DateInterval : public UObject {
    1.36 +public:
    1.37 +
    1.38 +    /** 
    1.39 +     * Construct a DateInterval given a from date and a to date.
    1.40 +     * @param fromDate  The from date in date interval.
    1.41 +     * @param toDate    The to date in date interval.
    1.42 +     * @stable ICU 4.0
    1.43 +     */
    1.44 +    DateInterval(UDate fromDate, UDate toDate);
    1.45 +
    1.46 +    /**
    1.47 +     * destructor
    1.48 +     * @stable ICU 4.0
    1.49 +     */
    1.50 +    virtual ~DateInterval();
    1.51 + 
    1.52 +    /** 
    1.53 +     * Get the from date.
    1.54 +     * @return  the from date in dateInterval.
    1.55 +     * @stable ICU 4.0
    1.56 +     */
    1.57 +    UDate getFromDate() const;
    1.58 +
    1.59 +    /** 
    1.60 +     * Get the to date.
    1.61 +     * @return  the to date in dateInterval.
    1.62 +     * @stable ICU 4.0
    1.63 +     */
    1.64 +    UDate getToDate() const;
    1.65 +
    1.66 +
    1.67 +    /**
    1.68 +     * Return the class ID for this class. This is useful only for comparing to
    1.69 +     * a return value from getDynamicClassID(). For example:
    1.70 +     * <pre>
    1.71 +     * .   Base* polymorphic_pointer = createPolymorphicObject();
    1.72 +     * .   if (polymorphic_pointer->getDynamicClassID() ==
    1.73 +     * .       erived::getStaticClassID()) ...
    1.74 +     * </pre>
    1.75 +     * @return          The class ID for all objects of this class.
    1.76 +     * @stable ICU 4.0
    1.77 +     */
    1.78 +    static UClassID U_EXPORT2 getStaticClassID(void);
    1.79 +
    1.80 +    /**
    1.81 +     * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
    1.82 +     * method is to implement a simple version of RTTI, since not all C++
    1.83 +     * compilers support genuine RTTI. Polymorphic operator==() and clone()
    1.84 +     * methods call this method.
    1.85 +     *
    1.86 +     * @return          The class ID for this object. All objects of a
    1.87 +     *                  given class have the same class ID.  Objects of
    1.88 +     *                  other classes have different class IDs.
    1.89 +     * @stable ICU 4.0
    1.90 +     */
    1.91 +    virtual UClassID getDynamicClassID(void) const;
    1.92 +
    1.93 +    
    1.94 +    /**
    1.95 +     * Copy constructor.
    1.96 +     * @stable ICU 4.0
    1.97 +     */
    1.98 +    DateInterval(const DateInterval& other);
    1.99 +
   1.100 +    /**
   1.101 +     * Default assignment operator
   1.102 +     * @stable ICU 4.0
   1.103 +     */
   1.104 +    DateInterval& operator=(const DateInterval&);
   1.105 +
   1.106 +    /**
   1.107 +     * Equality operator.
   1.108 +     * @return TRUE if the two DateIntervals are the same
   1.109 +     * @stable ICU 4.0
   1.110 +     */
   1.111 +    virtual UBool operator==(const DateInterval& other) const;
   1.112 +
   1.113 +    /**
   1.114 +     * Non-equality operator
   1.115 +     * @return TRUE if the two DateIntervals are not the same
   1.116 +     * @stable ICU 4.0
   1.117 +     */
   1.118 +    UBool operator!=(const DateInterval& other) const;
   1.119 +
   1.120 +
   1.121 +    /**
   1.122 +     * clone this object. 
   1.123 +     * The caller owns the result and should delete it when done.
   1.124 +     * @return a cloned DateInterval
   1.125 +     * @stable ICU 4.0
   1.126 +     */
   1.127 +     virtual DateInterval* clone() const;
   1.128 +
   1.129 +private:
   1.130 +    /** 
   1.131 +     * Default constructor, not implemented.
   1.132 +     */
   1.133 +    DateInterval();
   1.134 +
   1.135 +    UDate fromDate;
   1.136 +    UDate toDate;
   1.137 +
   1.138 +} ;// end class DateInterval
   1.139 +
   1.140 +
   1.141 +inline UDate 
   1.142 +DateInterval::getFromDate() const { 
   1.143 +    return fromDate; 
   1.144 +}
   1.145 +
   1.146 +
   1.147 +inline UDate 
   1.148 +DateInterval::getToDate() const { 
   1.149 +    return toDate; 
   1.150 +}
   1.151 +
   1.152 +
   1.153 +inline UBool 
   1.154 +DateInterval::operator!=(const DateInterval& other) const { 
   1.155 +    return ( !operator==(other) );
   1.156 +}
   1.157 +
   1.158 +
   1.159 +U_NAMESPACE_END
   1.160 +
   1.161 +#endif

mercurial