[2674] | 1 | /* |
---|
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
---|
| 3 | * contributor license agreements. See the NOTICE file distributed with |
---|
| 4 | * this work for additional information regarding copyright ownership. |
---|
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
| 6 | * (the "License"); you may not use this file except in compliance with |
---|
| 7 | * the License. You may obtain a copy of the License at |
---|
| 8 | * |
---|
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 10 | * |
---|
| 11 | * Unless required by applicable law or agreed to in writing, software |
---|
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 14 | * See the License for the specific language governing permissions and |
---|
| 15 | * limitations under the License. |
---|
| 16 | */ |
---|
| 17 | |
---|
| 18 | /* |
---|
| 19 | * $Id: IC_Selector.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | #if !defined(IC_SELECTOR_HPP) |
---|
| 23 | #define IC_SELECTOR_HPP |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | // --------------------------------------------------------------------------- |
---|
| 27 | // Includes |
---|
| 28 | // --------------------------------------------------------------------------- |
---|
| 29 | #include <xercesc/validators/schema/identity/XPathMatcher.hpp> |
---|
| 30 | |
---|
| 31 | #include <xercesc/internal/XSerializable.hpp> |
---|
| 32 | |
---|
| 33 | XERCES_CPP_NAMESPACE_BEGIN |
---|
| 34 | |
---|
| 35 | // --------------------------------------------------------------------------- |
---|
| 36 | // Forward Declaration |
---|
| 37 | // --------------------------------------------------------------------------- |
---|
| 38 | class FieldActivator; |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | class VALIDATORS_EXPORT IC_Selector : public XSerializable, public XMemory |
---|
| 42 | { |
---|
| 43 | public: |
---|
| 44 | // ----------------------------------------------------------------------- |
---|
| 45 | // Constructors/Destructor |
---|
| 46 | // ----------------------------------------------------------------------- |
---|
| 47 | IC_Selector(XercesXPath* const xpath, |
---|
| 48 | IdentityConstraint* const identityConstraint); |
---|
| 49 | ~IC_Selector(); |
---|
| 50 | |
---|
| 51 | // ----------------------------------------------------------------------- |
---|
| 52 | // operators |
---|
| 53 | // ----------------------------------------------------------------------- |
---|
| 54 | bool operator== (const IC_Selector& other) const; |
---|
| 55 | bool operator!= (const IC_Selector& other) const; |
---|
| 56 | |
---|
| 57 | // ----------------------------------------------------------------------- |
---|
| 58 | // Getter methods |
---|
| 59 | // ----------------------------------------------------------------------- |
---|
| 60 | XercesXPath* getXPath() const { return fXPath; } |
---|
| 61 | IdentityConstraint* getIdentityConstraint() const { return fIdentityConstraint; } |
---|
| 62 | |
---|
| 63 | // ----------------------------------------------------------------------- |
---|
| 64 | // Factory methods |
---|
| 65 | // ----------------------------------------------------------------------- |
---|
| 66 | XPathMatcher* createMatcher(FieldActivator* const fieldActivator, |
---|
| 67 | const int initialDepth, |
---|
| 68 | MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
---|
| 69 | |
---|
| 70 | /*** |
---|
| 71 | * Support for Serialization/De-serialization |
---|
| 72 | ***/ |
---|
| 73 | DECL_XSERIALIZABLE(IC_Selector) |
---|
| 74 | |
---|
| 75 | IC_Selector(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
---|
| 76 | |
---|
| 77 | private: |
---|
| 78 | // ----------------------------------------------------------------------- |
---|
| 79 | // Unimplemented contstructors and operators |
---|
| 80 | // ----------------------------------------------------------------------- |
---|
| 81 | IC_Selector(const IC_Selector& other); |
---|
| 82 | IC_Selector& operator= (const IC_Selector& other); |
---|
| 83 | |
---|
| 84 | // ----------------------------------------------------------------------- |
---|
| 85 | // Data members |
---|
| 86 | // ----------------------------------------------------------------------- |
---|
| 87 | XercesXPath* fXPath; |
---|
| 88 | IdentityConstraint* fIdentityConstraint; |
---|
| 89 | }; |
---|
| 90 | |
---|
| 91 | |
---|
| 92 | class VALIDATORS_EXPORT SelectorMatcher : public XPathMatcher |
---|
| 93 | { |
---|
| 94 | public: |
---|
| 95 | // ----------------------------------------------------------------------- |
---|
| 96 | // Constructors/Destructor |
---|
| 97 | // ----------------------------------------------------------------------- |
---|
| 98 | ~SelectorMatcher() {} |
---|
| 99 | |
---|
| 100 | int getInitialDepth() const { return fInitialDepth; } |
---|
| 101 | |
---|
| 102 | // ----------------------------------------------------------------------- |
---|
| 103 | // XMLDocumentHandler methods |
---|
| 104 | // ----------------------------------------------------------------------- |
---|
| 105 | void startDocumentFragment(); |
---|
| 106 | void startElement(const XMLElementDecl& elemDecl, |
---|
| 107 | const unsigned int urlId, |
---|
| 108 | const XMLCh* const elemPrefix, |
---|
| 109 | const RefVectorOf<XMLAttr>& attrList, |
---|
| 110 | const unsigned int attrCount); |
---|
| 111 | void endElement(const XMLElementDecl& elemDecl, |
---|
| 112 | const XMLCh* const elemContent); |
---|
| 113 | |
---|
| 114 | private: |
---|
| 115 | // ----------------------------------------------------------------------- |
---|
| 116 | // Constructors/Destructor |
---|
| 117 | // ----------------------------------------------------------------------- |
---|
| 118 | SelectorMatcher(XercesXPath* const anXPath, |
---|
| 119 | IC_Selector* const selector, |
---|
| 120 | FieldActivator* const fieldActivator, |
---|
| 121 | const int initialDepth, |
---|
| 122 | MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
---|
| 123 | |
---|
| 124 | // ----------------------------------------------------------------------- |
---|
| 125 | // Unimplemented contstructors and operators |
---|
| 126 | // ----------------------------------------------------------------------- |
---|
| 127 | SelectorMatcher(const SelectorMatcher& other); |
---|
| 128 | SelectorMatcher& operator= (const SelectorMatcher& other); |
---|
| 129 | |
---|
| 130 | // ----------------------------------------------------------------------- |
---|
| 131 | // Friends |
---|
| 132 | // ----------------------------------------------------------------------- |
---|
| 133 | friend class IC_Selector; |
---|
| 134 | |
---|
| 135 | // ----------------------------------------------------------------------- |
---|
| 136 | // Data members |
---|
| 137 | // ----------------------------------------------------------------------- |
---|
| 138 | int fInitialDepth; |
---|
| 139 | int fElementDepth; |
---|
| 140 | int fMatchedDepth; |
---|
| 141 | IC_Selector* fSelector; |
---|
| 142 | FieldActivator* fFieldActivator; |
---|
| 143 | }; |
---|
| 144 | |
---|
| 145 | XERCES_CPP_NAMESPACE_END |
---|
| 146 | |
---|
| 147 | #endif |
---|
| 148 | |
---|
| 149 | /** |
---|
| 150 | * End of file IC_Selector.hpp |
---|
| 151 | */ |
---|
| 152 | |
---|