williamr@2
|
1 |
/// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
/// All rights reserved.
|
williamr@2
|
3 |
/// This component and the accompanying materials are made available
|
williamr@2
|
4 |
/// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
5 |
/// which accompanies this distribution, and is available
|
williamr@2
|
6 |
/// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
///
|
williamr@2
|
8 |
/// Initial Contributors:
|
williamr@2
|
9 |
/// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
///
|
williamr@2
|
11 |
/// Contributors:
|
williamr@2
|
12 |
///
|
williamr@2
|
13 |
/// Description:
|
williamr@2
|
14 |
/// All rights reserved.
|
williamr@2
|
15 |
/// This component and the accompanying materials are made available
|
williamr@2
|
16 |
/// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
17 |
/// which accompanies this distribution, and is available
|
williamr@2
|
18 |
/// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
19 |
/// Initial Contributors:
|
williamr@2
|
20 |
/// Nokia Corporation - initial contribution.
|
williamr@2
|
21 |
/// Contributors:
|
williamr@2
|
22 |
///
|
williamr@2
|
23 |
|
williamr@2
|
24 |
_LIT(KWapBaseNodePanic,"Node-Panic");
|
williamr@2
|
25 |
|
williamr@2
|
26 |
#ifndef __WAP_MONOLITHIC__
|
williamr@2
|
27 |
|
williamr@2
|
28 |
void Panic(TNodePanic aPanic)
|
williamr@2
|
29 |
//
|
williamr@2
|
30 |
// Panic the client program.
|
williamr@2
|
31 |
//
|
williamr@2
|
32 |
{
|
williamr@2
|
33 |
User::Panic(KWapBaseNodePanic,aPanic);
|
williamr@2
|
34 |
}
|
williamr@2
|
35 |
#endif
|
williamr@2
|
36 |
|
williamr@2
|
37 |
//
|
williamr@2
|
38 |
// INLINED Node implementation
|
williamr@2
|
39 |
// for description of templated api's see CNODE.H
|
williamr@2
|
40 |
//
|
williamr@2
|
41 |
|
williamr@2
|
42 |
//CTOR of non-deletable data
|
williamr@2
|
43 |
/** Constructor.
|
williamr@2
|
44 |
|
williamr@2
|
45 |
@param aData Buffer to wrap
|
williamr@2
|
46 |
*/
|
williamr@2
|
47 |
inline CDataNoDelete::CDataNoDelete(HBufC16* aData)
|
williamr@2
|
48 |
: iData(aData)
|
williamr@2
|
49 |
{
|
williamr@2
|
50 |
}
|
williamr@2
|
51 |
|
williamr@2
|
52 |
//DTOR doesn't delete the data member
|
williamr@2
|
53 |
/** Destructor.
|
williamr@2
|
54 |
|
williamr@2
|
55 |
The wrapped buffer is not deleted.
|
williamr@2
|
56 |
*/
|
williamr@2
|
57 |
inline CDataNoDelete::~CDataNoDelete()
|
williamr@2
|
58 |
{
|
williamr@2
|
59 |
}
|
williamr@2
|
60 |
|
williamr@2
|
61 |
//Accessor method to set the iData pointer to the parameter passed in
|
williamr@2
|
62 |
//Ownership is taken here
|
williamr@2
|
63 |
// Returns the previous value
|
williamr@2
|
64 |
/** Changes the buffer that is wrapped.
|
williamr@2
|
65 |
|
williamr@2
|
66 |
@return The previous wrapped buffer
|
williamr@2
|
67 |
@param aData Buffer to wrap
|
williamr@2
|
68 |
*/
|
williamr@2
|
69 |
inline HBufC16* CDataNoDelete::SetData(HBufC16* aData)
|
williamr@2
|
70 |
{
|
williamr@2
|
71 |
HBufC16* prevVal = iData;
|
williamr@2
|
72 |
iData = aData;
|
williamr@2
|
73 |
return prevVal;
|
williamr@2
|
74 |
}
|
williamr@2
|
75 |
|
williamr@2
|
76 |
//Resets data pointer to point to aData, data is not deleted
|
williamr@2
|
77 |
/** Sets the buffer that is wrapped.
|
williamr@2
|
78 |
|
williamr@2
|
79 |
The existing value is forgotten.
|
williamr@2
|
80 |
|
williamr@2
|
81 |
@param aData Buffer to wrap
|
williamr@2
|
82 |
*/
|
williamr@2
|
83 |
inline void CDataNoDelete::ResetDataPointer(HBufC16 *aData)
|
williamr@2
|
84 |
{
|
williamr@2
|
85 |
iData = aData;
|
williamr@2
|
86 |
}
|
williamr@2
|
87 |
|
williamr@2
|
88 |
//Accessor method to get the data
|
williamr@2
|
89 |
/** Gets the wrapped buffer.
|
williamr@2
|
90 |
|
williamr@2
|
91 |
@return The wrapped buffer
|
williamr@2
|
92 |
*/
|
williamr@2
|
93 |
inline HBufC16* CDataNoDelete::Data()
|
williamr@2
|
94 |
{
|
williamr@2
|
95 |
return iData;
|
williamr@2
|
96 |
}
|
williamr@2
|
97 |
|
williamr@2
|
98 |
//CTOR of deletable data
|
williamr@2
|
99 |
/** Constructor.
|
williamr@2
|
100 |
|
williamr@2
|
101 |
@param aData Buffer to wrap
|
williamr@2
|
102 |
*/
|
williamr@2
|
103 |
inline CDataDelete::CDataDelete(HBufC16* aData)
|
williamr@2
|
104 |
: CDataNoDelete(aData)
|
williamr@2
|
105 |
{
|
williamr@2
|
106 |
}
|
williamr@2
|
107 |
|
williamr@2
|
108 |
//DTOR of deletable data...DELETES THE DATA
|
williamr@2
|
109 |
/** Destructor.
|
williamr@2
|
110 |
|
williamr@2
|
111 |
The wrapped buffer is deleted.
|
williamr@2
|
112 |
*/
|
williamr@2
|
113 |
inline CDataDelete::~CDataDelete()
|
williamr@2
|
114 |
{
|
williamr@2
|
115 |
delete iData;
|
williamr@2
|
116 |
}
|
williamr@2
|
117 |
|
williamr@2
|
118 |
/** Sets the buffer that is wrapped.
|
williamr@2
|
119 |
|
williamr@2
|
120 |
The existing value is deleted.
|
williamr@2
|
121 |
|
williamr@2
|
122 |
@param aData Buffer to wrap
|
williamr@2
|
123 |
*/
|
williamr@2
|
124 |
inline void CDataDelete::ResetDataPointer(HBufC16* aData)
|
williamr@2
|
125 |
{
|
williamr@2
|
126 |
delete iData;
|
williamr@2
|
127 |
iData = aData;
|
williamr@2
|
128 |
}
|
williamr@2
|
129 |
|
williamr@2
|
130 |
//CTOR of deletable file data
|
williamr@2
|
131 |
/** Constructor.
|
williamr@2
|
132 |
|
williamr@2
|
133 |
@param aData Buffer to wrap
|
williamr@2
|
134 |
*/
|
williamr@2
|
135 |
inline CFileDataDelete::CFileDataDelete(HBufC16* aData)
|
williamr@2
|
136 |
: CDataNoDelete(aData)
|
williamr@2
|
137 |
{
|
williamr@2
|
138 |
}
|
williamr@2
|
139 |
|
williamr@2
|
140 |
// DTOR of deletable file data...
|
williamr@2
|
141 |
// DELETES THE DATA AFTER REMOVING THE REFERENCED FILE
|
williamr@2
|
142 |
/** Destructor.
|
williamr@2
|
143 |
|
williamr@2
|
144 |
It deletes the filename buffer and the file itself.
|
williamr@2
|
145 |
*/
|
williamr@2
|
146 |
inline CFileDataDelete::~CFileDataDelete()
|
williamr@2
|
147 |
{
|
williamr@2
|
148 |
RemoveFile();
|
williamr@2
|
149 |
delete iData;
|
williamr@2
|
150 |
}
|
williamr@2
|
151 |
|
williamr@2
|
152 |
/** Sets the filename that is wrapped.
|
williamr@2
|
153 |
|
williamr@2
|
154 |
The existing filename buffer and the file itself are deleted.
|
williamr@2
|
155 |
|
williamr@2
|
156 |
@param aData Buffer to wrap
|
williamr@2
|
157 |
*/
|
williamr@2
|
158 |
inline void CFileDataDelete::ResetDataPointer(HBufC16* aData)
|
williamr@2
|
159 |
{
|
williamr@2
|
160 |
RemoveFile();
|
williamr@2
|
161 |
delete iData;
|
williamr@2
|
162 |
iData = aData;
|
williamr@2
|
163 |
}
|
williamr@2
|
164 |
|
williamr@2
|
165 |
inline void CFileDataDelete::RemoveFile()
|
williamr@2
|
166 |
{
|
williamr@2
|
167 |
// When this panics
|
williamr@2
|
168 |
// Someone somewhere has incorrectly reset this node's data
|
williamr@2
|
169 |
__ASSERT_DEBUG(iData,Panic(ENoData));
|
williamr@2
|
170 |
RFs fs;
|
williamr@2
|
171 |
// If connect fails we can sadly do nothing to remove the file
|
williamr@2
|
172 |
// it will be left lying around :-<
|
williamr@2
|
173 |
if(fs.Connect() == KErrNone)
|
williamr@2
|
174 |
{
|
williamr@2
|
175 |
fs.Delete(iData->Des());
|
williamr@2
|
176 |
fs.Close();
|
williamr@2
|
177 |
}
|
williamr@2
|
178 |
}
|
williamr@2
|
179 |
|
williamr@2
|
180 |
//CTOR of wrapper for integer attributes
|
williamr@2
|
181 |
/** Constructor.
|
williamr@2
|
182 |
|
williamr@2
|
183 |
@param aInteger Integer to wrap
|
williamr@2
|
184 |
*/
|
williamr@2
|
185 |
inline CIntAttribute::CIntAttribute(TInt aInteger)
|
williamr@2
|
186 |
: iInteger(aInteger)
|
williamr@2
|
187 |
{
|
williamr@2
|
188 |
}
|
williamr@2
|
189 |
|
williamr@2
|
190 |
//Accessor method
|
williamr@2
|
191 |
/** Gets the wrapped integer.
|
williamr@2
|
192 |
|
williamr@2
|
193 |
@return The wrapped integer
|
williamr@2
|
194 |
*/
|
williamr@2
|
195 |
inline TInt CIntAttribute::Int() const
|
williamr@2
|
196 |
{
|
williamr@2
|
197 |
return iInteger;
|
williamr@2
|
198 |
}
|
williamr@2
|
199 |
|
williamr@2
|
200 |
|
williamr@2
|
201 |
//
|
williamr@2
|
202 |
//
|
williamr@2
|
203 |
//TEMPLATED FUNCTIONS SEE CNODE.H FOR DESCRIPTIONS OF API'S
|
williamr@2
|
204 |
//
|
williamr@2
|
205 |
//
|
williamr@2
|
206 |
/** Allocates and constructs a new node.
|
williamr@2
|
207 |
|
williamr@2
|
208 |
@return New node
|
williamr@2
|
209 |
@param aType The type of the node
|
williamr@2
|
210 |
@param aParent The parent of this node
|
williamr@2
|
211 |
*/
|
williamr@2
|
212 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
213 |
inline CTypedNode<TNodeType, TAttributeType>* CTypedNode<TNodeType, TAttributeType>::NewL(TNodeType aType, CNode* aParent)
|
williamr@2
|
214 |
{
|
williamr@2
|
215 |
return (STATIC_CAST(CTypedNode*,CNode::NewL(CONST_CAST(TAny*,REINTERPRET_CAST(const TAny*,aType)),aParent)));
|
williamr@2
|
216 |
}
|
williamr@2
|
217 |
|
williamr@2
|
218 |
|
williamr@2
|
219 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
220 |
inline CTypedNode<TNodeType, TAttributeType>::CTypedNode(TNodeType aType, CNode* aParent)
|
williamr@2
|
221 |
: CNode(CONST_CAST(TAny*,REINTERPRET_CAST(const TAny*,aType)),aParent)
|
williamr@2
|
222 |
{}
|
williamr@2
|
223 |
|
williamr@2
|
224 |
/** Deletes a specified child node.
|
williamr@2
|
225 |
|
williamr@2
|
226 |
@param aNode Node to delete
|
williamr@2
|
227 |
*/
|
williamr@2
|
228 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
229 |
inline void CTypedNode<TNodeType, TAttributeType>::DeleteChildNode(CNode* aNode)
|
williamr@2
|
230 |
{
|
williamr@2
|
231 |
CNode::DeleteChildNode(aNode);
|
williamr@2
|
232 |
}
|
williamr@2
|
233 |
|
williamr@2
|
234 |
/** Deletes all the child nodes of this node.
|
williamr@2
|
235 |
*/
|
williamr@2
|
236 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
237 |
inline void CTypedNode<TNodeType, TAttributeType>::DeleteAllChildNodes()
|
williamr@2
|
238 |
{
|
williamr@2
|
239 |
CNode::DeleteAllChildNodes();
|
williamr@2
|
240 |
}
|
williamr@2
|
241 |
|
williamr@2
|
242 |
/** Creates a new child node.
|
williamr@2
|
243 |
|
williamr@2
|
244 |
@return The new child node
|
williamr@2
|
245 |
@param aType Node type
|
williamr@2
|
246 |
*/
|
williamr@2
|
247 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
248 |
inline CTypedNode<TNodeType, TAttributeType>& CTypedNode<TNodeType, TAttributeType>::AppendNodeL(TNodeType aType)
|
williamr@2
|
249 |
{
|
williamr@2
|
250 |
return (STATIC_CAST(CTypedNode& , CNode::AppendNodeL(CONST_CAST(TAny*,REINTERPRET_CAST(TAny*,aType)))));
|
williamr@2
|
251 |
}
|
williamr@2
|
252 |
|
williamr@2
|
253 |
/** Adds an existing node as a child.
|
williamr@2
|
254 |
|
williamr@2
|
255 |
@param aNode Node to make a child
|
williamr@2
|
256 |
*/
|
williamr@2
|
257 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
258 |
inline void CTypedNode<TNodeType, TAttributeType>::AppendNodeToThisNodeL(CNode* aNode)
|
williamr@2
|
259 |
{
|
williamr@2
|
260 |
CNode::AppendNodeToThisNodeL(aNode);
|
williamr@2
|
261 |
}
|
williamr@2
|
262 |
|
williamr@2
|
263 |
/** Gets the first child or the next child after a specified child.
|
williamr@2
|
264 |
|
williamr@2
|
265 |
@return First or next child node
|
williamr@2
|
266 |
@param aNode Child node or NULL to get the first child
|
williamr@2
|
267 |
*/
|
williamr@2
|
268 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
269 |
inline CTypedNode<TNodeType, TAttributeType>* CTypedNode<TNodeType, TAttributeType>::NextChild(const CNode* aNode) const
|
williamr@2
|
270 |
{
|
williamr@2
|
271 |
return (STATIC_CAST(CTypedNode*,CNode::NextChild(aNode)));
|
williamr@2
|
272 |
}
|
williamr@2
|
273 |
|
williamr@2
|
274 |
/** Gets the previous child before a specified child.
|
williamr@2
|
275 |
|
williamr@2
|
276 |
@return Previous child node
|
williamr@2
|
277 |
@param aNode Child node
|
williamr@2
|
278 |
*/
|
williamr@2
|
279 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
280 |
inline CTypedNode<TNodeType, TAttributeType>* CTypedNode<TNodeType, TAttributeType>::PrevChild(const CNode& aNode) const
|
williamr@2
|
281 |
{
|
williamr@2
|
282 |
return (STATIC_CAST(CTypedNode*,CNode::PrevChild(aNode)));
|
williamr@2
|
283 |
}
|
williamr@2
|
284 |
|
williamr@2
|
285 |
/** Gets the parent of this node.
|
williamr@2
|
286 |
|
williamr@2
|
287 |
@return Parent
|
williamr@2
|
288 |
*/
|
williamr@2
|
289 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
290 |
inline CTypedNode<TNodeType, TAttributeType>* CTypedNode<TNodeType, TAttributeType>::Parent() const
|
williamr@2
|
291 |
{
|
williamr@2
|
292 |
return (STATIC_CAST(CTypedNode*,CNode::Parent()));
|
williamr@2
|
293 |
}
|
williamr@2
|
294 |
|
williamr@2
|
295 |
/** Changes the parent of the node.
|
williamr@2
|
296 |
|
williamr@2
|
297 |
The node is removed from the childlist of its current parent.
|
williamr@2
|
298 |
|
williamr@2
|
299 |
@param aParent New parent
|
williamr@2
|
300 |
*/
|
williamr@2
|
301 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
302 |
inline void CTypedNode<TNodeType, TAttributeType>::ReparentL(CNode* aParent)
|
williamr@2
|
303 |
{
|
williamr@2
|
304 |
CNode::ReparentL(aParent);
|
williamr@2
|
305 |
}
|
williamr@2
|
306 |
|
williamr@2
|
307 |
/** Gets the next sibling node.
|
williamr@2
|
308 |
|
williamr@2
|
309 |
This asks for the next child of its parent.
|
williamr@2
|
310 |
|
williamr@2
|
311 |
@return Next sibling node
|
williamr@2
|
312 |
*/
|
williamr@2
|
313 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
314 |
inline CTypedNode<TNodeType, TAttributeType>* CTypedNode<TNodeType, TAttributeType>::NextSibling() const
|
williamr@2
|
315 |
{
|
williamr@2
|
316 |
return (STATIC_CAST(CTypedNode*,CNode::NextSibling()));
|
williamr@2
|
317 |
}
|
williamr@2
|
318 |
|
williamr@2
|
319 |
/** Gets the previous sibling node.
|
williamr@2
|
320 |
|
williamr@2
|
321 |
This asks for the previous child of its parent.
|
williamr@2
|
322 |
|
williamr@2
|
323 |
@return Previous sibling node
|
williamr@2
|
324 |
*/
|
williamr@2
|
325 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
326 |
inline CTypedNode<TNodeType, TAttributeType>* CTypedNode<TNodeType, TAttributeType>::PrevSibling() const
|
williamr@2
|
327 |
{
|
williamr@2
|
328 |
return (STATIC_CAST(CTypedNode*,CNode::PrevSibling()));
|
williamr@2
|
329 |
}
|
williamr@2
|
330 |
|
williamr@2
|
331 |
/** Gets the number of children of this node.
|
williamr@2
|
332 |
|
williamr@2
|
333 |
@return Number of children of this node
|
williamr@2
|
334 |
*/
|
williamr@2
|
335 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
336 |
inline TInt CTypedNode<TNodeType, TAttributeType>::NumberImmediateChildren() const
|
williamr@2
|
337 |
{
|
williamr@2
|
338 |
return (CNode::NumberImmediateChildren());
|
williamr@2
|
339 |
}
|
williamr@2
|
340 |
|
williamr@2
|
341 |
/** Gets the absolute root node of the tree.
|
williamr@2
|
342 |
|
williamr@2
|
343 |
@return Root node
|
williamr@2
|
344 |
*/
|
williamr@2
|
345 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
346 |
inline const CTypedNode<TNodeType, TAttributeType>& CTypedNode<TNodeType, TAttributeType>::Root() const
|
williamr@2
|
347 |
{
|
williamr@2
|
348 |
return (STATIC_CAST(const CTypedNode&,CNode::Root()));
|
williamr@2
|
349 |
}
|
williamr@2
|
350 |
|
williamr@2
|
351 |
/** Sets the node data.
|
williamr@2
|
352 |
|
williamr@2
|
353 |
The object will delete the data in its destructor.
|
williamr@2
|
354 |
|
williamr@2
|
355 |
@param aData Node data
|
williamr@2
|
356 |
*/
|
williamr@2
|
357 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
358 |
inline void CTypedNode<TNodeType, TAttributeType>::SetDataL(HBufC16 *aData)
|
williamr@2
|
359 |
{
|
williamr@2
|
360 |
CNode::SetDataL(aData);
|
williamr@2
|
361 |
}
|
williamr@2
|
362 |
|
williamr@2
|
363 |
/** Sets the object not to delete the node data in its destructor.
|
williamr@2
|
364 |
|
williamr@2
|
365 |
Note that the function internally reallocates memory. If it leaves, the data is lost.
|
williamr@2
|
366 |
*/
|
williamr@2
|
367 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
368 |
inline void CTypedNode<TNodeType, TAttributeType>::SetDataNoDeleteL()
|
williamr@2
|
369 |
{
|
williamr@2
|
370 |
CNode::SetDataNoDeleteL();
|
williamr@2
|
371 |
}
|
williamr@2
|
372 |
|
williamr@2
|
373 |
/** Sets the object to delete the node data in its destructor.
|
williamr@2
|
374 |
|
williamr@2
|
375 |
Note that the function internally reallocates memory. If it leaves, the data is lost. */
|
williamr@2
|
376 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
377 |
inline void CTypedNode<TNodeType, TAttributeType>::ClearSetDataNoDeleteL()
|
williamr@2
|
378 |
{
|
williamr@2
|
379 |
CNode::ClearSetDataNoDeleteL();
|
williamr@2
|
380 |
}
|
williamr@2
|
381 |
|
williamr@2
|
382 |
/** Sets the node data to be taken from a specified file.
|
williamr@2
|
383 |
|
williamr@2
|
384 |
If the data is deleted, the referenced file is also deleted.
|
williamr@2
|
385 |
|
williamr@2
|
386 |
@param aData Name of the file containing the data
|
williamr@2
|
387 |
*/
|
williamr@2
|
388 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
389 |
inline void CTypedNode<TNodeType, TAttributeType>::SetFileDataL(HBufC16 *aData)
|
williamr@2
|
390 |
{
|
williamr@2
|
391 |
CNode::SetFileDataL(aData);
|
williamr@2
|
392 |
}
|
williamr@2
|
393 |
|
williamr@2
|
394 |
/** Resets the node data to a specified pointer.
|
williamr@2
|
395 |
|
williamr@2
|
396 |
Existing data owned by the node is deleted.
|
williamr@2
|
397 |
|
williamr@2
|
398 |
@param aData Root node
|
williamr@2
|
399 |
*/
|
williamr@2
|
400 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
401 |
inline void CTypedNode<TNodeType, TAttributeType>::ResetDataPointer(HBufC16* aData)
|
williamr@2
|
402 |
{
|
williamr@2
|
403 |
CNode::ResetDataPointer(aData);
|
williamr@2
|
404 |
}
|
williamr@2
|
405 |
|
williamr@2
|
406 |
/** Gets the node data.
|
williamr@2
|
407 |
|
williamr@2
|
408 |
@return Node data or NULL if no data is set
|
williamr@2
|
409 |
*/
|
williamr@2
|
410 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
411 |
inline HBufC16* CTypedNode<TNodeType, TAttributeType>::Data() const
|
williamr@2
|
412 |
{
|
williamr@2
|
413 |
return (CNode::Data());
|
williamr@2
|
414 |
}
|
williamr@2
|
415 |
|
williamr@2
|
416 |
/** Deletes an attribute of a specified type.
|
williamr@2
|
417 |
|
williamr@2
|
418 |
Note that the attribute value will be deleted.
|
williamr@2
|
419 |
|
williamr@2
|
420 |
@param aAttributeType Attribute type
|
williamr@2
|
421 |
*/
|
williamr@2
|
422 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
423 |
inline void CTypedNode<TNodeType, TAttributeType>::DeleteAttribute(TAttributeType aAttributeType)
|
williamr@2
|
424 |
{
|
williamr@2
|
425 |
CNode::DeleteAttribute(CONST_CAST(TAny*, REINTERPRET_CAST(const TAny*,aAttributeType)));
|
williamr@2
|
426 |
}
|
williamr@2
|
427 |
|
williamr@2
|
428 |
/** Delete all node attributes.
|
williamr@2
|
429 |
|
williamr@2
|
430 |
Note that attribute values will be deleted.
|
williamr@2
|
431 |
*/
|
williamr@2
|
432 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
433 |
inline void CTypedNode<TNodeType, TAttributeType>::DeleteAllAttributes()
|
williamr@2
|
434 |
{
|
williamr@2
|
435 |
CNode::DeleteAllAttributes();
|
williamr@2
|
436 |
}
|
williamr@2
|
437 |
|
williamr@2
|
438 |
/** Removes an attribute of a specified type, but does not delete it.
|
williamr@2
|
439 |
|
williamr@2
|
440 |
The caller is now responsible for the destruction of the attribute value.
|
williamr@2
|
441 |
|
williamr@2
|
442 |
@param aAttributeType Attribute type
|
williamr@2
|
443 |
*/
|
williamr@2
|
444 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
445 |
inline void CTypedNode<TNodeType, TAttributeType>::RemoveAttributeNoDelete(TAttributeType aAttributeType)
|
williamr@2
|
446 |
{
|
williamr@2
|
447 |
CNode::RemoveAttributeNoDelete(CONST_CAST(TAny*,REINTERPRET_CAST(const TAny*,aAttributeType)));
|
williamr@2
|
448 |
}
|
williamr@2
|
449 |
|
williamr@2
|
450 |
/** Gets the number of attributes of this node.
|
williamr@2
|
451 |
|
williamr@2
|
452 |
@return Number of attributes of this node
|
williamr@2
|
453 |
*/
|
williamr@2
|
454 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
455 |
inline TInt CTypedNode<TNodeType, TAttributeType>::AttributeCount() const
|
williamr@2
|
456 |
{
|
williamr@2
|
457 |
return(CNode::AttributeCount());
|
williamr@2
|
458 |
}
|
williamr@2
|
459 |
|
williamr@2
|
460 |
/** Gets the attribute value of an attribute at a specified index
|
williamr@2
|
461 |
|
williamr@2
|
462 |
@return Attribute value
|
williamr@2
|
463 |
@param aIndex Attribute index
|
williamr@2
|
464 |
*/
|
williamr@2
|
465 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
466 |
inline TAttributeType CTypedNode<TNodeType, TAttributeType>::AttributeTypeByIndex(TInt aIndex) const
|
williamr@2
|
467 |
{
|
williamr@2
|
468 |
return(REINTERPRET_CAST(TAttributeType, CNode::AttributeTypeByIndex(aIndex)));
|
williamr@2
|
469 |
}
|
williamr@2
|
470 |
|
williamr@2
|
471 |
/** Gets the attribute value of an attribute at a specified index
|
williamr@2
|
472 |
|
williamr@2
|
473 |
@return Attribute value
|
williamr@2
|
474 |
@param aIndex Attribute index
|
williamr@2
|
475 |
*/
|
williamr@2
|
476 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
477 |
inline CBase* CTypedNode<TNodeType, TAttributeType>::AttributeByIndex(TInt aIndex) const
|
williamr@2
|
478 |
{
|
williamr@2
|
479 |
return(CNode::AttributeByIndex(aIndex));
|
williamr@2
|
480 |
}
|
williamr@2
|
481 |
|
williamr@2
|
482 |
/** Gets the attribute value and type of an attribute at a specified index..
|
williamr@2
|
483 |
|
williamr@2
|
484 |
@return Attribute value
|
williamr@2
|
485 |
@param aIndex Attribute index
|
williamr@2
|
486 |
@param aType On return, the attribute type
|
williamr@2
|
487 |
*/
|
williamr@2
|
488 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
489 |
inline CBase* CTypedNode<TNodeType, TAttributeType>::AttributeByIndex(TInt aIndex,TAttributeType& aType) const
|
williamr@2
|
490 |
{
|
williamr@2
|
491 |
TAny* type;
|
williamr@2
|
492 |
CBase* ret=CNode::AttributeByIndex(aIndex,type);
|
williamr@2
|
493 |
aType=REINTERPRET_CAST(TAttributeType, type);
|
williamr@2
|
494 |
return ret;
|
williamr@2
|
495 |
}
|
williamr@2
|
496 |
|
williamr@2
|
497 |
/** Adds an attribute.
|
williamr@2
|
498 |
|
williamr@2
|
499 |
The node takes ownership of aAttributeValue.
|
williamr@2
|
500 |
|
williamr@2
|
501 |
@param aAttributeType Attribute type
|
williamr@2
|
502 |
@param aAttributeValue Attribute value
|
williamr@2
|
503 |
*/
|
williamr@2
|
504 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
505 |
inline void CTypedNode<TNodeType, TAttributeType>::AddAttributeL(TAttributeType aAttributeType, CBase* aAttributeValue)
|
williamr@2
|
506 |
{
|
williamr@2
|
507 |
CNode::AddAttributeL(CONST_CAST(TAny*, REINTERPRET_CAST(const TAny*,aAttributeType)),aAttributeValue);
|
williamr@2
|
508 |
}
|
williamr@2
|
509 |
|
williamr@2
|
510 |
/** Sets node data and adds an attribute.
|
williamr@2
|
511 |
|
williamr@2
|
512 |
The node takes ownership of aDataand aAttributeValue.
|
williamr@2
|
513 |
Existing node data owned by the node is deleted.
|
williamr@2
|
514 |
|
williamr@2
|
515 |
@param aData Node data
|
williamr@2
|
516 |
@param aAttributeType Attribute type
|
williamr@2
|
517 |
@param aAttributeValue Attribute value
|
williamr@2
|
518 |
*/
|
williamr@2
|
519 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
520 |
inline void CTypedNode<TNodeType, TAttributeType>::AddDataAndAttributeL(HBufC16 *aData, TAttributeType aAttributeType, CBase* aAttributeValue)
|
williamr@2
|
521 |
{
|
williamr@2
|
522 |
CNode::AddDataAndAttributeL(aData,CONST_CAST(TAny*, REINTERPRET_CAST(const TAny*,aAttributeType)),aAttributeValue);
|
williamr@2
|
523 |
}
|
williamr@2
|
524 |
|
williamr@2
|
525 |
/** Gets a child node by index.
|
williamr@2
|
526 |
|
williamr@2
|
527 |
@return Child node
|
williamr@2
|
528 |
@param aByIndex Index of the child node
|
williamr@2
|
529 |
*/
|
williamr@2
|
530 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
531 |
inline CTypedNode<TNodeType, TAttributeType>* CTypedNode<TNodeType, TAttributeType>::Child(TInt aByIndex) const
|
williamr@2
|
532 |
{
|
williamr@2
|
533 |
return (REINTERPRET_CAST(CTypedNode*,CNode::Child(aByIndex)));
|
williamr@2
|
534 |
}
|
williamr@2
|
535 |
|
williamr@2
|
536 |
/** Gets an attribute value for a specified attribute type.
|
williamr@2
|
537 |
|
williamr@2
|
538 |
@return Attribute value
|
williamr@2
|
539 |
@param aAttributeType Attribute type
|
williamr@2
|
540 |
*/
|
williamr@2
|
541 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
542 |
inline CBase* CTypedNode<TNodeType, TAttributeType>::Attribute(TAttributeType aAttributeType) const
|
williamr@2
|
543 |
{
|
williamr@2
|
544 |
return (CNode::Attribute(CONST_CAST(TAny*, REINTERPRET_CAST(const TAny*,aAttributeType))));
|
williamr@2
|
545 |
}
|
williamr@2
|
546 |
|
williamr@2
|
547 |
/** Tests if an attribute of a specified type exists.
|
williamr@2
|
548 |
|
williamr@2
|
549 |
@return True if the attribute exists, otherwise false
|
williamr@2
|
550 |
@param aAttributeType Attribute type
|
williamr@2
|
551 |
*/
|
williamr@2
|
552 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
553 |
inline TBool CTypedNode<TNodeType, TAttributeType>::AttributeExists(TAttributeType aAttributeType) const
|
williamr@2
|
554 |
{
|
williamr@2
|
555 |
return (CNode::AttributeExists(CONST_CAST(TAny*, REINTERPRET_CAST(const TAny*,aAttributeType))));
|
williamr@2
|
556 |
}
|
williamr@2
|
557 |
|
williamr@2
|
558 |
/** Gets the node type.
|
williamr@2
|
559 |
|
williamr@2
|
560 |
@return Node type
|
williamr@2
|
561 |
*/
|
williamr@2
|
562 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
563 |
inline TNodeType CTypedNode<TNodeType, TAttributeType>::Type() const
|
williamr@2
|
564 |
{
|
williamr@2
|
565 |
return (REINTERPRET_CAST(TNodeType,CNode::Type()));
|
williamr@2
|
566 |
}
|
williamr@2
|
567 |
|
williamr@2
|
568 |
/** Sets the node type.
|
williamr@2
|
569 |
|
williamr@2
|
570 |
@param aType Node type
|
williamr@2
|
571 |
*/
|
williamr@2
|
572 |
template <class TNodeType, class TAttributeType>
|
williamr@2
|
573 |
inline void CTypedNode<TNodeType, TAttributeType>::SetType(TNodeType aType)
|
williamr@2
|
574 |
{
|
williamr@2
|
575 |
CNode::SetType(CONST_CAST(TAny*,REINTERPRET_CAST(const TAny* ,aType)));
|
williamr@2
|
576 |
}
|