1 /* |
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
3 * All rights reserved. |
3 // This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
5 * 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 |
5 // which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
7 // |
8 * |
8 // Initial Contributors: |
9 * Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
10 // |
11 * |
11 // Contributors: |
12 * Contributors: |
12 // |
13 * |
13 // Description: |
14 * Description: Node list inline functions |
14 // Node list class |
15 * |
15 // |
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 #ifndef XMLENGINE_NODELIST_H_INCLUDED |
|
25 #define XMLENGINE_NODELIST_H_INCLUDED |
|
26 |
|
27 #include "xmlengnode.h" |
|
28 #include "xmlengnodelist_impl.h" |
|
29 |
16 |
30 |
17 |
31 |
18 |
32 /** |
19 /** |
33 * Template implements list container. |
20 @file |
34 * |
21 @publishedAll |
35 * List may contain different types of nodes. |
22 @released |
36 * Node pointer is casted to specify node type when |
23 */ |
37 * is returned by Next() method. |
24 #ifndef XMLENGNODELIST_H |
38 * |
25 #define XMLENGNODELIST_H |
39 * @lib XmlEngineDOM.lib |
26 |
40 * @since S60 v3.2 |
27 #include <xml/dom/xmlengnode.h> |
41 */ |
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 */ |
42 template<class T> |
54 template<class T> |
43 class RXmlEngNodeList |
55 class RXmlEngNodeList |
44 { |
56 { |
|
57 friend class TXmlEngNode; |
|
58 friend class TXmlEngElement; |
|
59 |
45 public: |
60 public: |
46 /** |
61 /** |
47 * Get list length. |
62 Gets the list length. |
48 * |
63 @return The number of nodes in the list |
49 * @since S60 v3.2 |
64 */ |
50 * @return Number of nodes in a node list |
|
51 */ |
|
52 inline TInt Count() const; |
65 inline TInt Count() const; |
53 |
66 |
54 /** |
67 /** |
55 * Checks whether next node exists in a node list |
68 Checks whether a next node exists in the list |
56 * |
69 @return ETrue of a next node exists, EFalse otherwise |
57 * @since S60 v3.2 |
70 */ |
58 * @return TRUE if next node exists, FALSE otherwise |
|
59 */ |
|
60 inline TBool HasNext() const; |
71 inline TBool HasNext() const; |
61 |
72 |
62 /** |
73 /** |
63 * Retrieves next node from a node list |
74 Gets the next node in the list |
64 * |
75 @return The next node casted to the templated type or NULL if it does not |
65 * @since S60 v3.2 |
76 exist |
66 * @return Next node |
77 */ |
67 */ |
|
68 inline T Next(); |
78 inline T Next(); |
69 |
79 |
70 /** |
80 /** |
71 * Closes a node list |
81 Closes a node list. This does not affect any of the nodes. Only |
72 * |
82 internally used memory is freed. |
73 * @since S60 v3.2 |
83 */ |
74 */ |
|
75 inline void Close(); |
84 inline void Close(); |
76 |
85 |
77 private: |
86 private: |
78 friend class TXmlEngNode; |
|
79 friend class TXmlEngElement; |
|
80 |
87 |
81 /* |
88 inline void OpenL( |
82 * Opens node. |
|
83 * |
|
84 * @since S60 v3.2 |
|
85 * @param aHead node pointer to the node from which the searching |
|
86 of list elements is started |
|
87 * @param aType type of list elements |
|
88 * @param aName name of list elements |
|
89 * @param aNs namespace of list elements |
|
90 * |
|
91 * @note If aType is NULL, aName and aNs are ignored |
|
92 */ |
|
93 void OpenL( |
|
94 void* aHead, |
89 void* aHead, |
95 TXmlEngNode::TXmlEngDOMNodeType aType, |
90 TXmlEngNode::TXmlEngDOMNodeType aType, |
96 const TDesC8& aName = KNullDesC8, |
91 const TDesC8& aName = KNullDesC8, |
97 const TDesC8& aNs = KNullDesC8); |
92 const TDesC8& aNs = KNullDesC8); |
98 |
93 |
99 /** |
94 inline void Open( |
100 * Opens node. |
|
101 * |
|
102 * @since S60 v3.2 |
|
103 * @param aHead node pointer to the node from which the searching |
|
104 of list elements is started |
|
105 * @param aType type of list elements |
|
106 */ |
|
107 void Open( |
|
108 void* aHead, |
95 void* aHead, |
109 TXmlEngNode::TXmlEngDOMNodeType aType); |
96 TXmlEngNode::TXmlEngDOMNodeType aType); |
110 |
97 |
111 /** List with nodes */ |
98 private: |
112 RXmlEngNodeListImpl iList; |
99 RXmlEngNodeListImpl iList; |
113 }; |
100 }; |
114 |
101 |
115 /** |
102 /** |
116 * Template implements list container for nodes. |
103 This template specialization makes RXmlEngNodeList<TXmlEngNode> an alias for |
117 * |
104 RXmlEngNodeListImpl. No part of the class specified above is used, rather the |
118 * Specialization for trivial case: list of TXmlEngNode objects |
105 interface (and implementation) of RXmlEngNodeListImpl is used instead. |
119 * No "thin wrapper" pattern needed, operate directly on NodeListImpl |
106 */ |
120 * |
|
121 * @lib XmlEngineDOM.lib |
|
122 * @since S60 v3.1 |
|
123 */ |
|
124 template<> |
107 template<> |
125 class RXmlEngNodeList<TXmlEngNode>: public RXmlEngNodeListImpl {}; |
108 class RXmlEngNodeList<TXmlEngNode>: public RXmlEngNodeListImpl {}; |
126 |
109 |
127 |
110 |
|
111 #include <xml/dom/xmlengnodelist.inl> |
128 |
112 |
129 #include "xmlengnodelist.inl" |
113 #endif /* XMLENGNODELIST_H */ |
130 |
114 |
131 #endif /* XMLENGINE_NODELIST_H_INCLUDED */ |
|