kabc Library: timezone.cpp Source File (kabc Library)

| # kabc Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# timezone.cpp

    00001 /*
    00002     This file is part of libkabc.
    00003     Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
    00004
    00005     This library is free software; you can redistribute it and/or
    00006     modify it under the terms of the GNU Library General Public
    00007     License as published by the Free Software Foundation; either
    00008     version 2 of the License, or (at your option) any later version.
    00009
    00010     This library is distributed in the hope that it will be useful,
    00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013     Library General Public License for more details.
    00014
    00015     You should have received a copy of the GNU Library General Public License
    00016     along with this library; see the file COPYING.LIB.  If not, write to
    00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00018     Boston, MA 02111-1307, USA.
    00019 */
    00020
    00021 #include <qdatastream.h>
    00022
    00023 #include "timezone.h"
    00024
    00025 using namespace KABC;
    00026
    00027 TimeZone::TimeZone() :
    00028   mOffset( 0 ), mValid( false )
    00029 {
    00030 }
    00031
    00032 TimeZone::TimeZone( int offset ) :
    00033   mOffset( offset ), mValid( true )
    00034 {
    00035 }
    00036
    00037 void TimeZone::setOffset( int offset )
    00038 {
    00039   mOffset = offset;
    00040   mValid = true;
    00041 }
    00042
    00043 int TimeZone::offset() const
    00044 {
    00045   return mOffset;
    00046 }
    00047
    00048 bool TimeZone::isValid() const
    00049 {
    00050   return mValid;
    00051 }
    00052
    00053 bool TimeZone::operator==( const TimeZone &t ) const
    00054 {
    00055   if ( !t.isValid() && !isValid() ) return true;
    00056   if ( !t.isValid() || !isValid() ) return false;
    00057   if ( t.mOffset == mOffset ) return true;
    00058   return false;
    00059 }
    00060
    00061 bool TimeZone::operator!=( const TimeZone &t ) const
    00062 {
    00063   if ( !t.isValid() && !isValid() ) return false;
    00064   if ( !t.isValid() || !isValid() ) return true;
    00065   if ( t.mOffset != mOffset ) return true;
    00066   return false;
    00067 }
    00068
    00069 QString TimeZone::asString() const
    00070 {
    00071   return QString::number( mOffset );
    00072 }
    00073
    00074 QDataStream &KABC::operator<<( QDataStream &s, const TimeZone &zone )
    00075 {
    00076     return s << zone.mOffset;
    00077 }
    00078
    00079 QDataStream &KABC::operator>>( QDataStream &s, TimeZone &zone )
    00080 {
    00081     s >> zone.mOffset;
    00082     zone.mValid = true;
    00083
    00084     return s;
    00085 }

This file is part of the documentation for kabc Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:31:31 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003