# XQilla Simple API Documentation

- Main Page
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

# QueryPathTreeFilter.hpp

Go to the documentation of this file.

    00001 /*
    00002  * Copyright (c) 2001, 2008,
    00003  *     DecisionSoft Limited. All rights reserved.
    00004  * Copyright (c) 2004, 2015 Oracle and/or its affiliates. All rights reserved.
    00005  *
    00006  *
    00007  * Licensed under the Apache License, Version 2.0 (the "License");
    00008  * you may not use this file except in compliance with the License.
    00009  * You may obtain a copy of the License at
    00010  *
    00011  *     http://www.apache.org/licenses/LICENSE-2.0
    00012  *
    00013  * Unless required by applicable law or agreed to in writing, software
    00014  * distributed under the License is distributed on an "AS IS" BASIS,
    00015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00016  * See the License for the specific language governing permissions and
    00017  * limitations under the License.
    00018  */
    00019
    00020 #ifndef _QUERYPATHTREEFILTER_HPP
    00021 #define _QUERYPATHTREEFILTER_HPP
    00022
    00023 #include <vector>
    00024
    00025 #include <xqilla/events/EventHandler.hpp>
    00026
    00027 #include <xercesc/framework/XMLBuffer.hpp>
    00028
    00029 class QueryPathNode;
    00030 typedef std::vector<const QueryPathNode *> QPNVector;
    00031
    00032 class XQILLA_API QueryPathTreeFilter : public EventFilter
    00033 {
    00034 public:
    00035   QueryPathTreeFilter(const QueryPathNode *qpn, EventHandler *next);
    00036   QueryPathTreeFilter(const QPNVector &qpns, EventHandler *next);
    00037   virtual ~QueryPathTreeFilter();
    00038
    00039   virtual void startDocumentEvent(const XMLCh *documentURI, const XMLCh *encoding);
    00040   virtual void endDocumentEvent();
    00041   virtual void startElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname);
    00042   virtual void endElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname,
    00043                                const XMLCh *typeURI, const XMLCh *typeName);
    00044   virtual void piEvent(const XMLCh *target, const XMLCh *value);
    00045   virtual void textEvent(const XMLCh *value);
    00046   virtual void textEvent(const XMLCh *chars, unsigned int length);
    00047   virtual void commentEvent(const XMLCh *value);
    00048   virtual void attributeEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname, const XMLCh *value,
    00049                               const XMLCh *typeURI, const XMLCh *typeName);
    00050   virtual void namespaceEvent(const XMLCh *prefix, const XMLCh *uri);
    00051
    00052 protected:
    00053   struct StackEntry {
    00054     StackEntry() : matched(false), nonElementChildren(false), attrChildren(false), children() {}
    00055
    00056     void addNode(const QueryPathNode *isn);
    00057     void addChildren(const QueryPathNode *isn);
    00058
    00059     XERCES_CPP_NAMESPACE_QUALIFIER XMLBuffer prefix;
    00060     XERCES_CPP_NAMESPACE_QUALIFIER XMLBuffer uri;
    00061     XERCES_CPP_NAMESPACE_QUALIFIER XMLBuffer localname;
    00062
    00063     bool matched;
    00064
    00065     bool nonElementChildren;
    00066     bool attrChildren;
    00067     QPNVector children;
    00068   };
    00069
    00070   typedef std::vector<StackEntry*> FilterStack;
    00071
    00072   void checkAncestors(FilterStack::reverse_iterator s);
    00073
    00074   FilterStack stack_;
    00075 };
    00076
    00077 #endif