williamr@4: // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@4: // All rights reserved. williamr@4: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@4: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: // williamr@4: // Initial Contributors: williamr@4: // Nokia Corporation - initial contribution. williamr@4: // williamr@4: // Contributors: williamr@4: // williamr@4: // Description: williamr@4: // Node list implementation functions williamr@4: // williamr@4: williamr@4: williamr@4: williamr@4: /** williamr@4: @file williamr@4: @publishedAll williamr@4: @released williamr@2: */ williamr@4: #ifndef XMLENGNODELIST_IMPL_H williamr@4: #define XMLENGNODELIST_IMPL_H williamr@2: williamr@2: #include williamr@4: #include williamr@2: williamr@2: /** williamr@4: This class should not be used directly. However, it defines the interface for williamr@4: RXmlEngNodeList through template specialization. williamr@4: williamr@4: @see RXmlEngNodeList williamr@4: williamr@4: This class implements an iterator or filtered iterator for a tree. The OpenL() williamr@4: methods control which nodes are included in the iterator. It is possible to williamr@4: iterate across all node types or only a single type. It is possible to iterate williamr@4: only over nodes within a specific namespace. It is also possible to iterate williamr@4: over nodes with the same name. williamr@4: */ williamr@2: class RXmlEngNodeListImpl williamr@2: { williamr@2: public: williamr@2: williamr@4: /** Default constructor */ williamr@2: IMPORT_C RXmlEngNodeListImpl(); williamr@2: williamr@2: /** williamr@4: Closes a node list. This does not affect any of the nodes. Only williamr@4: internally used memory is freed. williamr@4: */ williamr@2: IMPORT_C void Close(); williamr@2: williamr@2: /** williamr@4: Gets the list length. williamr@4: @return Number of nodes in the list williamr@4: */ williamr@2: IMPORT_C TInt Count() const; williamr@2: williamr@2: /** williamr@4: Checks whether the next node exists in the list williamr@4: @return ETrue if the next node exists, EFalse otherwise williamr@4: */ williamr@2: IMPORT_C TBool HasNext() const; williamr@2: williamr@2: /** williamr@4: Gets the next node in the list williamr@4: @return The next node or NULL if it does not exist williamr@4: */ williamr@2: IMPORT_C TXmlEngNode Next(); williamr@2: williamr@2: /** williamr@4: Initializes the list. The parameters to this method control what nodes are williamr@4: included in the list. If aType is NULL, all nodes are included in the williamr@4: list. Both aName and aNs, if specified, are copied internally. williamr@4: williamr@4: @param aHead The first node in the list williamr@4: @param aType Only include nodes of this type williamr@4: @param aName Only include nodes that match this name williamr@4: @param aNs Only include nodes that match this namespace williamr@4: @leave - One of the system-wide error codes williamr@4: */ williamr@2: void OpenL( williamr@2: void* aHead, williamr@2: TXmlEngNode::TXmlEngDOMNodeType aType, williamr@2: const TDesC8& aName = KNullDesC8, williamr@2: const TDesC8& aNs = KNullDesC8); williamr@2: williamr@2: /** williamr@4: Initializes the list. The parameters to this method control what nodes are williamr@4: included in the list. If aType is NULL, all nodes are included in the williamr@4: list. williamr@4: williamr@4: @param aHead The first node in the list williamr@4: @param aType Only include nodes of this type williamr@4: */ williamr@2: void Open( williamr@2: void* aHead, williamr@2: TXmlEngNode::TXmlEngDOMNodeType aType); williamr@2: williamr@2: private: williamr@2: williamr@4: /** williamr@4: Finds the next node in the list according to the criteria specified in OpenL(). williamr@4: @param aCurrentNode The current node pointer williamr@4: @return The next node or NULL if no next node williamr@4: */ williamr@2: void* FindNextNode(void* aCurrentNode) const; williamr@2: williamr@2: void* iCurrentNode; williamr@2: TInt iType; // NodeType:4 bits (0-3) & MatchName flag (bit 4) williamr@2: unsigned char* iName; williamr@2: unsigned char* iNsUri; williamr@2: }; williamr@2: williamr@4: /** williamr@4: Compares two strings. williamr@4: @param aStr1 String 1 to compare williamr@4: @param aStr2 String 2 to compare williamr@4: @return ETrue of aStr1 and aStr2 are equal or if they are both NULL. EFalse otherwise. williamr@4: */ williamr@2: TBool StrEqualOrNull(const void* aStr1, const void* aStr2); williamr@2: williamr@2: williamr@4: #endif /* XMLENGNODELIST_IMPL_H */ williamr@2: