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
00165 bool operator==( const Duration &other ) const;
00166
00174 bool operator!=( const Duration &other ) const
00175 { return !operator==( other ); }
00176
00183 Duration &operator+=( const Duration &other );
00184
00193 Duration operator+( const Duration &other ) const
00194 { return Duration( *this ) += other; }
00195
00199 Duration operator-() const;
00200
00208 Duration &operator-=( const Duration &other );
00209
00218 Duration operator-( const Duration &other ) const
00219 { return Duration( *this ) += other; }
00220
00225 Duration &operator*=( int value );
00226
00233 Duration operator*( int value ) const
00234 { return Duration( *this ) *= value; }
00235
00240 Duration &operator/=( int value );
00241
00248 Duration operator/( int value ) const
00249 { return Duration( *this ) /= value; }
00250
00258 KDateTime end( const KDateTime &start ) const;
00259
00263 Type type() const;
00264
00269 bool isDaily() const;
00270
00274 int asSeconds() const;
00275
00281 int asDays() const;
00282
00288 int value() const;
00289
00290 private:
00291
00292 class Private;
00293 Private *const d;
00294
00295 };
00296
00297 }
00298
00299 #endif