summaryrefslogtreecommitdiffabout
path: root/kabc/vcard/URIValue.cpp
Unidiff
Diffstat (limited to 'kabc/vcard/URIValue.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/vcard/URIValue.cpp133
1 files changed, 133 insertions, 0 deletions
diff --git a/kabc/vcard/URIValue.cpp b/kabc/vcard/URIValue.cpp
new file mode 100644
index 0000000..c1d1022
--- a/dev/null
+++ b/kabc/vcard/URIValue.cpp
@@ -0,0 +1,133 @@
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 <VCardURIValue.h>
25
26#include <VCardValue.h>
27
28using namespace VCARD;
29
30URIValue::URIValue()
31 :Value()
32{
33}
34
35URIValue::URIValue(const QCString & scheme, const QCString & schemeSpecificPart)
36 :Value(),
37 scheme_ (scheme),
38 schemeSpecificPart_(schemeSpecificPart)
39{
40 parsed_ = true;
41}
42
43URIValue::URIValue(const URIValue & x)
44 : Value (x),
45 scheme_ (x.scheme_),
46 schemeSpecificPart_(x.schemeSpecificPart_)
47{
48}
49
50URIValue::URIValue(const QCString & s)
51 :Value(s)
52{
53}
54
55 URIValue &
56URIValue::operator = (URIValue & x)
57{
58 if (*this == x) return *this;
59
60 scheme_ = x.scheme_;
61 schemeSpecificPart_= x.schemeSpecificPart_;
62
63 Value::operator = (x);
64 return *this;
65}
66
67 URIValue &
68URIValue::operator = (const QCString & s)
69{
70 Value::operator = (s);
71 return *this;
72}
73
74 bool
75URIValue::operator == (URIValue & x)
76{
77 x.parse();
78 return (
79 (scheme_ == x.scheme_) &&
80 (schemeSpecificPart_== x.schemeSpecificPart_));
81
82 return false;
83}
84
85URIValue::~URIValue()
86{
87}
88
89 void
90URIValue::_parse()
91{
92 int split = strRep_.find(':');
93 if (split == -1)
94 return;
95
96 scheme_ = strRep_.left(split);
97 schemeSpecificPart_ = strRep_.mid(split + 1);
98}
99
100 void
101URIValue::_assemble()
102{
103 strRep_ = scheme_ + ':' + schemeSpecificPart_;
104}
105
106 QCString
107URIValue::scheme()
108{
109 parse();
110 return scheme_;
111}
112
113 QCString
114URIValue::schemeSpecificPart()
115{
116 parse();
117 return schemeSpecificPart_;
118}
119
120 void
121URIValue::setScheme(const QCString & s)
122{
123 parse();
124 scheme_ = s;
125}
126
127 void
128URIValue::setSchemeSpecificPart(const QCString & s)
129{
130 parse();
131 schemeSpecificPart_ = s;
132}
133