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

kabc

  • kabc
timezone.cpp
1/*
2 This file is part of libkabc.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#include "timezone.h"
22
23#include <QtCore/QDataStream>
24#include <QtCore/QSharedData>
25
26using namespace KABC;
27
28class TimeZone::Private : public QSharedData
29{
30 public:
31 Private( int offset = 0, bool valid = false )
32 : mOffset( offset ), mValid( valid )
33 {
34 }
35
36 Private( const Private &other )
37 : QSharedData( other )
38 {
39 mOffset = other.mOffset;
40 mValid = other.mValid;
41 }
42
43 int mOffset;
44 bool mValid;
45};
46
47TimeZone::TimeZone()
48 : d( new Private )
49{
50}
51
52TimeZone::TimeZone( int offset )
53 : d( new Private( offset, true ) )
54{
55}
56
57TimeZone::TimeZone( const TimeZone &other )
58 : d( other.d )
59{
60}
61
62TimeZone::~TimeZone()
63{
64}
65
66void TimeZone::setOffset( int offset )
67{
68 d->mOffset = offset;
69 d->mValid = true;
70}
71
72int TimeZone::offset() const
73{
74 return d->mOffset;
75}
76
77bool TimeZone::isValid() const
78{
79 return d->mValid;
80}
81
82bool TimeZone::operator==( const TimeZone &t ) const
83{
84 if ( !t.isValid() && !isValid() ) {
85 return true;
86 }
87
88 if ( !t.isValid() || !isValid() ) {
89 return false;
90 }
91
92 if ( t.d->mOffset == d->mOffset ) {
93 return true;
94 }
95
96 return false;
97}
98
99bool TimeZone::operator!=( const TimeZone &t ) const
100{
101 return !( *this == t );
102}
103
104TimeZone &TimeZone::operator=( const TimeZone &other )
105{
106 if ( this != &other ) {
107 d = other.d;
108 }
109
110 return *this;
111}
112
113QString TimeZone::toString() const
114{
115 QString str;
116
117 str += QString::fromLatin1( "TimeZone {\n" );
118 str += QString::fromLatin1( " Offset: %1\n" ).arg( d->mOffset );
119 str += QString::fromLatin1( "}\n" );
120
121 return str;
122}
123
124QDataStream &KABC::operator<<( QDataStream &s, const TimeZone &zone )
125{
126 return s << zone.d->mOffset << zone.d->mValid;
127}
128
129QDataStream &KABC::operator>>( QDataStream &s, TimeZone &zone )
130{
131 s >> zone.d->mOffset >> zone.d->mValid;
132
133 return s;
134}
KABC::TimeZone
Time zone information.
Definition: timezone.h:36
KABC::TimeZone::setOffset
void setOffset(int offset)
Set time zone offset relative to UTC.
Definition: timezone.cpp:66
KABC::TimeZone::offset
int offset() const
Return offset in minutes relative to UTC.
Definition: timezone.cpp:72
KABC::TimeZone::TimeZone
TimeZone()
Construct invalid time zone.
Definition: timezone.cpp:47
KABC::TimeZone::toString
QString toString() const
Return string representation of time zone offset.
Definition: timezone.cpp:113
KABC::TimeZone::~TimeZone
~TimeZone()
Destroys the time zone.
Definition: timezone.cpp:62
KABC::TimeZone::isValid
bool isValid() const
Return, if this time zone object is valid.
Definition: timezone.cpp:77
KABC
Class that holds a Calendar Url (FBURL/CALADRURI/CALURI)
Definition: address.h:29
KABC::operator<<
QDataStream & operator<<(QDataStream &stream, const Address &address)
Serializes the address object into the stream.
Definition: address.cpp:680
KABC::operator>>
QDataStream & operator>>(QDataStream &stream, Address &address)
Initializes the address object from the stream.
Definition: address.cpp:688
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kabc

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

kdepimlibs-4.14.10 API Reference

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