author | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
commit | b9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff) | |
tree | 2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /kabc/vcard/EmailParam.cpp | |
download | kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2 |
Initial revision
-rw-r--r-- | kabc/vcard/EmailParam.cpp | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/kabc/vcard/EmailParam.cpp b/kabc/vcard/EmailParam.cpp new file mode 100644 index 0000000..8c87477 --- a/dev/null +++ b/kabc/vcard/EmailParam.cpp | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | libvcard - vCard parsing library for vCard version 3.0 | ||
3 | |||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | ||
5 | |||
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 | ||
8 | deal in the Software without restriction, including without limitation the | ||
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 | ||
11 | furnished to do so, subject to the following conditions: | ||
12 | |||
13 | The above copyright notice and this permission notice shall be included in | ||
14 | all copies or substantial portions of the Software. | ||
15 | |||
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, | ||
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 | ||
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. | ||
22 | */ | ||
23 | |||
24 | #include <VCardEmailParam.h> | ||
25 | #include <VCardParam.h> | ||
26 | #include <VCardDefines.h> | ||
27 | |||
28 | using namespace VCARD; | ||
29 | |||
30 | EmailParam::EmailParam() | ||
31 | :Param() | ||
32 | { | ||
33 | vDebug("ctor"); | ||
34 | } | ||
35 | |||
36 | EmailParam::EmailParam(const EmailParam & x) | ||
37 | :Param(x), | ||
38 | emailType_(x.emailType_), | ||
39 | pref_ (x.pref_) | ||
40 | { | ||
41 | } | ||
42 | |||
43 | EmailParam::EmailParam(const QCString & s) | ||
44 | :Param(s) | ||
45 | { | ||
46 | } | ||
47 | |||
48 | EmailParam & | ||
49 | EmailParam::operator = (EmailParam & x) | ||
50 | { | ||
51 | if (*this == x) return *this; | ||
52 | |||
53 | emailType_= x.emailType(); | ||
54 | pref_ = x.pref_; | ||
55 | |||
56 | Param::operator = (x); | ||
57 | return *this; | ||
58 | } | ||
59 | |||
60 | EmailParam & | ||
61 | EmailParam::operator = (const QCString & s) | ||
62 | { | ||
63 | Param::operator = (s); | ||
64 | return *this; | ||
65 | } | ||
66 | |||
67 | bool | ||
68 | EmailParam::operator == (EmailParam & x) | ||
69 | { | ||
70 | parse(); | ||
71 | |||
72 | if (pref_) | ||
73 | return (x.pref_ && x.emailType() == emailType_); | ||
74 | |||
75 | return !x.pref(); | ||
76 | } | ||
77 | |||
78 | EmailParam::~EmailParam() | ||
79 | { | ||
80 | } | ||
81 | |||
82 | void | ||
83 | EmailParam::_parse() | ||
84 | { | ||
85 | #if 0 | ||
86 | Param::parseToList(); | ||
87 | |||
88 | SubParamListIterator it(subParamList_); | ||
89 | |||
90 | pref_ = true; | ||
91 | emailType_ = ""; | ||
92 | |||
93 | for (; it.current(); ++it) { | ||
94 | |||
95 | if (qstricmp(it.current()->name(), "TYPE") == 0) { | ||
96 | emailType_ = it.current()->value(); | ||
97 | continue; | ||
98 | } | ||
99 | |||
100 | if (qstricmp(it.current()->name(), "PREF") == 0) { | ||
101 | pref_ = true; | ||
102 | } | ||
103 | } | ||
104 | #endif | ||
105 | } | ||
106 | |||
107 | void | ||
108 | EmailParam::_assemble() | ||
109 | { | ||
110 | strRep_ = "TYPE="; | ||
111 | strRep_ += emailType_; | ||
112 | |||
113 | if (pref_) | ||
114 | strRep_ += ",PREF"; | ||
115 | } | ||
116 | |||