KCal Library
duration.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00031 #ifndef KCAL_DURATION_H
00032 #define KCAL_DURATION_H
00033
00034 #include "kcal_export.h"
00035
00036 class KDateTime;
00037
00038 namespace KCal {
00039
00052 class KCAL_EXPORT Duration
00053 {
00054 public:
00058 enum Type {
00059 Seconds,
00060 Days
00061 };
00062
00066 Duration();
00067
00079 Duration( const KDateTime &start, const KDateTime &end );
00080
00092 Duration( const KDateTime &start, const KDateTime &end, Type type );
00093
00100 Duration( int duration, Type type = Seconds );
00101
00107 Duration( const Duration &duration );
00108
00112 ~Duration();
00113
00119 Duration &operator=( const Duration &duration );
00120
00124 operator bool() const;
00125
00129 bool operator!() const { return !operator bool(); }
00130
00135 bool operator<( const Duration &other ) const;
00136
00141 bool operator<=( const Duration &other ) const
00142 { return !other.operator<( *this ); }
00143
00148 bool operator>( const Duration &other ) const
00149 { return other.operator<( *this ); }
00150
00155 bool operator>=( const Duration &other ) const
00156 { return !operator<( other ); }
00157
00163 bool operator==( const Duration &other ) const;
00164
00169 bool operator!=( const Duration &other ) const
00170 { return !operator==( other ); }
00171
00178 Duration &operator+=( const Duration &other );
00179
00188 Duration operator+( const Duration &other ) const
00189 { return Duration( *this ) += other; }
00190
00194 Duration operator-() const;
00195
00203 Duration &operator-=( const Duration &other );
00204
00213 Duration operator-( const Duration &other ) const
00214 { return Duration( *this ) += other; }
00215
00220 Duration &operator*=( int value );
00221
00228 Duration operator*( int value ) const
00229 { return Duration( *this ) *= value; }
00230
00235 Duration &operator/=( int value );
00236
00243 Duration operator/( int value ) const
00244 { return Duration( *this ) /= value; }
00245
00253 KDateTime end( const KDateTime &start ) const;
00254
00258 Type type() const;
00259
00264 bool isDaily() const;
00265
00269 int asSeconds() const;
00270
00276 int asDays() const;
00277
00283 int value() const;
00284
00285 private:
00286
00287 class Private;
00288 Private *const d;
00289
00290 };
00291
00292 }
00293
00294 #endif