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 implementation functions
|
williamr@4
|
15 |
//
|
williamr@4
|
16 |
|
williamr@4
|
17 |
|
williamr@4
|
18 |
|
williamr@4
|
19 |
/**
|
williamr@4
|
20 |
@file
|
williamr@4
|
21 |
@publishedAll
|
williamr@4
|
22 |
@released
|
williamr@2
|
23 |
*/
|
williamr@4
|
24 |
#ifndef XMLENGNODELIST_IMPL_H
|
williamr@4
|
25 |
#define XMLENGNODELIST_IMPL_H
|
williamr@2
|
26 |
|
williamr@2
|
27 |
#include <e32def.h>
|
williamr@4
|
28 |
#include <xml/dom/xmlengnode.h>
|
williamr@2
|
29 |
|
williamr@2
|
30 |
/**
|
williamr@4
|
31 |
This class should not be used directly. However, it defines the interface for
|
williamr@4
|
32 |
RXmlEngNodeList<TXmlEngNode> through template specialization.
|
williamr@4
|
33 |
|
williamr@4
|
34 |
@see RXmlEngNodeList
|
williamr@4
|
35 |
|
williamr@4
|
36 |
This class implements an iterator or filtered iterator for a tree. The OpenL()
|
williamr@4
|
37 |
methods control which nodes are included in the iterator. It is possible to
|
williamr@4
|
38 |
iterate across all node types or only a single type. It is possible to iterate
|
williamr@4
|
39 |
only over nodes within a specific namespace. It is also possible to iterate
|
williamr@4
|
40 |
over nodes with the same name.
|
williamr@4
|
41 |
*/
|
williamr@2
|
42 |
class RXmlEngNodeListImpl
|
williamr@2
|
43 |
{
|
williamr@2
|
44 |
public:
|
williamr@2
|
45 |
|
williamr@4
|
46 |
/** Default constructor */
|
williamr@2
|
47 |
IMPORT_C RXmlEngNodeListImpl();
|
williamr@2
|
48 |
|
williamr@2
|
49 |
/**
|
williamr@4
|
50 |
Closes a node list. This does not affect any of the nodes. Only
|
williamr@4
|
51 |
internally used memory is freed.
|
williamr@4
|
52 |
*/
|
williamr@2
|
53 |
IMPORT_C void Close();
|
williamr@2
|
54 |
|
williamr@2
|
55 |
/**
|
williamr@4
|
56 |
Gets the list length.
|
williamr@4
|
57 |
@return Number of nodes in the list
|
williamr@4
|
58 |
*/
|
williamr@2
|
59 |
IMPORT_C TInt Count() const;
|
williamr@2
|
60 |
|
williamr@2
|
61 |
/**
|
williamr@4
|
62 |
Checks whether the next node exists in the list
|
williamr@4
|
63 |
@return ETrue if the next node exists, EFalse otherwise
|
williamr@4
|
64 |
*/
|
williamr@2
|
65 |
IMPORT_C TBool HasNext() const;
|
williamr@2
|
66 |
|
williamr@2
|
67 |
/**
|
williamr@4
|
68 |
Gets the next node in the list
|
williamr@4
|
69 |
@return The next node or NULL if it does not exist
|
williamr@4
|
70 |
*/
|
williamr@2
|
71 |
IMPORT_C TXmlEngNode Next();
|
williamr@2
|
72 |
|
williamr@2
|
73 |
/**
|
williamr@4
|
74 |
Initializes the list. The parameters to this method control what nodes are
|
williamr@4
|
75 |
included in the list. If aType is NULL, all nodes are included in the
|
williamr@4
|
76 |
list. Both aName and aNs, if specified, are copied internally.
|
williamr@4
|
77 |
|
williamr@4
|
78 |
@param aHead The first node in the list
|
williamr@4
|
79 |
@param aType Only include nodes of this type
|
williamr@4
|
80 |
@param aName Only include nodes that match this name
|
williamr@4
|
81 |
@param aNs Only include nodes that match this namespace
|
williamr@4
|
82 |
@leave - One of the system-wide error codes
|
williamr@4
|
83 |
*/
|
williamr@2
|
84 |
void OpenL(
|
williamr@2
|
85 |
void* aHead,
|
williamr@2
|
86 |
TXmlEngNode::TXmlEngDOMNodeType aType,
|
williamr@2
|
87 |
const TDesC8& aName = KNullDesC8,
|
williamr@2
|
88 |
const TDesC8& aNs = KNullDesC8);
|
williamr@2
|
89 |
|
williamr@2
|
90 |
/**
|
williamr@4
|
91 |
Initializes the list. The parameters to this method control what nodes are
|
williamr@4
|
92 |
included in the list. If aType is NULL, all nodes are included in the
|
williamr@4
|
93 |
list.
|
williamr@4
|
94 |
|
williamr@4
|
95 |
@param aHead The first node in the list
|
williamr@4
|
96 |
@param aType Only include nodes of this type
|
williamr@4
|
97 |
*/
|
williamr@2
|
98 |
void Open(
|
williamr@2
|
99 |
void* aHead,
|
williamr@2
|
100 |
TXmlEngNode::TXmlEngDOMNodeType aType);
|
williamr@2
|
101 |
|
williamr@2
|
102 |
private:
|
williamr@2
|
103 |
|
williamr@4
|
104 |
/**
|
williamr@4
|
105 |
Finds the next node in the list according to the criteria specified in OpenL().
|
williamr@4
|
106 |
@param aCurrentNode The current node pointer
|
williamr@4
|
107 |
@return The next node or NULL if no next node
|
williamr@4
|
108 |
*/
|
williamr@2
|
109 |
void* FindNextNode(void* aCurrentNode) const;
|
williamr@2
|
110 |
|
williamr@2
|
111 |
void* iCurrentNode;
|
williamr@2
|
112 |
TInt iType; // NodeType:4 bits (0-3) & MatchName flag (bit 4)
|
williamr@2
|
113 |
unsigned char* iName;
|
williamr@2
|
114 |
unsigned char* iNsUri;
|
williamr@2
|
115 |
};
|
williamr@2
|
116 |
|
williamr@4
|
117 |
/**
|
williamr@4
|
118 |
Compares two strings.
|
williamr@4
|
119 |
@param aStr1 String 1 to compare
|
williamr@4
|
120 |
@param aStr2 String 2 to compare
|
williamr@4
|
121 |
@return ETrue of aStr1 and aStr2 are equal or if they are both NULL. EFalse otherwise.
|
williamr@4
|
122 |
*/
|
williamr@2
|
123 |
TBool StrEqualOrNull(const void* aStr1, const void* aStr2);
|
williamr@2
|
124 |
|
williamr@2
|
125 |
|
williamr@4
|
126 |
#endif /* XMLENGNODELIST_IMPL_H */
|
williamr@2
|
127 |
|