SourceForge.net Logo

QueryPathTreeFilter.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001-2007
00003  *     DecisionSoft Limited. All rights reserved.
00004  * Copyright (c) 2004-2007
00005  *     Oracle. All rights reserved.
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  * $Id: QueryPathTreeFilter.hpp,v 1.3 2007/11/29 16:53:01 jpcs Exp $
00020  */
00021 
00022 #ifndef _QUERYPATHTREEFILTER_HPP
00023 #define _QUERYPATHTREEFILTER_HPP
00024 
00025 #include <vector>
00026 
00027 #include <xqilla/events/EventHandler.hpp>
00028 
00029 #include <xercesc/framework/XMLBuffer.hpp>
00030 
00031 class QueryPathNode;
00032 typedef std::vector<const QueryPathNode *> QPNVector;
00033 
00034 class XQILLA_API QueryPathTreeFilter : public EventFilter
00035 {
00036 public:
00037   QueryPathTreeFilter(const QueryPathNode *qpn, EventHandler *next);
00038   QueryPathTreeFilter(const QPNVector &qpns, EventHandler *next);
00039   virtual ~QueryPathTreeFilter();
00040 
00041   virtual void startDocumentEvent(const XMLCh *documentURI, const XMLCh *encoding);
00042   virtual void endDocumentEvent();
00043   virtual void startElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname);
00044   virtual void endElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname,
00045                                const XMLCh *typeURI, const XMLCh *typeName);
00046   virtual void piEvent(const XMLCh *target, const XMLCh *value);
00047   virtual void textEvent(const XMLCh *value);
00048   virtual void textEvent(const XMLCh *chars, unsigned int length);
00049   virtual void commentEvent(const XMLCh *value);
00050   virtual void attributeEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname, const XMLCh *value,
00051                               const XMLCh *typeURI, const XMLCh *typeName);
00052   virtual void namespaceEvent(const XMLCh *prefix, const XMLCh *uri);
00053 
00054 protected:
00055   struct StackEntry {
00056     StackEntry() : matched(false), nonElementChildren(false), attrChildren(false), children() {}
00057 
00058     void addNode(const QueryPathNode *isn);
00059     void addChildren(const QueryPathNode *isn);
00060 
00061     XERCES_CPP_NAMESPACE_QUALIFIER XMLBuffer prefix;
00062     XERCES_CPP_NAMESPACE_QUALIFIER XMLBuffer uri;
00063     XERCES_CPP_NAMESPACE_QUALIFIER XMLBuffer localname;
00064 
00065     bool matched;
00066 
00067     bool nonElementChildren;
00068     bool attrChildren;
00069     QPNVector children;
00070   };
00071 
00072   typedef std::vector<StackEntry*> FilterStack;
00073 
00074   void checkAncestors(FilterStack::reverse_iterator s);
00075 
00076   FilterStack stack_;
00077 };
00078 
00079 #endif

Generated on Mon Jan 5 08:57:48 2009 for XQilla Simple API by  doxygen 1.4.7