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-2008
5  * Oracle. 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  * $Id$
20  */
21 
22 #ifndef _QUERYPATHTREEFILTER_HPP
23 #define _QUERYPATHTREEFILTER_HPP
24 
25 #include <vector>
26 
28 
29 #include <xercesc/framework/XMLBuffer.hpp>
30 
31 class QueryPathNode;
32 typedef std::vector<const QueryPathNode *> QPNVector;
33 
34 class XQILLA_API QueryPathTreeFilter : public EventFilter
35 {
36 public:
37  QueryPathTreeFilter(const QueryPathNode *qpn, EventHandler *next);
38  QueryPathTreeFilter(const QPNVector &qpns, EventHandler *next);
39  virtual ~QueryPathTreeFilter();
40 
41  virtual void startDocumentEvent(const XMLCh *documentURI, const XMLCh *encoding);
42  virtual void endDocumentEvent();
43  virtual void startElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname);
44  virtual void endElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname,
45  const XMLCh *typeURI, const XMLCh *typeName);
46  virtual void piEvent(const XMLCh *target, const XMLCh *value);
47  virtual void textEvent(const XMLCh *value);
48  virtual void textEvent(const XMLCh *chars, unsigned int length);
49  virtual void commentEvent(const XMLCh *value);
50  virtual void attributeEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname, const XMLCh *value,
51  const XMLCh *typeURI, const XMLCh *typeName);
52  virtual void namespaceEvent(const XMLCh *prefix, const XMLCh *uri);
53 
54 protected:
55  struct StackEntry {
56  StackEntry() : matched(false), nonElementChildren(false), attrChildren(false), children() {}
57 
58  void addNode(const QueryPathNode *isn);
59  void addChildren(const QueryPathNode *isn);
60 
61  XERCES_CPP_NAMESPACE_QUALIFIER XMLBuffer prefix;
62  XERCES_CPP_NAMESPACE_QUALIFIER XMLBuffer uri;
63  XERCES_CPP_NAMESPACE_QUALIFIER XMLBuffer localname;
64 
65  bool matched;
66 
70  };
71 
72  typedef std::vector<StackEntry*> FilterStack;
73 
74  void checkAncestors(FilterStack::reverse_iterator s);
75 
77 };
78 
79 #endif
std::vector< const QueryPathNode * > QPNVector
Definition: QueryPathTreeFilter.hpp:31
Definition: QueryPathTreeFilter.hpp:34
xercesc::XMLBuffer localname
Definition: QueryPathTreeFilter.hpp:63
Definition: EventHandler.hpp:69
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:97
bool nonElementChildren
Definition: QueryPathTreeFilter.hpp:67
Definition: EventHandler.hpp:31
Definition: QueryPathTreeFilter.hpp:55
bool attrChildren
Definition: QueryPathTreeFilter.hpp:68
virtual void endDocumentEvent()
Handles a document node as an event.
Definition: EventHandler.hpp:92
virtual void namespaceEvent(const XMLCh *prefix, const XMLCh *uri)
Handles a namespace binding as an event.
Definition: EventHandler.hpp:134
FilterStack stack_
Definition: QueryPathTreeFilter.hpp:76
virtual void startDocumentEvent(const XMLCh *documentURI, const XMLCh *encoding)
Handles a document node as an event.
Definition: EventHandler.hpp:87
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:128
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:102
virtual void piEvent(const XMLCh *target, const XMLCh *value)
Handles a processing instruction node as an event.
Definition: EventHandler.hpp:108
StackEntry()
Definition: QueryPathTreeFilter.hpp:56
virtual void commentEvent(const XMLCh *value)
Handles a comment node as an event.
Definition: EventHandler.hpp:123
xercesc::XMLBuffer prefix
Definition: QueryPathTreeFilter.hpp:61
std::vector< StackEntry * > FilterStack
Definition: QueryPathTreeFilter.hpp:72
QPNVector children
Definition: QueryPathTreeFilter.hpp:69
virtual void textEvent(const XMLCh *value)
Handles a text node as an event.
Definition: EventHandler.hpp:113
bool matched
Definition: QueryPathTreeFilter.hpp:65
xercesc::XMLBuffer uri
Definition: QueryPathTreeFilter.hpp:62