• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeabc
 

tdeabc

  • tdeabc
  • vcardparser
vcard.cpp
1 /*
2  This file is part of libtdeabc.
3  Copyright (c) 2003 Tobias Koenig <tokoe@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 "vcard.h"
22 
23 using namespace TDEABC;
24 
25 VCard::VCard()
26 {
27 }
28 
29 VCard::VCard( const VCard& vcard )
30 {
31  mLineMap = vcard.mLineMap;
32 }
33 
34 VCard::~VCard()
35 {
36 }
37 
38 VCard& VCard::operator=( const VCard& vcard )
39 {
40  if ( &vcard == this )
41  return *this;
42 
43  mLineMap = vcard.mLineMap;
44 
45  return *this;
46 }
47 
48 void VCard::clear()
49 {
50  mLineMap.clear();
51 }
52 
53 TQStringList VCard::identifiers() const
54 {
55  return mLineMap.keys();
56 }
57 
58 void VCard::addLine( const VCardLine& line )
59 {
60  mLineMap[ line.identifier() ].append( line );
61 }
62 
63 VCardLine::List VCard::lines( const TQString& identifier ) const
64 {
65  LineMap::ConstIterator it = mLineMap.find( identifier );
66  if ( it == mLineMap.end() )
67  return VCardLine::List();
68 
69  return *it;
70 }
71 
72 VCardLine VCard::line( const TQString& identifier ) const
73 {
74  LineMap::ConstIterator it = mLineMap.find( identifier );
75  if ( it == mLineMap.end() )
76  return VCardLine();
77 
78  if ( (*it).isEmpty() )
79  return VCardLine();
80  else
81  return (*it).first();
82 }
83 
84 void VCard::setVersion( Version version )
85 {
86  mLineMap.erase( "VERSION" );
87 
88  VCardLine line;
89  line.setIdentifier( "VERSION" );
90  if ( version == v2_1 )
91  line.setIdentifier( "2.1" );
92  else if ( version == v3_0 )
93  line.setIdentifier( "3.0" );
94 
95  mLineMap[ "VERSION" ].append( line );
96 }
97 
98 VCard::Version VCard::version() const
99 {
100  LineMap::ConstIterator versionEntry = mLineMap.find( "VERSION" );
101  if ( versionEntry == mLineMap.end() )
102  return v3_0;
103 
104  VCardLine line = ( *versionEntry )[ 0 ];
105  if ( line.value() == "2.1" )
106  return v2_1;
107  else
108  return v3_0;
109 }
TDEABC
static data, shared by ALL addressee objects
Definition: address.h:48

tdeabc

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

tdeabc

Skip menu "tdeabc"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeabc by doxygen 1.9.1
This website is maintained by Timothy Pearson.