DOM_NodeIterator.hpp
上传用户:huihehuasu
上传日期:2007-01-10
资源大小:6948k
文件大小:9k
源码类别:

xml/soap/webservice

开发平台:

C/C++

  1. /*
  2.  * The Apache Software License, Version 1.1
  3.  *
  4.  * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
  5.  * reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  *
  11.  * 1. Redistributions of source code must retain the above copyright
  12.  *    notice, this list of conditions and the following disclaimer.
  13.  *
  14.  * 2. Redistributions in binary form must reproduce the above copyright
  15.  *    notice, this list of conditions and the following disclaimer in
  16.  *    the documentation and/or other materials provided with the
  17.  *    distribution.
  18.  *
  19.  * 3. The end-user documentation included with the redistribution,
  20.  *    if any, must include the following acknowledgment:
  21.  *       "This product includes software developed by the
  22.  *        Apache Software Foundation (http://www.apache.org/)."
  23.  *    Alternately, this acknowledgment may appear in the software itself,
  24.  *    if and wherever such third-party acknowledgments normally appear.
  25.  *
  26.  * 4. The names "Xerces" and "Apache Software Foundation" must
  27.  *    not be used to endorse or promote products derived from this
  28.  *    software without prior written permission. For written
  29.  *    permission, please contact apache@apache.org.
  30.  *
  31.  * 5. Products derived from this software may not be called "Apache",
  32.  *    nor may "Apache" appear in their name, without prior written
  33.  *    permission of the Apache Software Foundation.
  34.  *
  35.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  36.  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  37.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  38.  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  39.  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  40.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  41.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  42.  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  43.  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  44.  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  45.  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  46.  * SUCH DAMAGE.
  47.  * ====================================================================
  48.  *
  49.  * This software consists of voluntary contributions made by many
  50.  * individuals on behalf of the Apache Software Foundation, and was
  51.  * originally based on software copyright (c) 1999, International
  52.  * Business Machines, Inc., http://www.ibm.com .  For more information
  53.  * on the Apache Software Foundation, please see
  54.  * <http://www.apache.org/>.
  55.  */
  56. /*
  57.  * $Log: DOM_NodeIterator.hpp,v $
  58.  * Revision 1.9  2000/02/17 17:47:25  andyh
  59.  * Update Doc++ API comments
  60.  * NameSpace update to track W3C
  61.  * Changes were made by Chih Hsiang Chou
  62.  *
  63.  * Revision 1.8  2000/02/16 19:39:38  aruna1
  64.  * API Doc++ changes in
  65.  *
  66.  * Revision 1.7  2000/02/15 23:17:37  andyh
  67.  * Update Doc++ API comments
  68.  * NameSpace bugfix and update to track W3C
  69.  * Chih Hsiang Chou
  70.  *
  71.  * Revision 1.6  2000/02/11 18:14:11  abagchi
  72.  * Fixed doc++ bugs
  73.  *
  74.  * Revision 1.5  2000/02/11 03:01:04  abagchi
  75.  * Made protected method public to compile, must be fixed later
  76.  *
  77.  * Revision 1.4  2000/02/10 23:38:05  abagchi
  78.  * Added API docs
  79.  *
  80.  * Revision 1.3  2000/02/06 07:47:30  rahulj
  81.  * Year 2K copyright swat.
  82.  *
  83.  * Revision 1.2  2000/02/04 01:49:28  aruna1
  84.  * TreeWalker and NodeIterator changes
  85.  *
  86.  * Revision 1.3  1999/11/08 20:44:20  rahul
  87.  * Swat for adding in Product name and CVS comment log variable.
  88.  *
  89.  * Revision 1.1.1.1  1999/11/09 01:09:01  twl
  90.  * Initial checkin
  91.  *
  92.  */
  93. #ifndef DOM_NodeIterator_HEADER_GUARD_
  94. #define DOM_NodeIterator_HEADER_GUARD_
  95. #include "DOM_NodeFilter.hpp"
  96. #include "DOM_Node.hpp"
  97. class NodeIteratorImpl;
  98. /**
  99.  * NodeIterators are used to step through a set of nodes
  100.  * e.g. the set of nodes in a NodeList, the document subtree governed by
  101.  * a particular node, the results of a query, or any other set of nodes.
  102.  * The set of nodes to be iterated is determined by the implementation
  103.  * of the NodeIterator. DOM Level 2 specifies a single NodeIterator
  104.  * implementation for document-order traversal of a document
  105.  * subtree. Instances of these iterators are created by calling
  106.  * <code>DocumentTraversal.createNodeIterator()</code>.
  107.  *
  108.  * <p><b>"Experimental - subject to change"</b></p>
  109.  *
  110.  */
  111. class CDOM_EXPORT DOM_NodeIterator
  112. {
  113.     public:
  114.         /** @name Constructors and assignment operator */
  115.         //@{
  116.         /**
  117.           * Default constructor.
  118.           */
  119.         DOM_NodeIterator ();
  120.         /**
  121.           * Copy constructor.
  122.           *
  123.           * @param other The object to be copied.
  124.           */
  125.         DOM_NodeIterator(const DOM_NodeIterator &other);
  126.         /**
  127.           * Assignment operator.
  128.           *
  129.           * @param other The object to be copied.
  130.           */
  131.         DOM_NodeIterator & operator = (const DOM_NodeIterator &other);
  132.         /**
  133.           * Assignment operator.  This overloaded variant is provided for
  134.           *   the sole purpose of setting a DOM_NodeIterator to null.
  135.           *
  136.           * @param val.  Only a value of 0, or null, is allowed.
  137.           */
  138.         DOM_NodeIterator & operator = (const DOM_NullPtr *val);
  139.         //@}
  140.         /** @name Destructor. */
  141.         //@{
  142. /**
  143.   * Destructor for DOM_NodeIterator.
  144.   */
  145.         ~DOM_NodeIterator();
  146.         //@}
  147.         /** @name Equality and Inequality operators. */
  148.         //@{
  149.         /**
  150.          * The equality operator.
  151.          *
  152.          * @param other The object reference with which <code>this</code> object is compared
  153.          * @returns True if both <code>DOM_NodeIterator</code>s refer to the same
  154.          *  actual node, or are both null; return false otherwise.
  155.          */
  156.         bool operator == (const DOM_NodeIterator & other)const;
  157.         /**
  158.           *  Compare with a pointer.  Intended only to allow a convenient
  159.           *    comparison with null.
  160.           */
  161.         bool operator == (const DOM_NullPtr *other) const;
  162.         /**
  163.          * The inequality operator.  See operator ==.
  164.          */
  165.         bool operator != (const DOM_NodeIterator & other) const;
  166.          /**
  167.           *  Compare with a pointer.  Intended only to allow a convenient
  168.           *    comparison with null.
  169.           *
  170.           */
  171.         bool operator != (const DOM_NullPtr * other) const;
  172.         //@}
  173.         /** @name Get functions. */
  174.         //@{
  175.         /**
  176.           * Return which node types are presented via the iterator.
  177.           * The available set of constants is defined in the DOM_NodeFilter interface.
  178.           *
  179.           * <p><b>"Experimental - subject to change"</b></p>
  180.           *
  181.           */
  182.         unsigned long       getWhatToShow();
  183.         /**
  184.           * Return The filter used to screen nodes.
  185.           *
  186.           * <p><b>"Experimental - subject to change"</b></p>
  187.           *
  188.           */
  189.         DOM_NodeFilter*     getFilter();
  190.         /**
  191.           * Return the expandEntityReferences flag.
  192.           * The value of this flag determines whether the children of entity reference
  193.           * nodes are visible to the DOM_NodeFilter. If false, they will be skipped over.
  194.           *
  195.           * <p><b>"Experimental - subject to change"</b></p>
  196.           *
  197.           */
  198.         bool getExpandEntityReferences();
  199.         /**
  200.           * Returns the next node in the set and advances the position of the iterator
  201.           * in the set. After a DOM_NodeIterator is created, the first call to nextNode()
  202.           * returns the first node in the set.
  203.           *
  204.           * <p><b>"Experimental - subject to change"</b></p>
  205.           *
  206.           * @exception DOMException
  207.           *   INVALID_STATE_ERR: Raised if this method is called after the
  208.           *   <code>detach</code> method was invoked.
  209.           */
  210.         DOM_Node            nextNode();
  211.         /**
  212.           * Returns the previous node in the set and moves the position of the iterator
  213.           * backwards in the set.
  214.           *
  215.           * <p><b>"Experimental - subject to change"</b></p>
  216.           *
  217.           * @exception DOMException
  218.           *   INVALID_STATE_ERR: Raised if this method is called after the
  219.           *   <code>detach</code> method was invoked.
  220.           */
  221.         DOM_Node            previousNode();
  222.         //@}
  223.         /** @name Detaching functions. */
  224.         //@{
  225.         /**
  226.           * Detaches the iterator from the set which it iterated over, releasing any
  227.           * computational resources and placing the iterator in the INVALID state. After
  228.           * <code>detach</code> has been invoked, calls to <code>nextNode</code> or
  229.           * <code>previousNode</code> will raise the exception INVALID_STATE_ERR.
  230.           *
  231.           * <p><b>"Experimental - subject to change"</b></p>
  232.           *
  233.           */
  234. void detach();
  235.         //@}
  236.     protected:
  237.         DOM_NodeIterator (NodeIteratorImpl* impl);
  238.         friend class DOM_Document;
  239.     private:
  240.         NodeIteratorImpl*                 fImpl;
  241. };
  242. #endif