source: NonGTP/Xerces/xerces/include/xercesc/dom/deprecated/DOM_NodeFilter.hpp @ 358

Revision 358, 5.1 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
1/*
2 * Copyright 1999-2002,2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * $Id: DOM_NodeFilter.hpp,v 1.5 2004/09/08 13:55:42 peiyongz Exp $
19 */
20
21// DOM_NodeFilter.h: interface for the DOM_NodeFilter class.
22//
23//////////////////////////////////////////////////////////////////////
24
25#ifndef DOM_NodeFilter_HEADER_GUARD_
26#define DOM_NodeFilter_HEADER_GUARD_
27
28#include "DOM_Node.hpp"
29
30XERCES_CPP_NAMESPACE_BEGIN
31
32
33class NodeFilterImpl;
34
35
36/**
37 * Filters are objects that know how to "filter out" nodes. If a
38 * <code>DOM_NodeIterator</code> or <code>DOM_TreeWalker</code> is given a
39 * filter, it applies the filter before it returns the next node.
40 *
41 * If the filter says to accept the node, the iterator returns it; otherwise, the
42 * iterator looks for the next node and pretends that the node that was rejected
43 * was not there.
44 *
45 *  The DOM does not provide any filters. Filter is just an interface that users can
46 *  implement to provide their own filters.
47 *
48 *  Filters do not need to know how to iterate, nor do they need to know anything
49 *  about the data structure that is being iterated. This makes it very easy to write
50 *  filters, since the only thing they have to know how to do is evaluate a single node.
51 *  One filter may be used with a number of different kinds of iterators, encouraging
52 *  code reuse.
53 *
54 */
55class DEPRECATED_DOM_EXPORT DOM_NodeFilter
56{
57    public:
58        /** @name Enumerators for Node Filter */
59        //@{
60        /*
61          *             <table><tr><td>FILTER_ACCEPT</td>
62      *            <td>Accept the node. Navigation methods defined for
63      *                NodeIterator or TreeWalker will return this node.</td>
64          *                     </tr>
65          *                     <tr><td>
66      *               FILTER_REJECT</td>
67      *               <td>Reject the node. Navigation methods defined for
68      *               NodeIterator or TreeWalker will not return this
69      *               node. For TreeWalker, the children of this node will
70      *               also be rejected. Iterators treat this as a synonym
71      *               for FILTER_SKIP.</td>
72          *                     </tr>
73          *                     <tr><td>FILTER_SKIP</td>
74      *              <td>Reject the node. Navigation methods defined for
75      *                  NodeIterator or TreeWalker will not return this
76      *                  node. For both NodeIterator and Treewalker, the
77      *                  children of this node will still be considered.</td>
78          *                     </tr>
79          *             </table>
80      *
81          */
82        enum FilterAction {FILTER_ACCEPT = 1,
83                           FILTER_REJECT = 2,
84                           FILTER_SKIP   = 3};
85
86        enum ShowType {
87            SHOW_ALL                       = 0x0000FFFF,
88            SHOW_ELEMENT                   = 0x00000001,
89            SHOW_ATTRIBUTE                 = 0x00000002,
90            SHOW_TEXT                      = 0x00000004,
91            SHOW_CDATA_SECTION             = 0x00000008,
92            SHOW_ENTITY_REFERENCE          = 0x00000010,
93            SHOW_ENTITY                    = 0x00000020,
94            SHOW_PROCESSING_INSTRUCTION    = 0x00000040,
95            SHOW_COMMENT                   = 0x00000080,
96            SHOW_DOCUMENT                  = 0x00000100,
97            SHOW_DOCUMENT_TYPE             = 0x00000200,
98            SHOW_DOCUMENT_FRAGMENT         = 0x00000400,
99            SHOW_NOTATION                  = 0x00000800
100        };
101        //@}
102
103        /** @name Constructors */
104        //@{
105        /**
106          * Default constructor for DOM_NodeFilter.
107          */
108        DOM_NodeFilter();
109        //@}
110
111        /** @name Destructor. */
112        //@{
113        /**
114          * Destructor for DOM_NodeFilter.
115          */
116        virtual ~DOM_NodeFilter();
117        //@}
118
119        /** @name Test function. */
120        //@{
121        /**
122          * Test whether a specified node is visible in the logical view of a DOM_TreeWalker
123          * or DOM_NodeIterator. This function will be called by the implementation of
124          * DOM_TreeWalker and DOM_NodeIterator; it is not intended to be called directly from user
125          * code.
126          *
127          * @param node The node to check to see if it passes the filter or not.
128          * @return A constant to determine whether the node is accepted, rejected, or skipped.
129          */
130        virtual short acceptNode (const DOM_Node &node) const =0;
131        //@}
132
133    private:
134        DOM_NodeFilter(const DOM_NodeFilter &other);
135        DOM_NodeFilter & operator = (const DOM_NodeFilter &other);
136        bool operator == (const DOM_NodeFilter &other) const;
137        bool operator != (const DOM_NodeFilter &other) const;
138};
139
140XERCES_CPP_NAMESPACE_END
141
142#endif
Note: See TracBrowser for help on using the repository browser.