"Fossies" - the Fresh Open Source Software Archive

Member "tidy-html5-5.8.0/experimental/TidyNodeIter.h" (16 Jul 2021, 1549 Bytes) of package /linux/www/tidy-html5-5.8.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "TidyNodeIter.h" see the Fossies "Dox" file reference documentation.

    1 /* TidyNodeIter
    2 
    3   (c) 1998-2003 (W3C) MIT, ERCIM, Keio University
    4   See tidy.h for the copyright notice.
    5   
    6   These files contain utility routines to perform in-order traversals of the
    7   Tidy document tree, beginning at an arbitrary node.
    8 
    9   A traversal of the tree can be performed in a manner similar to the following:
   10 
   11   Node *testNode;
   12   TidyNodeIter *iter = newTidyNodeIter( FindBody( tdoc ));
   13   for (testNode = nextTidyNode( &iter );
   14        NULL != testNode;
   15        testNode = nextTidyNode( &iter ))
   16   {
   17   }
   18 
   19   TODO:  Add a prevTidyNode() function.
   20 */
   21 
   22 #include "lexer.h"
   23 
   24 typedef struct _TidyNodeIter
   25 {
   26     Node *pTop, *pCurrent;
   27 } TidyNodeIter;
   28 
   29 TidyNodeIter *newTidyNodeIter( Node *pStart );
   30 
   31 /* 
   32     nextTidyNode( TidyNodeIter *pIter )
   33 
   34     if pCurrent is NULL, this function initializes it to match pTop, and
   35     returns that value, otherwise it advances to the next node in order, 
   36     and returns that value. When pTop == pCurrent, the function returns NULL
   37     to indicate that the entire tree has been visited.
   38 */
   39 Node *nextTidyNode( TidyNodeIter *pIter );
   40 
   41 /*
   42     setCurrentNode( TidyNodeIter *pThis, Node *newCurr )
   43 
   44     Resets pCurrent to match the passed value; useful if you need to back up
   45     to an unaltered point in the tree, or to skip a section. The next call to 
   46     nextTidyNode() will return the node which follows newCurr in order.
   47 
   48     Minimal error checking is performed; unexpected results _will_ occur if 
   49     newCurr is not a descendant node of pTop.
   50 */
   51 void setCurrentNode( TidyNodeIter *pThis, Node *newCurr );