summaryrefslogtreecommitdiffabout
path: root/kabc/vcard/VCardEntity.cpp
Unidiff
Diffstat (limited to 'kabc/vcard/VCardEntity.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/vcard/VCardEntity.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/kabc/vcard/VCardEntity.cpp b/kabc/vcard/VCardEntity.cpp
index 0c21e2f..0cd2086 100644
--- a/kabc/vcard/VCardEntity.cpp
+++ b/kabc/vcard/VCardEntity.cpp
@@ -1,17 +1,17 @@
1/* 1/*
2 libvcard - vCard parsing library for vCard version 3.0 2 libvcard - vCard parsing library for vCard version 3.0
3 3
4 Copyright (C) 1998 Rik Hemsley rik@kde.org 4 Copyright (C) 1998 Rik Hemsley rik@kde.org
5 5
6 Permission is hereby granted, free of charge, to any person obtaining a copy 6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to 7 of this software and associated documentation files (the "Software"), to
8 deal in the Software without restriction, including without limitation the 8 deal in the Software without restriction, including without limitation the
9 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 sell copies of the Software, and to permit persons to whom the Software is 10 sell copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions: 11 furnished to do so, subject to the following conditions:
12 12
13 The above copyright notice and this permission notice shall be included in 13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software. 14 all copies or substantial portions of the Software.
15 15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
@@ -22,34 +22,37 @@
22*/ 22*/
23 23
24#include <qregexp.h> 24#include <qregexp.h>
25 25
26#include <VCardDefines.h> 26#include <VCardDefines.h>
27#include <VCardVCardEntity.h> 27#include <VCardVCardEntity.h>
28 28
29using namespace VCARD; 29using namespace VCARD;
30 30
31VCardEntity::VCardEntity() 31VCardEntity::VCardEntity()
32 :Entity() 32 :Entity()
33{ 33{
34 cardList_.setAutoDelete( TRUE );
34} 35}
35 36
36VCardEntity::VCardEntity(const VCardEntity & x) 37VCardEntity::VCardEntity(const VCardEntity & x)
37 :Entity(x) 38 :Entity(x)
38{ 39{
40 cardList_.setAutoDelete( TRUE );
39} 41}
40 42
41VCardEntity::VCardEntity(const QCString & s) 43VCardEntity::VCardEntity(const QCString & s)
42 :Entity(s) 44 :Entity(s)
43{ 45{
46 cardList_.setAutoDelete( TRUE );
44} 47}
45 48
46 VCardEntity & 49 VCardEntity &
47VCardEntity::operator = (VCardEntity & x) 50VCardEntity::operator = (VCardEntity & x)
48{ 51{
49 if (*this == x) return *this; 52 if (*this == x) return *this;
50 53
51 Entity::operator = (x); 54 Entity::operator = (x);
52 return *this; 55 return *this;
53} 56}
54 57
55 VCardEntity & 58 VCardEntity &
@@ -66,48 +69,48 @@ VCardEntity::operator == (VCardEntity & x)
66 return false; 69 return false;
67} 70}
68 71
69VCardEntity::~VCardEntity() 72VCardEntity::~VCardEntity()
70{ 73{
71} 74}
72 75
73 void 76 void
74VCardEntity::_parse() 77VCardEntity::_parse()
75{ 78{
76 vDebug("parse"); 79 vDebug("parse");
77 QCString s(strRep_); 80 QCString s(strRep_);
78 81
79 int i = s.find(QRegExp("BEGIN:VCARD", false)); 82 int i = s.find(QRegExp("BEGIN:VCARD", false));
80 83
81 while (i != -1) { 84 while (i != -1) {
82 85
83 i = s.find(QRegExp("BEGIN:VCARD", false), 11); 86 i = s.find(QRegExp("BEGIN:VCARD", false), 11);
84 87
85 QCString cardStr(s.left(i)); 88 QCString cardStr(s.left(i));
86 89
87 VCard * v = new VCard(cardStr); 90 VCard * v = new VCard(cardStr);
88 91
89 cardList_.append(v); 92 cardList_.append(v);
90 93
91 v->parse(); 94 v->parse();
92 95
93 s.remove(0, i); 96 s.remove(0, i);
94 } 97 }
95} 98}
96 99
97 void 100 void
98VCardEntity::_assemble() 101VCardEntity::_assemble()
99{ 102{
100 VCardListIterator it(cardList_); 103 VCardListIterator it(cardList_);
101 104
102 for (; it.current(); ++it) 105 for (; it.current(); ++it)
103 strRep_ += it.current()->asString() + "\r\n"; // One CRLF for luck. 106 strRep_ += it.current()->asString() + "\r\n"; // One CRLF for luck.
104} 107}
105 108
106 VCardList & 109 VCardList &
107VCardEntity::cardList() 110VCardEntity::cardList()
108{ 111{
109 parse(); 112 parse();
110 return cardList_; 113 return cardList_;
111} 114}
112 115
113 void 116 void