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 class williamr@4: // williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@4: @file williamr@4: @publishedAll williamr@4: @released williamr@4: */ williamr@4: #ifndef XMLENGNODELIST_H williamr@4: #define XMLENGNODELIST_H williamr@4: williamr@4: #include williamr@4: #include williamr@4: williamr@4: /** williamr@4: Implements an iterator or filtered iterator for a tree. williamr@4: williamr@4: This classes behaves in two very different ways, depending on the williamr@4: template parameter. williamr@4: williamr@4: 1) RXmlEngNodeList williamr@4: williamr@4: Through template specialization, this becomes an alias for RXmlEngNodeListImpl. williamr@4: The RXmlEngNodeListImpl::OpenL() methods control which nodes are included in williamr@4: the iterator. It is possible to iterate across all node types or only a single williamr@4: type. It is possible to iterate only over nodes within a specific namespace. williamr@4: It is also possible to iterate over nodes with the same name. williamr@4: williamr@4: RXmlEngNodeListImpl should not be used directly. williamr@4: williamr@4: @see RXmlEngNodeListImpl williamr@4: williamr@4: 2) RXmlEngNodeList where X is not TXmlEngNode williamr@4: williamr@4: As the OpenL() methods of this class are private, this class cannot be opened williamr@4: except by friend classes TXmlEngNode and TXmlEngElement. As such, this form williamr@4: should not be used. williamr@4: */ williamr@2: template williamr@2: class RXmlEngNodeList williamr@2: { williamr@4: friend class TXmlEngNode; williamr@4: friend class TXmlEngElement; williamr@4: williamr@2: public: williamr@2: /** williamr@4: Gets the list length. williamr@4: @return The number of nodes in the list williamr@4: */ williamr@2: inline TInt Count() const; williamr@2: williamr@2: /** williamr@4: Checks whether a next node exists in the list williamr@4: @return ETrue of a next node exists, EFalse otherwise williamr@4: */ williamr@2: inline TBool HasNext() const; williamr@2: williamr@2: /** williamr@4: Gets the next node in the list williamr@4: @return The next node casted to the templated type or NULL if it does not williamr@4: exist williamr@4: */ williamr@2: inline T Next(); williamr@2: williamr@4: /** 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: inline void Close(); williamr@2: williamr@2: private: williamr@2: williamr@4: inline 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@4: inline void Open( williamr@2: void* aHead, williamr@2: TXmlEngNode::TXmlEngDOMNodeType aType); williamr@2: williamr@4: private: williamr@2: RXmlEngNodeListImpl iList; williamr@2: }; williamr@2: williamr@2: /** williamr@4: This template specialization makes RXmlEngNodeList an alias for williamr@4: RXmlEngNodeListImpl. No part of the class specified above is used, rather the williamr@4: interface (and implementation) of RXmlEngNodeListImpl is used instead. williamr@4: */ williamr@2: template<> williamr@2: class RXmlEngNodeList: public RXmlEngNodeListImpl {}; williamr@2: williamr@2: williamr@4: #include williamr@2: williamr@4: #endif /* XMLENGNODELIST_H */ williamr@2: