williamr@4
|
1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@4
|
2 |
// All rights reserved.
|
williamr@4
|
3 |
// This component and the accompanying materials are made available
|
williamr@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@4
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@4
|
7 |
//
|
williamr@4
|
8 |
// Initial Contributors:
|
williamr@4
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@4
|
10 |
//
|
williamr@4
|
11 |
// Contributors:
|
williamr@4
|
12 |
//
|
williamr@4
|
13 |
// Description:
|
williamr@4
|
14 |
// Node list class
|
williamr@4
|
15 |
//
|
williamr@2
|
16 |
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
/**
|
williamr@4
|
20 |
@file
|
williamr@4
|
21 |
@publishedAll
|
williamr@4
|
22 |
@released
|
williamr@4
|
23 |
*/
|
williamr@4
|
24 |
#ifndef XMLENGNODELIST_H
|
williamr@4
|
25 |
#define XMLENGNODELIST_H
|
williamr@4
|
26 |
|
williamr@4
|
27 |
#include <xml/dom/xmlengnode.h>
|
williamr@4
|
28 |
#include <xml/dom/xmlengnodelist_impl.h>
|
williamr@4
|
29 |
|
williamr@4
|
30 |
/**
|
williamr@4
|
31 |
Implements an iterator or filtered iterator for a tree.
|
williamr@4
|
32 |
|
williamr@4
|
33 |
This classes behaves in two very different ways, depending on the
|
williamr@4
|
34 |
template parameter.
|
williamr@4
|
35 |
|
williamr@4
|
36 |
1) RXmlEngNodeList<TXmlEngNode>
|
williamr@4
|
37 |
|
williamr@4
|
38 |
Through template specialization, this becomes an alias for RXmlEngNodeListImpl.
|
williamr@4
|
39 |
The RXmlEngNodeListImpl::OpenL() methods control which nodes are included in
|
williamr@4
|
40 |
the iterator. It is possible to iterate across all node types or only a single
|
williamr@4
|
41 |
type. It is possible to iterate only over nodes within a specific namespace.
|
williamr@4
|
42 |
It is also possible to iterate over nodes with the same name.
|
williamr@4
|
43 |
|
williamr@4
|
44 |
RXmlEngNodeListImpl should not be used directly.
|
williamr@4
|
45 |
|
williamr@4
|
46 |
@see RXmlEngNodeListImpl
|
williamr@4
|
47 |
|
williamr@4
|
48 |
2) RXmlEngNodeList<X> where X is not TXmlEngNode
|
williamr@4
|
49 |
|
williamr@4
|
50 |
As the OpenL() methods of this class are private, this class cannot be opened
|
williamr@4
|
51 |
except by friend classes TXmlEngNode and TXmlEngElement. As such, this form
|
williamr@4
|
52 |
should not be used.
|
williamr@4
|
53 |
*/
|
williamr@2
|
54 |
template<class T>
|
williamr@2
|
55 |
class RXmlEngNodeList
|
williamr@2
|
56 |
{
|
williamr@4
|
57 |
friend class TXmlEngNode;
|
williamr@4
|
58 |
friend class TXmlEngElement;
|
williamr@4
|
59 |
|
williamr@2
|
60 |
public:
|
williamr@2
|
61 |
/**
|
williamr@4
|
62 |
Gets the list length.
|
williamr@4
|
63 |
@return The number of nodes in the list
|
williamr@4
|
64 |
*/
|
williamr@2
|
65 |
inline TInt Count() const;
|
williamr@2
|
66 |
|
williamr@2
|
67 |
/**
|
williamr@4
|
68 |
Checks whether a next node exists in the list
|
williamr@4
|
69 |
@return ETrue of a next node exists, EFalse otherwise
|
williamr@4
|
70 |
*/
|
williamr@2
|
71 |
inline TBool HasNext() const;
|
williamr@2
|
72 |
|
williamr@2
|
73 |
/**
|
williamr@4
|
74 |
Gets the next node in the list
|
williamr@4
|
75 |
@return The next node casted to the templated type or NULL if it does not
|
williamr@4
|
76 |
exist
|
williamr@4
|
77 |
*/
|
williamr@2
|
78 |
inline T Next();
|
williamr@2
|
79 |
|
williamr@4
|
80 |
/**
|
williamr@4
|
81 |
Closes a node list. This does not affect any of the nodes. Only
|
williamr@4
|
82 |
internally used memory is freed.
|
williamr@4
|
83 |
*/
|
williamr@2
|
84 |
inline void Close();
|
williamr@2
|
85 |
|
williamr@2
|
86 |
private:
|
williamr@2
|
87 |
|
williamr@4
|
88 |
inline void OpenL(
|
williamr@2
|
89 |
void* aHead,
|
williamr@2
|
90 |
TXmlEngNode::TXmlEngDOMNodeType aType,
|
williamr@2
|
91 |
const TDesC8& aName = KNullDesC8,
|
williamr@2
|
92 |
const TDesC8& aNs = KNullDesC8);
|
williamr@2
|
93 |
|
williamr@4
|
94 |
inline void Open(
|
williamr@2
|
95 |
void* aHead,
|
williamr@2
|
96 |
TXmlEngNode::TXmlEngDOMNodeType aType);
|
williamr@2
|
97 |
|
williamr@4
|
98 |
private:
|
williamr@2
|
99 |
RXmlEngNodeListImpl iList;
|
williamr@2
|
100 |
};
|
williamr@2
|
101 |
|
williamr@2
|
102 |
/**
|
williamr@4
|
103 |
This template specialization makes RXmlEngNodeList<TXmlEngNode> an alias for
|
williamr@4
|
104 |
RXmlEngNodeListImpl. No part of the class specified above is used, rather the
|
williamr@4
|
105 |
interface (and implementation) of RXmlEngNodeListImpl is used instead.
|
williamr@4
|
106 |
*/
|
williamr@2
|
107 |
template<>
|
williamr@2
|
108 |
class RXmlEngNodeList<TXmlEngNode>: public RXmlEngNodeListImpl {};
|
williamr@2
|
109 |
|
williamr@2
|
110 |
|
williamr@4
|
111 |
#include <xml/dom/xmlengnodelist.inl>
|
williamr@2
|
112 |
|
williamr@4
|
113 |
#endif /* XMLENGNODELIST_H */
|
williamr@2
|
114 |
|