summaryrefslogtreecommitdiffabout
path: root/kabc/vcard/AdrParam.cpp
Unidiff
Diffstat (limited to 'kabc/vcard/AdrParam.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/vcard/AdrParam.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/kabc/vcard/AdrParam.cpp b/kabc/vcard/AdrParam.cpp
index fa46499..33d358c 100644
--- a/kabc/vcard/AdrParam.cpp
+++ b/kabc/vcard/AdrParam.cpp
@@ -1,126 +1,128 @@
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,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22*/ 22*/
23 23
24#include <VCardRToken.h> 24#include <VCardRToken.h>
25#include <VCardAdrParam.h> 25#include <VCardAdrParam.h>
26#include <VCardParam.h> 26#include <VCardParam.h>
27//Added by qt3to4:
28#include <Q3CString>
27 29
28using namespace VCARD; 30using namespace VCARD;
29 31
30AdrParam::AdrParam() 32AdrParam::AdrParam()
31 :Param() 33 :Param()
32{ 34{
33} 35}
34 36
35AdrParam::AdrParam(const AdrParam & x) 37AdrParam::AdrParam(const AdrParam & x)
36 :Param(x), 38 :Param(x),
37 adrTypeList_(x.adrTypeList_) 39 adrTypeList_(x.adrTypeList_)
38{ 40{
39} 41}
40 42
41AdrParam::AdrParam(const QCString & s) 43AdrParam::AdrParam(const Q3CString & s)
42 :Param(s) 44 :Param(s)
43{ 45{
44} 46}
45 47
46 AdrParam & 48 AdrParam &
47AdrParam::operator = (AdrParam & x) 49AdrParam::operator = (AdrParam & x)
48{ 50{
49 if (*this == x) return *this; 51 if (*this == x) return *this;
50 52
51 adrTypeList_= x.adrTypeList(); 53 adrTypeList_= x.adrTypeList();
52 textParam_ = x.textParam(); 54 textParam_ = x.textParam();
53 55
54 Param::operator = (x); 56 Param::operator = (x);
55 return *this; 57 return *this;
56} 58}
57 59
58 AdrParam & 60 AdrParam &
59AdrParam::operator = (const QCString & s) 61AdrParam::operator = (const Q3CString & s)
60{ 62{
61 Param::operator = (s); 63 Param::operator = (s);
62 64
63 adrTypeList_.clear(); 65 adrTypeList_.clear();
64 textParam_.truncate(0); 66 textParam_.truncate(0);
65 67
66 return *this; 68 return *this;
67} 69}
68 70
69 bool 71 bool
70AdrParam::operator == (AdrParam & x) 72AdrParam::operator == (AdrParam & x)
71{ 73{
72 parse(); 74 parse();
73 75
74 if (!x.textParam().isEmpty()) 76 if (!x.textParam().isEmpty())
75 return (x.textParam_ == textParam_); 77 return (x.textParam_ == textParam_);
76 78
77 if (x.adrTypeList().count() != adrTypeList_.count()) 79 if (x.adrTypeList().count() != adrTypeList_.count())
78 return false; 80 return false;
79 81
80 QStrListIterator it(x.adrTypeList_); 82 Q3StrListIterator it(x.adrTypeList_);
81 83
82 for (; it.current(); ++it) 84 for (; it.current(); ++it)
83 if (!adrTypeList_.find(it.current())) 85 if (!adrTypeList_.find(it.current()))
84 return false; 86 return false;
85 87
86 return true; 88 return true;
87} 89}
88 90
89AdrParam::~AdrParam() 91AdrParam::~AdrParam()
90{ 92{
91} 93}
92 94
93 void 95 void
94AdrParam::_parse() 96AdrParam::_parse()
95{ 97{
96 adrTypeList_.clear(); 98 adrTypeList_.clear();
97 99
98 if (strRep_.left(4) != "TYPE") { 100 if (strRep_.left(4) != "TYPE") {
99 textParam_ = strRep_; 101 textParam_ = strRep_;
100 return; 102 return;
101 } 103 }
102 104
103 if (!strRep_.contains('=')) 105 if (!strRep_.contains('='))
104 return; 106 return;
105 107
106 RTokenise(strRep_, ",", adrTypeList_); 108 RTokenise(strRep_, ",", adrTypeList_);
107} 109}
108 110
109 void 111 void
110AdrParam::_assemble() 112AdrParam::_assemble()
111{ 113{
112 if (!textParam_.isEmpty()) { 114 if (!textParam_.isEmpty()) {
113 strRep_ = textParam_; 115 strRep_ = textParam_;
114 return; 116 return;
115 } 117 }
116 118
117 QStrListIterator it(adrTypeList_); 119 Q3StrListIterator it(adrTypeList_);
118 120
119 for (; it.current(); ++it) { 121 for (; it.current(); ++it) {
120 122
121 strRep_ += it.current(); 123 strRep_ += it.current();
122 124
123 if (it.current() != adrTypeList_.last()) 125 if (it.current() != adrTypeList_.last())
124 strRep_ += ','; 126 strRep_ += ',';
125 } 127 }
126} 128}