kabc Library API Documentation

vcardconverter.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 "vcard21parser.h"
00022 #include "vcardformatimpl.h"
00023 
00024 #include "vcardconverter.h"
00025 
00026 using namespace KABC;
00027 
00028 struct VCardConverter::VCardConverterData
00029 {
00030   VCard21Parser vcard21parser;
00031   VCardFormatImpl vcard30parser;
00032 };
00033 
00034 VCardConverter::VCardConverter()
00035   : d( new VCardConverterData )
00036 {
00037 }
00038 
00039 VCardConverter::~VCardConverter()
00040 {
00041   delete d;
00042   d = 0;
00043 }
00044 
00045 bool VCardConverter::vCardToAddressee( const QString &str, Addressee &addr, Version version )
00046 {
00047   if ( version == v2_1 ) {
00048     addr = d->vcard21parser.readFromString( str );
00049     return true;
00050   }
00051 
00052   if ( version == v3_0 )
00053     return d->vcard30parser.readFromString( str, addr );
00054 
00055   return false;
00056 }
00057 
00058 bool VCardConverter::addresseeToVCard( const Addressee &addr, QString &str, Version version )
00059 {
00060   if ( version == v2_1 )
00061     return false;
00062 
00063   if ( version == v3_0 )
00064     return d->vcard30parser.writeToString( addr, str );
00065 
00066   return false;
00067 }
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:22:08 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001