• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.11.3 API Reference
  • KDE Home
  • Contact Us
 

KCalCore Library

  • kcalcore
duration.h
Go to the documentation of this file.
1 /*
2  This file is part of the kcalcore library.
3 
4  Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
5  Copyright (c) 2007 David Jarvie <djarvie@kde.org>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
31 #ifndef KCALCORE_DURATION_H
32 #define KCALCORE_DURATION_H
33 
34 #include "kcalcore_export.h"
35 
36 class KDateTime;
37 
38 namespace KCalCore {
39 
52 class KCALCORE_EXPORT Duration
53 {
54  public:
58  enum Type {
59  Seconds,
60  Days
61  };
62 
66  Duration();
67 
79  Duration( const KDateTime &start, const KDateTime &end );
80 
92  Duration( const KDateTime &start, const KDateTime &end, Type type );
93 
100  // Keep the following implicit since instances are often used in integer evaluations.
101  Duration( int duration, Type type = Seconds ); //krazy:exclude=explicit
102 
108  Duration( const Duration &duration );
109 
113  ~Duration();
114 
120  Duration &operator=( const Duration &duration );
121 
125  operator bool() const;
126 
130  bool operator!() const { return !operator bool(); }
131 
136  bool operator<( const Duration &other ) const;
137 
142  bool operator<=( const Duration &other ) const
143  { return !other.operator<( *this ); }
144 
149  bool operator>( const Duration &other ) const
150  { return other.operator<( *this ); }
151 
156  bool operator>=( const Duration &other ) const
157  { return !operator<( other ); }
158 
166  bool operator==( const Duration &other ) const;
167 
175  bool operator!=( const Duration &other ) const
176  { return !operator==( other ); }
177 
184  Duration &operator+=( const Duration &other );
185 
194  Duration operator+( const Duration &other ) const
195  { return Duration( *this ) += other; }
196 
200  Duration operator-() const;
201 
209  Duration &operator-=( const Duration &other );
210 
219  Duration operator-( const Duration &other ) const
220  { return Duration( *this ) += other; }
221 
226  Duration &operator*=( int value );
227 
234  Duration operator*( int value ) const
235  { return Duration( *this ) *= value; }
236 
241  Duration &operator/=( int value );
242 
249  Duration operator/( int value ) const
250  { return Duration( *this ) /= value; }
251 
259  KDateTime end( const KDateTime &start ) const;
260 
264  Type type() const;
265 
270  bool isDaily() const;
271 
275  int asSeconds() const;
276 
282  int asDays() const;
283 
289  int value() const;
290 
291  private:
292  //@cond PRIVATE
293  class Private;
294  Private *const d;
295  //@endcond
296 };
297 
298 }
299 
300 #endif
KCalCore::Duration
Represents a span of time measured in seconds or days.
Definition: duration.h:52
KCalCore::Duration::operator>
bool operator>(const Duration &other) const
Returns true if this duration is greater than the other.
Definition: duration.h:149
KCalCore::Duration::operator<=
bool operator<=(const Duration &other) const
Returns true if this duration is smaller than or equal to the other.
Definition: duration.h:142
KCalCore::Duration::operator!=
bool operator!=(const Duration &other) const
Returns true if this duration is not equal to the other.
Definition: duration.h:175
KCalCore::Duration::operator/
Duration operator/(int value) const
Divides a duration by a value.
Definition: duration.h:249
KCalCore::Duration::Seconds
duration is a number of seconds
Definition: duration.h:59
KCalCore::Duration::Type
Type
The unit of time used to define the duration.
Definition: duration.h:58
KCalCore::Duration::operator-
Duration operator-(const Duration &other) const
Returns the difference between another duration and this.
Definition: duration.h:219
KCalCore::Duration::operator+
Duration operator+(const Duration &other) const
Adds two durations.
Definition: duration.h:194
KCalCore::Duration::operator>=
bool operator>=(const Duration &other) const
Returns true if this duration is greater than or equal to the other.
Definition: duration.h:156
KCalCore::Duration::operator*
Duration operator*(int value) const
Multiplies a duration by a value.
Definition: duration.h:234
KCalCore::Duration::operator!
bool operator!() const
Returns true if this duration is zero.
Definition: duration.h:130
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Nov 26 2013 09:02:04 by doxygen 1.8.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KCalCore Library

Skip menu "KCalCore Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepimlibs-4.11.3 API Reference

Skip menu "kdepimlibs-4.11.3 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal