-rw-r--r-- | kabc/vcard/NValue.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/kabc/vcard/NValue.cpp b/kabc/vcard/NValue.cpp index cdec621..6c0f365 100644 --- a/kabc/vcard/NValue.cpp +++ b/kabc/vcard/NValue.cpp | |||
@@ -1,128 +1,130 @@ | |||
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) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 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 <qstrlist.h> | 24 | #include <q3strlist.h> |
25 | //Added by qt3to4: | ||
26 | #include <Q3CString> | ||
25 | 27 | ||
26 | #include <VCardRToken.h> | 28 | #include <VCardRToken.h> |
27 | #include <VCardNValue.h> | 29 | #include <VCardNValue.h> |
28 | #include <VCardValue.h> | 30 | #include <VCardValue.h> |
29 | #include <VCardDefines.h> | 31 | #include <VCardDefines.h> |
30 | 32 | ||
31 | using namespace VCARD; | 33 | using namespace VCARD; |
32 | 34 | ||
33 | NValue::NValue() | 35 | NValue::NValue() |
34 | :Value() | 36 | :Value() |
35 | { | 37 | { |
36 | vDebug("ctor"); | 38 | vDebug("ctor"); |
37 | } | 39 | } |
38 | 40 | ||
39 | NValue::NValue(const NValue & x) | 41 | NValue::NValue(const NValue & x) |
40 | :Value(x), | 42 | :Value(x), |
41 | family_(x.family_), | 43 | family_(x.family_), |
42 | given_(x.given_), | 44 | given_(x.given_), |
43 | middle_(x.middle_), | 45 | middle_(x.middle_), |
44 | prefix_(x.prefix_), | 46 | prefix_(x.prefix_), |
45 | suffix_(x.suffix_) | 47 | suffix_(x.suffix_) |
46 | { | 48 | { |
47 | } | 49 | } |
48 | 50 | ||
49 | NValue::NValue(const QCString & s) | 51 | NValue::NValue(const Q3CString & s) |
50 | :Value(s) | 52 | :Value(s) |
51 | { | 53 | { |
52 | vDebug("ctor"); | 54 | vDebug("ctor"); |
53 | } | 55 | } |
54 | 56 | ||
55 | NValue & | 57 | NValue & |
56 | NValue::operator = (NValue & x) | 58 | NValue::operator = (NValue & x) |
57 | { | 59 | { |
58 | if (*this == x) return *this; | 60 | if (*this == x) return *this; |
59 | 61 | ||
60 | family_= x.family_; | 62 | family_= x.family_; |
61 | given_= x.given_; | 63 | given_= x.given_; |
62 | middle_= x.middle_; | 64 | middle_= x.middle_; |
63 | prefix_= x.prefix_; | 65 | prefix_= x.prefix_; |
64 | suffix_= x.suffix_; | 66 | suffix_= x.suffix_; |
65 | 67 | ||
66 | Value::operator = (x); | 68 | Value::operator = (x); |
67 | return *this; | 69 | return *this; |
68 | } | 70 | } |
69 | 71 | ||
70 | NValue & | 72 | NValue & |
71 | NValue::operator = (const QCString & s) | 73 | NValue::operator = (const Q3CString & s) |
72 | { | 74 | { |
73 | Value::operator = (s); | 75 | Value::operator = (s); |
74 | return *this; | 76 | return *this; |
75 | } | 77 | } |
76 | 78 | ||
77 | bool | 79 | bool |
78 | NValue::operator == (NValue & x) | 80 | NValue::operator == (NValue & x) |
79 | { | 81 | { |
80 | x.parse(); | 82 | x.parse(); |
81 | 83 | ||
82 | return ( | 84 | return ( |
83 | family_ == x.family_&& | 85 | family_ == x.family_&& |
84 | given_ == x.given_&& | 86 | given_ == x.given_&& |
85 | middle_ == x.middle_&& | 87 | middle_ == x.middle_&& |
86 | prefix_ == x.prefix_&& | 88 | prefix_ == x.prefix_&& |
87 | suffix_ == x.suffix_); | 89 | suffix_ == x.suffix_); |
88 | } | 90 | } |
89 | 91 | ||
90 | NValue::~NValue() | 92 | NValue::~NValue() |
91 | { | 93 | { |
92 | } | 94 | } |
93 | 95 | ||
94 | NValue * | 96 | NValue * |
95 | NValue::clone() | 97 | NValue::clone() |
96 | { | 98 | { |
97 | return new NValue( *this ); | 99 | return new NValue( *this ); |
98 | } | 100 | } |
99 | 101 | ||
100 | void | 102 | void |
101 | NValue::_parse() | 103 | NValue::_parse() |
102 | { | 104 | { |
103 | QStrList l; | 105 | Q3StrList l; |
104 | RTokenise(strRep_, ";", l); | 106 | RTokenise(strRep_, ";", l); |
105 | 107 | ||
106 | for (unsigned int i = 0; i < l.count(); i++) { | 108 | for (unsigned int i = 0; i < l.count(); i++) { |
107 | 109 | ||
108 | switch (i) { | 110 | switch (i) { |
109 | case 0: family_ = l.at(0);break; | 111 | case 0: family_ = l.at(0);break; |
110 | case 1: given_ = l.at(1);break; | 112 | case 1: given_ = l.at(1);break; |
111 | case 2: middle_ = l.at(2);break; | 113 | case 2: middle_ = l.at(2);break; |
112 | case 3: prefix_ = l.at(3);break; | 114 | case 3: prefix_ = l.at(3);break; |
113 | case 4: suffix_ = l.at(4);break; | 115 | case 4: suffix_ = l.at(4);break; |
114 | default: break; | 116 | default: break; |
115 | } | 117 | } |
116 | } | 118 | } |
117 | } | 119 | } |
118 | 120 | ||
119 | void | 121 | void |
120 | NValue::_assemble() | 122 | NValue::_assemble() |
121 | { | 123 | { |
122 | strRep_ = family_; | 124 | strRep_ = family_; |
123 | strRep_ += ";" +given_; | 125 | strRep_ += ";" +given_; |
124 | strRep_ += ";" +middle_; | 126 | strRep_ += ";" +middle_; |
125 | strRep_ += ";" +prefix_; | 127 | strRep_ += ";" +prefix_; |
126 | strRep_ += ";" +suffix_; | 128 | strRep_ += ";" +suffix_; |
127 | } | 129 | } |
128 | 130 | ||