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