# kabc Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# picture.cpp

    00001 /*
    00002     This file is part of libkabc.
    00003     Copyright (c) 2002 Tobias Koenig <tokoe@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 "picture.h"
    00022
    00023 using namespace KABC;
    00024
    00025 Picture::Picture()
    00026   : mIntern( false )
    00027 {
    00028 }
    00029
    00030 Picture::Picture( const QString &url )
    00031   : mUrl( url ), mIntern( false )
    00032 {
    00033 }
    00034
    00035 Picture::Picture( const QImage &data )
    00036   : mData( data ), mIntern( true )
    00037 {
    00038 }
    00039
    00040 Picture::~Picture()
    00041 {
    00042 }
    00043
    00044 bool Picture::operator==( const Picture &p ) const
    00045 {
    00046   if ( mIntern != p.mIntern ) return false;
    00047
    00048   if ( mIntern ) {
    00049     if ( mData != p.mData )
    00050       return false;
    00051   } else {
    00052     if ( mUrl != p.mUrl )
    00053       return false;
    00054   }
    00055
    00056   return true;
    00057 }
    00058
    00059 bool Picture::operator!=( const Picture &p ) const
    00060 {
    00061   return !( p == *this );
    00062 }
    00063
    00064 void Picture::setUrl( const QString &url )
    00065 {
    00066   mUrl = url;
    00067   mIntern = false;
    00068 }
    00069
    00070 void Picture::setData( const QImage &data )
    00071 {
    00072   mData = data;
    00073   mIntern = true;
    00074 }
    00075
    00076 void Picture::setType( const QString &type )
    00077 {
    00078   mType = type;
    00079 }
    00080
    00081 bool Picture::isIntern() const
    00082 {
    00083   return mIntern;
    00084 }
    00085
    00086 QString Picture::url() const
    00087 {
    00088   return mUrl;
    00089 }
    00090
    00091 QImage Picture::data() const
    00092 {
    00093   return mData;
    00094 }
    00095
    00096 QString Picture::type() const
    00097 {
    00098   return mType;
    00099 }
    00100
    00101 QString Picture::asString() const
    00102 {
    00103   if ( mIntern )
    00104     return "intern picture";
    00105   else
    00106     return mUrl;
    00107 }
    00108
    00109 QDataStream &KABC::operator<<( QDataStream &s, const Picture &picture )
    00110 {
    00111   return s << picture.mIntern << picture.mUrl << picture.mType;
    00112 //  return s << picture.mIntern << picture.mUrl << picture.mType << picture.mData;
    00113 }
    00114
    00115 QDataStream &KABC::operator>>( QDataStream &s, Picture &picture )
    00116 {
    00117   s >> picture.mIntern >> picture.mUrl >> picture.mType;
    00118 //  s >> picture.mIntern >> picture.mUrl >> picture.mType >> picture.mData;
    00119   return s;
    00120 }

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:30 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003