• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.11.5 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 {
131  return !operator bool();
132  }
133 
138  bool operator<(const Duration &other) const;
139 
144  bool operator<=(const Duration &other) const
145  {
146  return !other.operator<(*this);
147  }
148 
153  bool operator>(const Duration &other) const
154  {
155  return other.operator<(*this);
156  }
157 
162  bool operator>=(const Duration &other) const
163  {
164  return !operator<(other);
165  }
166 
174  bool operator==(const Duration &other) const;
175 
183  bool operator!=(const Duration &other) const
184  {
185  return !operator==(other);
186  }
187 
194  Duration &operator+=(const Duration &other);
195 
204  Duration operator+(const Duration &other) const
205  {
206  return Duration(*this) += other;
207  }
208 
212  Duration operator-() const;
213 
221  Duration &operator-=(const Duration &other);
222 
231  Duration operator-(const Duration &other) const
232  {
233  return Duration(*this) += other;
234  }
235 
240  Duration &operator*=(int value);
241 
248  Duration operator*(int value) const
249  {
250  return Duration(*this) *= value;
251  }
252 
257  Duration &operator/=(int value);
258 
265  Duration operator/(int value) const
266  {
267  return Duration(*this) /= value;
268  }
269 
277  KDateTime end(const KDateTime &start) const;
278 
282  Type type() const;
283 
288  bool isDaily() const;
289 
293  int asSeconds() const;
294 
300  int asDays() const;
301 
307  int value() const;
308 
309 private:
310  //@cond PRIVATE
311  class Private;
312  Private *const d;
313  //@endcond
314 };
315 
316 }
317 
318 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Fri Jan 3 2014 22:20:29 by doxygen 1.8.3.1 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.5 API Reference

Skip menu "kdepimlibs-4.11.5 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