KCalCore Library
duration.h
Go to the documentation of this file.
00001 /* 00002 This file is part of the kcalcore library. 00003 00004 Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org> 00005 Copyright (c) 2007 David Jarvie <djarvie@kde.org> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 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 // Keep the following implicit since instances are often used in integer evaluations. 00101 Duration( int duration, Type type = Seconds ); //krazy:exclude=explicit 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 //@cond PRIVATE 00293 class Private; 00294 Private *const d; 00295 //@endcond 00296 }; 00297 00298 } 00299 00300 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Thu May 10 2012 22:16:56 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Thu May 10 2012 22:16:56 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.