SourceForge.net Logo
QueryPathTreeFilter.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001, 2008,
3  * DecisionSoft Limited. All rights reserved.
4  * Copyright (c) 2004, 2011,
5  * Oracle and/or its affiliates. All rights reserved.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef _QUERYPATHTREEFILTER_HPP
21 #define _QUERYPATHTREEFILTER_HPP
22 
23 #include <vector>
24 
26 
27 #include <xercesc/framework/XMLBuffer.hpp>
28 
29 class QueryPathNode;
30 typedef std::vector<const QueryPathNode *> QPNVector;
31 
32 class XQILLA_API QueryPathTreeFilter : public EventFilter
33 {
34 public:
35  QueryPathTreeFilter(const QueryPathNode *qpn, EventHandler *next);
36  QueryPathTreeFilter(const QPNVector &qpns, EventHandler *next);
37  virtual ~QueryPathTreeFilter();
38 
39  virtual void startDocumentEvent(const XMLCh *documentURI, const XMLCh *encoding);
40  virtual void endDocumentEvent();
41  virtual void startElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname);
42  virtual void endElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname,
43  const XMLCh *typeURI, const XMLCh *typeName);
44  virtual void piEvent(const XMLCh *target, const XMLCh *value);
45  virtual void textEvent(const XMLCh *value);
46  virtual void textEvent(const XMLCh *chars, unsigned int length);
47  virtual void commentEvent(const XMLCh *value);
48  virtual void attributeEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname, const XMLCh *value,
49  const XMLCh *typeURI, const XMLCh *typeName);
50  virtual void namespaceEvent(const XMLCh *prefix, const XMLCh *uri);
51 
52 protected:
53  struct StackEntry {
54  StackEntry() : matched(false), nonElementChildren(false), attrChildren(false), children() {}
55 
56  void addNode(const QueryPathNode *isn);
57  void addChildren(const QueryPathNode *isn);
58 
59  XERCES_CPP_NAMESPACE_QUALIFIER XMLBuffer prefix;
60  XERCES_CPP_NAMESPACE_QUALIFIER XMLBuffer uri;
61  XERCES_CPP_NAMESPACE_QUALIFIER XMLBuffer localname;
62 
63  bool matched;
64 
68  };
69 
70  typedef std::vector<StackEntry*> FilterStack;
71 
72  void checkAncestors(FilterStack::reverse_iterator s);
73 
75 };
76 
77 #endif