Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/intl/icu/source/common/unicode/dtintrv.h
Line
Count
Source (jump to first uncovered line)
1
// © 2016 and later: Unicode, Inc. and others.
2
// License & terms of use: http://www.unicode.org/copyright.html
3
/*
4
*******************************************************************************
5
* Copyright (C) 2008-2009, International Business Machines Corporation and
6
* others. All Rights Reserved.
7
*******************************************************************************
8
*
9
* File DTINTRV.H 
10
*
11
*******************************************************************************
12
*/
13
14
#ifndef __DTINTRV_H__
15
#define __DTINTRV_H__
16
17
#include "unicode/utypes.h"
18
#include "unicode/uobject.h"
19
20
/**
21
 * \file
22
 * \brief C++ API: Date Interval data type
23
 */
24
25
26
U_NAMESPACE_BEGIN
27
28
29
/**
30
 * This class represents a date interval.
31
 * It is a pair of UDate representing from UDate 1 to UDate 2.
32
 * @stable ICU 4.0
33
**/
34
class U_COMMON_API DateInterval : public UObject {
35
public:
36
37
    /** 
38
     * Construct a DateInterval given a from date and a to date.
39
     * @param fromDate  The from date in date interval.
40
     * @param toDate    The to date in date interval.
41
     * @stable ICU 4.0
42
     */
43
    DateInterval(UDate fromDate, UDate toDate);
44
45
    /**
46
     * destructor
47
     * @stable ICU 4.0
48
     */
49
    virtual ~DateInterval();
50
 
51
    /** 
52
     * Get the from date.
53
     * @return  the from date in dateInterval.
54
     * @stable ICU 4.0
55
     */
56
    UDate getFromDate() const;
57
58
    /** 
59
     * Get the to date.
60
     * @return  the to date in dateInterval.
61
     * @stable ICU 4.0
62
     */
63
    UDate getToDate() const;
64
65
66
    /**
67
     * Return the class ID for this class. This is useful only for comparing to
68
     * a return value from getDynamicClassID(). For example:
69
     * <pre>
70
     * .   Base* polymorphic_pointer = createPolymorphicObject();
71
     * .   if (polymorphic_pointer->getDynamicClassID() ==
72
     * .       derived::getStaticClassID()) ...
73
     * </pre>
74
     * @return          The class ID for all objects of this class.
75
     * @stable ICU 4.0
76
     */
77
    static UClassID U_EXPORT2 getStaticClassID(void);
78
79
    /**
80
     * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
81
     * method is to implement a simple version of RTTI, since not all C++
82
     * compilers support genuine RTTI. Polymorphic operator==() and clone()
83
     * methods call this method.
84
     *
85
     * @return          The class ID for this object. All objects of a
86
     *                  given class have the same class ID.  Objects of
87
     *                  other classes have different class IDs.
88
     * @stable ICU 4.0
89
     */
90
    virtual UClassID getDynamicClassID(void) const;
91
92
    
93
    /**
94
     * Copy constructor.
95
     * @stable ICU 4.0
96
     */
97
    DateInterval(const DateInterval& other);
98
99
    /**
100
     * Default assignment operator
101
     * @stable ICU 4.0
102
     */
103
    DateInterval& operator=(const DateInterval&);
104
105
    /**
106
     * Equality operator.
107
     * @return TRUE if the two DateIntervals are the same
108
     * @stable ICU 4.0
109
     */
110
    virtual UBool operator==(const DateInterval& other) const;
111
112
    /**
113
     * Non-equality operator
114
     * @return TRUE if the two DateIntervals are not the same
115
     * @stable ICU 4.0
116
     */
117
    UBool operator!=(const DateInterval& other) const;
118
119
120
    /**
121
     * clone this object. 
122
     * The caller owns the result and should delete it when done.
123
     * @return a cloned DateInterval
124
     * @stable ICU 4.0
125
     */
126
     virtual DateInterval* clone() const;
127
128
private:
129
    /** 
130
     * Default constructor, not implemented.
131
     */
132
    DateInterval();
133
134
    UDate fromDate;
135
    UDate toDate;
136
137
} ;// end class DateInterval
138
139
140
inline UDate 
141
0
DateInterval::getFromDate() const { 
142
0
    return fromDate; 
143
0
}
144
145
146
inline UDate 
147
0
DateInterval::getToDate() const { 
148
0
    return toDate; 
149
0
}
150
151
152
inline UBool 
153
0
DateInterval::operator!=(const DateInterval& other) const { 
154
0
    return ( !operator==(other) );
155
0
}
156
157
158
U_NAMESPACE_END
159
160
#endif