|
1 /** @file |
|
2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: CUpnpPathElement |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "upnppathelement.h" |
|
21 |
|
22 |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS =============================== |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // CUpnpPathElement::CUpnpPathElement |
|
28 // C++ default constructor can NOT contain any code, that |
|
29 // might leave. |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 CUpnpPathElement::CUpnpPathElement() |
|
33 { |
|
34 } |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // CUpnpPathElement::ConstructL |
|
38 // Symbian 2nd phase constructor can leave. |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 void CUpnpPathElement::ConstructL() |
|
42 { |
|
43 } |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CUpnpPathElement::NewL |
|
47 // Two-phased constructor. |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 CUpnpPathElement* CUpnpPathElement::NewL() |
|
51 { |
|
52 CUpnpPathElement* self = new( ELeave ) CUpnpPathElement; |
|
53 |
|
54 CleanupStack::PushL( self ); |
|
55 self->ConstructL(); |
|
56 CleanupStack::Pop( self ); |
|
57 |
|
58 return self; |
|
59 } |
|
60 |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CUpnpPathElement::~CUpnpPathElement |
|
64 // Destructor |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 CUpnpPathElement::~CUpnpPathElement() |
|
68 { |
|
69 delete iParentId; |
|
70 delete iId; |
|
71 delete iName; |
|
72 delete iOriginalName; |
|
73 delete iImportURI; |
|
74 } |
|
75 |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CUpnpPathElement::SetParentIdL |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 void CUpnpPathElement::SetParentIdL(const TDesC8& aParentId) |
|
82 { |
|
83 |
|
84 delete iParentId; |
|
85 iParentId = NULL; |
|
86 |
|
87 iParentId = aParentId.AllocL(); |
|
88 |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CUpnpPathElement::SetIdL |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 void CUpnpPathElement::SetIdL(const TDesC8& aId) |
|
96 { |
|
97 |
|
98 delete iId; |
|
99 iId = NULL; |
|
100 |
|
101 iId = aId.AllocL(); |
|
102 } |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // CUpnpPathElement::SetNameL |
|
106 // ----------------------------------------------------------------------------- |
|
107 // |
|
108 void CUpnpPathElement::SetNameL(const TDesC8& aName) |
|
109 { |
|
110 delete iName; |
|
111 iName = NULL; |
|
112 |
|
113 iName = aName.AllocL(); |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CUpnpPathElement::SetImportURIL |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 void CUpnpPathElement::SetImportURIL(const TDesC8& aImportURI) |
|
121 { |
|
122 delete iImportURI; |
|
123 iImportURI = NULL; |
|
124 |
|
125 iImportURI = aImportURI.AllocL(); |
|
126 } |
|
127 // ----------------------------------------------------------------------------- |
|
128 // CUpnpPathElement::SetOriginalNameL |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 void CUpnpPathElement::SetOriginalNameL(const TDesC8& aOriginalName) |
|
132 { |
|
133 delete iOriginalName; |
|
134 iOriginalName = NULL; |
|
135 |
|
136 iOriginalName = aOriginalName.AllocL(); |
|
137 } |
|
138 // ----------------------------------------------------------------------------- |
|
139 // CUpnpPathElement::DeleteOriginalName |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 void CUpnpPathElement::DeleteOriginalName() |
|
143 { |
|
144 delete iOriginalName; |
|
145 iOriginalName = NULL; |
|
146 } |
|
147 // ----------------------------------------------------------------------------- |
|
148 // CUpnpPathElement::OriginalName |
|
149 // ----------------------------------------------------------------------------- |
|
150 // |
|
151 const TDesC8& CUpnpPathElement::OriginalName() const |
|
152 { |
|
153 if (iOriginalName) |
|
154 { |
|
155 return *iOriginalName; |
|
156 } |
|
157 else |
|
158 { |
|
159 return KNullDesC8; |
|
160 } |
|
161 } |
|
162 // ----------------------------------------------------------------------------- |
|
163 // CUpnpPathElement::ParentId |
|
164 // ----------------------------------------------------------------------------- |
|
165 // |
|
166 const TDesC8& CUpnpPathElement::ParentId() const |
|
167 { |
|
168 if (iParentId) |
|
169 { |
|
170 return *iParentId; |
|
171 } |
|
172 else |
|
173 { |
|
174 return KNullDesC8; |
|
175 } |
|
176 |
|
177 } |
|
178 |
|
179 // ----------------------------------------------------------------------------- |
|
180 // CUpnpPathElement::Id |
|
181 // ----------------------------------------------------------------------------- |
|
182 // |
|
183 const TDesC8& CUpnpPathElement::Id() const |
|
184 { |
|
185 if (iId) |
|
186 { |
|
187 return *iId; |
|
188 } |
|
189 else |
|
190 { |
|
191 return KNullDesC8; |
|
192 } |
|
193 } |
|
194 |
|
195 // ----------------------------------------------------------------------------- |
|
196 // CUpnpPathElement::Name |
|
197 // ----------------------------------------------------------------------------- |
|
198 // |
|
199 const TDesC8& CUpnpPathElement::Name() const |
|
200 { |
|
201 if (iName) |
|
202 { |
|
203 return *iName; |
|
204 } |
|
205 else |
|
206 { |
|
207 return KNullDesC8; |
|
208 } |
|
209 } |
|
210 |
|
211 // ----------------------------------------------------------------------------- |
|
212 // CUpnpPathElement::ImportURI |
|
213 // ----------------------------------------------------------------------------- |
|
214 // |
|
215 const TDesC8& CUpnpPathElement::ImportURI() const |
|
216 { |
|
217 if (iImportURI) |
|
218 { |
|
219 return *iImportURI; |
|
220 } |
|
221 else |
|
222 { |
|
223 return KNullDesC8; |
|
224 } |
|
225 } |
|
226 // ----------------------------------------------------------------------------- |
|
227 // CUpnpPathElement::MatchName |
|
228 // ----------------------------------------------------------------------------- |
|
229 // |
|
230 TBool CUpnpPathElement::MatchName(const CUpnpPathElement& aElement1, const CUpnpPathElement& aElement2) |
|
231 { |
|
232 return (aElement1.Name().Compare(aElement2.Name()) == 0) && |
|
233 (aElement1.ParentId().Compare(aElement2.ParentId()) == 0); |
|
234 } |
|
235 |
|
236 // ----------------------------------------------------------------------------- |
|
237 // CUpnpPathElement::MatchAll |
|
238 // ----------------------------------------------------------------------------- |
|
239 // |
|
240 TBool CUpnpPathElement::MatchAll(const CUpnpPathElement& aElement1, const CUpnpPathElement& aElement2) |
|
241 { |
|
242 return (aElement1.Name().Compare(aElement2.Name()) == 0) && |
|
243 (aElement1.ParentId().Compare(aElement2.ParentId()) == 0) && |
|
244 (aElement1.Id().Compare(aElement2.Id()) == 0); |
|
245 } |
|
246 |
|
247 // End of File |