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, 2015 Oracle and/or its affiliates. All rights reserved.
5  *
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
std::vector< const QueryPathNode * > QPNVector
Definition: QueryPathTreeFilter.hpp:29
Definition: QueryPathTreeFilter.hpp:32
xercesc::XMLBuffer localname
Definition: QueryPathTreeFilter.hpp:61
Definition: EventHandler.hpp:67
virtual void startElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname)
Handles the start of an element node as an event.
Definition: EventHandler.hpp:95
bool nonElementChildren
Definition: QueryPathTreeFilter.hpp:65
Definition: EventHandler.hpp:29
Definition: QueryPathTreeFilter.hpp:53
bool attrChildren
Definition: QueryPathTreeFilter.hpp:66
virtual void endDocumentEvent()
Handles a document node as an event.
Definition: EventHandler.hpp:90
virtual void namespaceEvent(const XMLCh *prefix, const XMLCh *uri)
Handles a namespace binding as an event.
Definition: EventHandler.hpp:132
FilterStack stack_
Definition: QueryPathTreeFilter.hpp:74
virtual void startDocumentEvent(const XMLCh *documentURI, const XMLCh *encoding)
Handles a document node as an event.
Definition: EventHandler.hpp:85
virtual void attributeEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname, const XMLCh *value, const XMLCh *typeURI, const XMLCh *typeName)
Handles an attribute node as an event.
Definition: EventHandler.hpp:126
virtual void endElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname, const XMLCh *typeURI, const XMLCh *typeName)
Handles the end of an element node as an event.
Definition: EventHandler.hpp:100
virtual void piEvent(const XMLCh *target, const XMLCh *value)
Handles a processing instruction node as an event.
Definition: EventHandler.hpp:106
StackEntry()
Definition: QueryPathTreeFilter.hpp:54
virtual void commentEvent(const XMLCh *value)
Handles a comment node as an event.
Definition: EventHandler.hpp:121
xercesc::XMLBuffer prefix
Definition: QueryPathTreeFilter.hpp:59
std::vector< StackEntry * > FilterStack
Definition: QueryPathTreeFilter.hpp:70
QPNVector children
Definition: QueryPathTreeFilter.hpp:67
virtual void textEvent(const XMLCh *value)
Handles a text node as an event.
Definition: EventHandler.hpp:111
bool matched
Definition: QueryPathTreeFilter.hpp:63
xercesc::XMLBuffer uri
Definition: QueryPathTreeFilter.hpp:60