LCOV - code coverage report
Current view: directory - content/base/src - nsNodeIterator.h (source / functions) Found Hit Coverage
Test: app.info Lines: 4 1 25.0 %
Date: 2012-06-02 Functions: 7 1 14.3 %

       1                 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       2                 :  *
       3                 :  * ***** BEGIN LICENSE BLOCK *****
       4                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       5                 :  *
       6                 :  * The contents of this file are subject to the Mozilla Public License Version
       7                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       8                 :  * the License. You may obtain a copy of the License at
       9                 :  * http://www.mozilla.org/MPL/
      10                 :  *
      11                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      12                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      13                 :  * for the specific language governing rights and limitations under the
      14                 :  * License.
      15                 :  *
      16                 :  * The Original Code is this file as it was released on July 19 2008.
      17                 :  *
      18                 :  * The Initial Developer of the Original Code is
      19                 :  * Craig Toppper.
      20                 :  * Portions created by the Initial Developer are Copyright (C) 2008
      21                 :  * the Initial Developer. All Rights Reserved.
      22                 :  *
      23                 :  * Contributor(s):
      24                 :  *   Craig Topper <craig.topper@gmail.com> (Original Author)
      25                 :  *
      26                 :  * Alternatively, the contents of this file may be used under the terms of
      27                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      28                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      29                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      30                 :  * of those above. If you wish to allow use of your version of this file only
      31                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      32                 :  * use your version of this file under the terms of the MPL, indicate your
      33                 :  * decision by deleting the provisions above and replace them with the notice
      34                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      35                 :  * the provisions above, a recipient may use your version of this file under
      36                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      37                 :  *
      38                 :  * ***** END LICENSE BLOCK ***** */
      39                 :  
      40                 : /*
      41                 :  * Implementation of DOM Traversal's nsIDOMNodeIterator
      42                 :  */
      43                 : 
      44                 : #ifndef nsNodeIterator_h___
      45                 : #define nsNodeIterator_h___
      46                 : 
      47                 : #include "nsIDOMNodeIterator.h"
      48                 : #include "nsTraversal.h"
      49                 : #include "nsCycleCollectionParticipant.h"
      50                 : #include "nsStubMutationObserver.h"
      51                 : 
      52                 : class nsINode;
      53                 : class nsIDOMNode;
      54                 : class nsIDOMNodeFilter;
      55                 : 
      56                 : class nsNodeIterator : public nsIDOMNodeIterator,
      57                 :                        public nsTraversal,
      58                 :                        public nsStubMutationObserver2
      59                 : {
      60                 : public:
      61               0 :     NS_DECL_CYCLE_COLLECTING_ISUPPORTS
      62                 :     NS_DECL_NSIDOMNODEITERATOR
      63                 : 
      64                 :     nsNodeIterator(nsINode *aRoot,
      65                 :                    PRUint32 aWhatToShow,
      66                 :                    nsIDOMNodeFilter *aFilter);
      67                 :     virtual ~nsNodeIterator();
      68                 : 
      69                 :     NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
      70                 :     NS_DECL_NSIMUTATIONOBSERVER2_ATTRIBUTECHILDREMOVED
      71                 : 
      72            1464 :     NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsNodeIterator, nsIDOMNodeIterator)
      73                 : 
      74                 : private:
      75                 :     struct NodePointer {
      76               0 :         NodePointer() : mNode(nsnull) {};
      77                 :         NodePointer(nsINode *aNode, bool aBeforeNode);
      78                 : 
      79                 :         typedef bool (NodePointer::*MoveToMethodType)(nsINode*);
      80                 :         bool MoveToNext(nsINode *aRoot);
      81                 :         bool MoveToPrevious(nsINode *aRoot);
      82                 : 
      83                 :         bool MoveForward(nsINode *aRoot, nsINode *aNode);
      84                 :         void MoveBackward(nsINode *aParent, nsINode *aNode);
      85                 : 
      86                 :         void AdjustAfterRemoval(nsINode *aRoot, nsINode *aContainer, nsIContent *aChild, nsIContent *aPreviousSibling);
      87                 : 
      88               0 :         void Clear() { mNode = nsnull; }
      89                 : 
      90                 :         nsINode *mNode;
      91                 :         bool mBeforeNode;
      92                 :     };
      93                 : 
      94                 :     inline nsresult
      95                 :     NextOrPrevNode(NodePointer::MoveToMethodType aMove,
      96                 :                    nsIDOMNode **_retval);
      97                 : 
      98                 :     bool mDetached;
      99                 :     NodePointer mPointer;
     100                 :     NodePointer mWorkingPointer;
     101                 : };
     102                 : 
     103                 : #endif

Generated by: LCOV version 1.7