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);
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
QueryPathTreeFilter::StackEntry::StackEntry
StackEntry()
Definition: QueryPathTreeFilter.hpp:54
QueryPathTreeFilter::StackEntry::addNode
void addNode(const QueryPathNode *isn)
QueryPathTreeFilter::endDocumentEvent
virtual void endDocumentEvent()
Handles a document node as an event.
QueryPathTreeFilter
Definition: QueryPathTreeFilter.hpp:33
QueryPathTreeFilter::stack_
FilterStack stack_
Definition: QueryPathTreeFilter.hpp:74
EventFilter
Definition: EventHandler.hpp:68
QueryPathTreeFilter::~QueryPathTreeFilter
virtual ~QueryPathTreeFilter()
QueryPathTreeFilter::StackEntry
Definition: QueryPathTreeFilter.hpp:53
QueryPathTreeFilter::startDocumentEvent
virtual void startDocumentEvent(const XMLCh *documentURI, const XMLCh *encoding)
Handles a document node as an event.
QueryPathTreeFilter::StackEntry::uri
xercesc::XMLBuffer uri
Definition: QueryPathTreeFilter.hpp:60
QueryPathTreeFilter::commentEvent
virtual void commentEvent(const XMLCh *value)
Handles a comment node as an event.
QueryPathTreeFilter::attributeEvent
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.
QueryPathTreeFilter::StackEntry::localname
xercesc::XMLBuffer localname
Definition: QueryPathTreeFilter.hpp:61
QueryPathTreeFilter::startElementEvent
virtual void startElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname)
Handles the start of an element node as an event.
QueryPathTreeFilter::textEvent
virtual void textEvent(const XMLCh *value)
Handles a text node as an event.
QueryPathTreeFilter::QueryPathTreeFilter
QueryPathTreeFilter(const QPNVector &qpns, EventHandler *next)
EventHandler.hpp
QueryPathTreeFilter::textEvent
virtual void textEvent(const XMLCh *chars, unsigned int length)
Handles a text node as an event.
QueryPathTreeFilter::checkAncestors
void checkAncestors(FilterStack::reverse_iterator s)
QueryPathTreeFilter::namespaceEvent
virtual void namespaceEvent(const XMLCh *prefix, const XMLCh *uri)
Handles a namespace binding as an event.
QueryPathTreeFilter::StackEntry::matched
bool matched
Definition: QueryPathTreeFilter.hpp:63
QueryPathTreeFilter::StackEntry::addChildren
void addChildren(const QueryPathNode *isn)
QPNVector
std::vector< const QueryPathNode * > QPNVector
Definition: QueryPathTreeFilter.hpp:29
QueryPathTreeFilter::QueryPathTreeFilter
QueryPathTreeFilter(const QueryPathNode *qpn, EventHandler *next)
QueryPathTreeFilter::FilterStack
std::vector< StackEntry * > FilterStack
Definition: QueryPathTreeFilter.hpp:70
QueryPathTreeFilter::StackEntry::nonElementChildren
bool nonElementChildren
Definition: QueryPathTreeFilter.hpp:65
EventHandler
Definition: EventHandler.hpp:30
QueryPathTreeFilter::piEvent
virtual void piEvent(const XMLCh *target, const XMLCh *value)
Handles a processing instruction node as an event.
QueryPathTreeFilter::StackEntry::children
QPNVector children
Definition: QueryPathTreeFilter.hpp:67
QueryPathTreeFilter::StackEntry::prefix
xercesc::XMLBuffer prefix
Definition: QueryPathTreeFilter.hpp:59
QueryPathTreeFilter::StackEntry::attrChildren
bool attrChildren
Definition: QueryPathTreeFilter.hpp:66
QueryPathTreeFilter::endElementEvent
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.