kabc Library API Documentation

vcardline.cpp

00001 /*
00002     This file is part of libkabc.
00003     Copyright (c) 2003 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 "vcardline.h"
00022 
00023 using namespace KABC;
00024 
00025 VCardLine::VCardLine()
00026 {
00027 }
00028 
00029 VCardLine::VCardLine( const QString &identifier )
00030 {
00031   mIdentifier = identifier;
00032 }
00033 
00034 VCardLine::VCardLine( const QString &identifier, const QVariant &value )
00035 {
00036   mIdentifier = identifier;
00037   mValue = value;
00038 }
00039 
00040 VCardLine::VCardLine( const VCardLine& line )
00041 {
00042   mParamMap = line.mParamMap;
00043   mValue = line.mValue;
00044   mIdentifier = line.mIdentifier;
00045 }
00046 
00047 VCardLine::~VCardLine()
00048 {
00049 }
00050 
00051 VCardLine& VCardLine::operator=( const VCardLine& line )
00052 {
00053   if ( &line == this )
00054     return *this;
00055 
00056   mParamMap = line.mParamMap;
00057   mValue = line.mValue;
00058   mIdentifier = line.mIdentifier;
00059 
00060   return *this;
00061 }
00062 
00063 void VCardLine::setIdentifier( const QString& identifier )
00064 {
00065   mIdentifier = identifier;
00066 }
00067 
00068 QString VCardLine::identifier() const
00069 {
00070   return mIdentifier;
00071 }
00072 
00073 void VCardLine::setValue( const QVariant& value )
00074 {
00075   mValue = value;
00076 }
00077 
00078 QVariant VCardLine::value() const
00079 {
00080   return mValue;
00081 }
00082 
00083 QStringList VCardLine::parameterList() const
00084 {
00085   return mParamMap.keys();
00086 }
00087 
00088 void VCardLine::addParameter( const QString& param, const QString& value )
00089 {
00090   QStringList &list = mParamMap[ param ];
00091   if ( list.findIndex( value ) == -1 ) // not included yet
00092     list.append( value );
00093 }
00094 
00095 QStringList VCardLine::parameters( const QString& param ) const
00096 {
00097   ParamMap::ConstIterator it = mParamMap.find( param );
00098   if ( it == mParamMap.end() )
00099     return QStringList();
00100   else
00101     return *it;
00102 }
00103 
00104 QString VCardLine::parameter( const QString& param ) const
00105 {
00106   ParamMap::ConstIterator it = mParamMap.find( param );
00107   if ( it == mParamMap.end() )
00108     return QString::null;
00109   else {
00110     if ( (*it).isEmpty() )
00111       return QString::null;
00112     else
00113       return (*it).first();
00114   }
00115 }
KDE Logo
This file is part of the documentation for kabc Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Aug 4 05:28:15 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2003