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