KContacts

timezone.h
1 /*
2  This file is part of the KContacts framework.
3  SPDX-FileCopyrightText: 2001 Cornelius Schumacher <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef KCONTACTS_TIMEZONE_H
9 #define KCONTACTS_TIMEZONE_H
10 
11 #include "kcontacts_export.h"
12 #include <QSharedDataPointer>
13 #include <QString>
14 
15 namespace KContacts
16 {
17 /**
18  * @short Time zone information.
19  *
20  * This class stores information about a time zone.
21  */
22 class KCONTACTS_EXPORT TimeZone
23 {
24  friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const TimeZone &);
25  friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, TimeZone &);
26 
27 public:
28  /**
29  * Construct invalid time zone.
30  */
31  TimeZone();
32 
33  /**
34  * Construct time zone.
35  *
36  * @param offset Offset in minutes relative to UTC.
37  */
38  TimeZone(int offset);
39 
40  /**
41  * Copy constructor.
42  */
43  TimeZone(const TimeZone &other);
44 
45  /**
46  * Destroys the time zone.
47  */
48  ~TimeZone();
49 
50  /**
51  * Set time zone offset relative to UTC.
52  *
53  * @param offset Offset in minutes.
54  */
55  void setOffset(int offset);
56 
57  /**
58  * Return offset in minutes relative to UTC.
59  */
60  Q_REQUIRED_RESULT int offset() const;
61 
62  /**
63  * Return, if this time zone object is valid.
64  */
65  Q_REQUIRED_RESULT bool isValid() const;
66 
67  Q_REQUIRED_RESULT bool operator==(const TimeZone &other) const;
68  Q_REQUIRED_RESULT bool operator!=(const TimeZone &other) const;
69  TimeZone &operator=(const TimeZone &other);
70 
71  /**
72  * Return string representation of time zone offset.
73  */
74  Q_REQUIRED_RESULT QString toString() const;
75 
76 private:
77  class Private;
79 };
80 
81 /**
82  * Serializes the @p timezone object into the @p stream.
83  */
84 KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const TimeZone &timeZone);
85 
86 /**
87  * Initializes the @p timezone object from the @p stream.
88  */
89 KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, TimeZone &timeZone);
90 }
91 Q_DECLARE_TYPEINFO(KContacts::TimeZone, Q_MOVABLE_TYPE);
92 
93 #endif
QDataStream & operator>>(QDataStream &in, KDateTime::Spec &spec)
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
Time zone information.
Definition: timezone.h:22
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Jun 18 2021 22:54:49 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.