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

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: NodeIteratorImpl.hpp,v $
  58.  * Revision 1.5  2000/02/24 20:11:30  abagchi
  59.  * Swat for removing Log from API docs
  60.  *
  61.  * Revision 1.4  2000/02/15 23:17:37  andyh
  62.  * Update Doc++ API comments
  63.  * NameSpace bugfix and update to track W3C
  64.  * Chih Hsiang Chou
  65.  *
  66.  * Revision 1.3  2000/02/06 07:47:33  rahulj
  67.  * Year 2K copyright swat.
  68.  *
  69.  * Revision 1.2  2000/02/04 01:49:26  aruna1
  70.  * TreeWalker and NodeIterator changes
  71.  *
  72.  * Revision 1.1.1.1  1999/11/09 01:09:16  twl
  73.  * Initial checkin
  74.  *
  75.  * Revision 1.2  1999/11/08 20:44:30  rahul
  76.  * Swat for adding in Product name and CVS comment log variable.
  77.  *
  78.  */
  79. #ifndef NodeIteratorImpl_HEADER_GUARD_
  80. #define NodeIteratorImpl_HEADER_GUARD_
  81. // NodeIteratorImpl.hpp: interface for the NodeIteratorImpl class.
  82. //
  83. //////////////////////////////////////////////////////////////////////
  84. #include "DOM_Node.hpp"
  85. #include "DOM_NodeIterator.hpp"
  86. #include "RefCountedImpl.hpp"
  87. class CDOM_EXPORT NodeIteratorImpl : public RefCountedImpl {
  88. protected:
  89. NodeIteratorImpl ();
  90. public:
  91. virtual ~NodeIteratorImpl ();
  92. NodeIteratorImpl (
  93.             DOM_Node root, 
  94.             unsigned long whatToShow, 
  95.             DOM_NodeFilter* nodeFilter,
  96.             bool expandEntityRef);
  97.         NodeIteratorImpl ( const NodeIteratorImpl& toCopy);
  98.         NodeIteratorImpl& operator= (const NodeIteratorImpl& other);
  99.         unsigned long getWhatToShow ();
  100. DOM_NodeFilter* getFilter ();
  101. DOM_Node nextNode ();
  102. DOM_Node previousNode ();
  103. bool acceptNode (DOM_Node node);
  104. DOM_Node matchNodeOrParent (DOM_Node node);
  105. DOM_Node nextNode (DOM_Node node, bool visitChildren);
  106. DOM_Node previousNode (DOM_Node node);
  107. void removeNode (DOM_Node node);
  108. void unreferenced();
  109. void detach ();
  110.         // Get the expandEntity reference flag.
  111.         bool getExpandEntityReferences();
  112. private:
  113. //
  114. // Data
  115. //
  116. // The root.
  117. DOM_Node fRoot;
  118. // The whatToShow mask.
  119. unsigned long fWhatToShow;
  120. // The NodeFilter reference.
  121. DOM_NodeFilter* fNodeFilter;
  122.         // The expandEntity reference flag.
  123.         bool  fExpandEntityReferences;
  124. bool fDetached;
  125. //
  126. // Iterator state - current node and direction.
  127. //
  128. // Note: The current node and direction are sufficient to implement
  129. // the desired behaviour of the current pointer being _between_
  130. // two nodes. The fCurrentNode is actually the last node returned,
  131. // and the
  132. // direction is whether the pointer is in front or behind this node.
  133. // (usually akin to whether the node was returned via nextNode())
  134. // (eg fForward = true) or previousNode() (eg fForward = false).
  135. // The last Node returned.
  136. DOM_Node fCurrentNode;
  137. // The direction of the iterator on the fCurrentNode.
  138. //  <pre>
  139. //  nextNode()  ==      fForward = true;
  140. //  previousNode() ==   fForward = false;
  141. //  </pre>
  142. bool fForward;
  143. };
  144. #endif