KCalCore 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 KCALCORE_DURATION_H
00032 #define KCALCORE_DURATION_H
00033
00034 #include "kcalcore_export.h"
00035
00036 class KDateTime;
00037
00038 namespace KCalCore {
00039
00052 class KCALCORE_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
00101 Duration( int duration, Type type = Seconds );
00102
00108 Duration( const Duration &duration );
00109
00113 ~Duration();
00114
00120 Duration &operator=( const Duration &duration );
00121
00125 operator bool() const;
00126
00130 bool operator!() const { return !operator bool(); }
00131
00136 bool operator<( const Duration &other ) const;
00137
00142 bool operator<=( const Duration &other ) const
00143 { return !other.operator<( *this ); }
00144
00149 bool operator>( const Duration &other ) const
00150 { return other.operator<( *this ); }
00151
00156 bool operator>=( const Duration &other ) const
00157 { return !operator<( other ); }
00158
00166 bool operator==( const Duration &other ) const;
00167
00175 bool operator!=( const Duration &other ) const
00176 { return !operator==( other ); }
00177
00184 Duration &operator+=( const Duration &other );
00185
00194 Duration operator+( const Duration &other ) const
00195 { return Duration( *this ) += other; }
00196
00200 Duration operator-() const;
00201
00209 Duration &operator-=( const Duration &other );
00210
00219 Duration operator-( const Duration &other ) const
00220 { return Duration( *this ) += other; }
00221
00226 Duration &operator*=( int value );
00227
00234 Duration operator*( int value ) const
00235 { return Duration( *this ) *= value; }
00236
00241 Duration &operator/=( int value );
00242
00249 Duration operator/( int value ) const
00250 { return Duration( *this ) /= value; }
00251
00259 KDateTime end( const KDateTime &start ) const;
00260
00264 Type type() const;
00265
00270 bool isDaily() const;
00271
00275 int asSeconds() const;
00276
00282 int asDays() const;
00283
00289 int value() const;
00290
00291 private:
00292
00293 class Private;
00294 Private *const d;
00295
00296 };
00297
00298 }
00299
00300 #endif