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

KCal Library

  • sources
  • kde-4.12
  • kdepimlibs
  • kcal
duration.h
Go to the documentation of this file.
1 /*
2  This file is part of the kcal 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 KCAL_DURATION_H
32 #define KCAL_DURATION_H
33 
34 #include "kcal_export.h"
35 
36 class KDateTime;
37 
38 namespace KCal {
39 
52 class KCAL_DEPRECATED_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  Duration( int duration, Type type = Seconds ); //krazy:exclude=explicit
101 
107  Duration( const Duration &duration );
108 
112  ~Duration();
113 
119  Duration &operator=( const Duration &duration );
120 
124  operator bool() const;
125 
129  bool operator!() const { return !operator bool(); }
130 
135  bool operator<( const Duration &other ) const;
136 
141  bool operator<=( const Duration &other ) const
142  { return !other.operator<( *this ); }
143 
148  bool operator>( const Duration &other ) const
149  { return other.operator<( *this ); }
150 
155  bool operator>=( const Duration &other ) const
156  { return !operator<( other ); }
157 
165  bool operator==( const Duration &other ) const;
166 
174  bool operator!=( const Duration &other ) const
175  { return !operator==( other ); }
176 
183  Duration &operator+=( const Duration &other );
184 
193  Duration operator+( const Duration &other ) const
194  { return Duration( *this ) += other; }
195 
199  Duration operator-() const;
200 
208  Duration &operator-=( const Duration &other );
209 
218  Duration operator-( const Duration &other ) const
219  { return Duration( *this ) += other; }
220 
225  Duration &operator*=( int value );
226 
233  Duration operator*( int value ) const
234  { return Duration( *this ) *= value; }
235 
240  Duration &operator/=( int value );
241 
248  Duration operator/( int value ) const
249  { return Duration( *this ) /= value; }
250 
258  KDateTime end( const KDateTime &start ) const;
259 
263  Type type() const;
264 
269  bool isDaily() const;
270 
274  int asSeconds() const;
275 
281  int asDays() const;
282 
288  int value() const;
289 
290  private:
291  //@cond PRIVATE
292  class Private;
293  Private *const d;
294  //@endcond
295 };
296 
297 }
298 
299 #endif
KCal::Duration::operator/
Duration operator/(int value) const
Divides a duration by a value.
Definition: duration.h:248
KCal::Duration::operator+
Duration operator+(const Duration &other) const
Adds two durations.
Definition: duration.h:193
KCal::Duration::operator-
Duration operator-(const Duration &other) const
Returns the difference between another duration and this.
Definition: duration.h:218
KCal::Duration::operator*
Duration operator*(int value) const
Multiplies a duration by a value.
Definition: duration.h:233
KCal::Duration::Seconds
duration is a number of seconds
Definition: duration.h:59
KCal::Duration::operator>
bool operator>(const Duration &other) const
Returns true if this duration is greater than the other.
Definition: duration.h:148
KCal::Duration::operator!
bool operator!() const
Returns true if this duration is zero.
Definition: duration.h:129
KCal::Duration::Type
Type
The unit of time used to define the duration.
Definition: duration.h:58
KCal::Duration::operator>=
bool operator>=(const Duration &other) const
Returns true if this duration is greater than or equal to the other.
Definition: duration.h:155
KCal::Duration
Represents a span of time measured in seconds or days.
Definition: duration.h:52
KCal::Duration::operator<=
bool operator<=(const Duration &other) const
Returns true if this duration is smaller than or equal to the other.
Definition: duration.h:141
KCal::Duration::operator!=
bool operator!=(const Duration &other) const
Returns true if this duration is not equal to the other.
Definition: duration.h:174
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:57 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KCal Library

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

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



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