homescreenpluginsrv/inc/hspsdomdepthiterator.h
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Depth iterator walks the dom tree by depth first.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef hsps_DOM_DEPTH_ITERATOR_H
       
    21 #define hsps_DOM_DEPTH_ITERATOR_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include "mhspsdomiterator.h"
       
    26 
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class ChspsDomNode;
       
    30 
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35  * Depth iterator walks through the dom tree using the depth first
       
    36  * principle.
       
    37  *
       
    38  * @lib hspsdomdocument.lib
       
    39  * @since S60 5.0
       
    40  * @ingroup group_hspsdom
       
    41 */
       
    42 class ChspsDomDepthIterator: public CBase, public MhspsDomIterator
       
    43     {
       
    44    public:  // Destructor
       
    45        /**
       
    46        * Symbian constructor
       
    47        * 
       
    48        * @since S60 5.0 
       
    49        * @param aRootNode   Root node.
       
    50        */        
       
    51        IMPORT_C static ChspsDomDepthIterator* NewL( ChspsDomNode& aRootNode );
       
    52 
       
    53        /**
       
    54         * Destructor.
       
    55         */
       
    56        IMPORT_C virtual ~ChspsDomDepthIterator();
       
    57 
       
    58     public: // Adding and removing    	
       
    59     	/**
       
    60         * From MhspsDomIterator.
       
    61         */
       
    62         IMPORT_C ChspsDomNode* First();
       
    63     	
       
    64     	/**
       
    65         * From MhspsDomIterator.
       
    66         */
       
    67         IMPORT_C ChspsDomNode* NextL();
       
    68         
       
    69         /**
       
    70         * From MhspsDomIterator.
       
    71         */
       
    72         IMPORT_C ChspsDomNode* NextSibling( ChspsDomNode& aNode );
       
    73         
       
    74    private:
       
    75         /**
       
    76         * C++ default constructor
       
    77         */
       
    78         ChspsDomDepthIterator( ChspsDomNode& aRootNode );
       
    79         
       
    80         /**
       
    81         * By default Symbian 2nd phase constructor is private.
       
    82         */
       
    83         void ConstructL(); 
       
    84         
       
    85         /**
       
    86         * Push node to stack.
       
    87         * @param aNode Node to push 
       
    88         */
       
    89         void PushL( ChspsDomNode& aNode );
       
    90         
       
    91         /**
       
    92         * Pop node from the stack.
       
    93         * @return Pointer to node
       
    94         */
       
    95         ChspsDomNode* Pop();
       
    96         
       
    97    private:
       
    98         // Follow tree hierarchy with stack
       
    99         RPointerArray<ChspsDomNode> iDepthLevel;
       
   100         // First node
       
   101         ChspsDomNode* iFirst;
       
   102         //Current node
       
   103         ChspsDomNode* iCurrent;
       
   104                    
       
   105     };
       
   106 
       
   107 #endif      // hsps_DOM_DEPTH_ITERATOR_H  
       
   108             
       
   109 // End of File