[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: IdentityConstraintHandler.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | #if !defined(IDENTITYCONSTRAINT_HANDLER_HPP) |
---|
| 23 | #define IDENTITYCONSTRAINT_HANDLER_HPP |
---|
| 24 | |
---|
| 25 | // --------------------------------------------------------------------------- |
---|
| 26 | // Includes |
---|
| 27 | // --------------------------------------------------------------------------- |
---|
| 28 | #include <xercesc/validators/schema/identity/ValueStoreCache.hpp> |
---|
| 29 | #include <xercesc/validators/schema/identity/XPathMatcherStack.hpp> |
---|
| 30 | |
---|
| 31 | XERCES_CPP_NAMESPACE_BEGIN |
---|
| 32 | |
---|
| 33 | // --------------------------------------------------------------------------- |
---|
| 34 | // Forward Declarations |
---|
| 35 | // --------------------------------------------------------------------------- |
---|
| 36 | |
---|
| 37 | class XMLScanner; |
---|
| 38 | class FieldActivator; |
---|
| 39 | class MemoryManager; |
---|
| 40 | class XMLElementDecl; |
---|
| 41 | |
---|
| 42 | class VALIDATORS_EXPORT IdentityConstraintHandler: public XMemory |
---|
| 43 | { |
---|
| 44 | public: |
---|
| 45 | |
---|
| 46 | // ----------------------------------------------------------------------- |
---|
| 47 | // Constructors/Destructor |
---|
| 48 | // ----------------------------------------------------------------------- |
---|
| 49 | virtual ~IdentityConstraintHandler(); |
---|
| 50 | |
---|
| 51 | IdentityConstraintHandler |
---|
| 52 | ( |
---|
| 53 | XMLScanner* const scanner |
---|
| 54 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
---|
| 55 | ); |
---|
| 56 | |
---|
| 57 | // ----------------------------------------------------------------------- |
---|
| 58 | // Getter methods |
---|
| 59 | // ----------------------------------------------------------------------- |
---|
| 60 | inline int getMatcherCount() const; |
---|
| 61 | |
---|
| 62 | // ----------------------------------------------------------------------- |
---|
| 63 | // Setter methods |
---|
| 64 | // ----------------------------------------------------------------------- |
---|
| 65 | |
---|
| 66 | // ----------------------------------------------------------------------- |
---|
| 67 | // Access methods |
---|
| 68 | // ----------------------------------------------------------------------- |
---|
| 69 | inline void endDocument(); |
---|
| 70 | |
---|
| 71 | void deactivateContext |
---|
| 72 | ( |
---|
| 73 | SchemaElementDecl* const elem |
---|
| 74 | , const XMLCh* const content |
---|
| 75 | ); |
---|
| 76 | |
---|
| 77 | void activateIdentityConstraint |
---|
| 78 | ( |
---|
| 79 | SchemaElementDecl* const elem |
---|
| 80 | , int elemDepth |
---|
| 81 | , const unsigned int uriId |
---|
| 82 | , const XMLCh* const elemPrefix |
---|
| 83 | , const RefVectorOf<XMLAttr>& attrList |
---|
| 84 | , const unsigned int attrCount |
---|
| 85 | ); |
---|
| 86 | |
---|
| 87 | void reset(); |
---|
| 88 | |
---|
| 89 | private: |
---|
| 90 | // ----------------------------------------------------------------------- |
---|
| 91 | // Unimplemented contstructors and operators |
---|
| 92 | // ----------------------------------------------------------------------- |
---|
| 93 | IdentityConstraintHandler(const IdentityConstraintHandler& other); |
---|
| 94 | IdentityConstraintHandler& operator= (const IdentityConstraintHandler& other); |
---|
| 95 | |
---|
| 96 | // ----------------------------------------------------------------------- |
---|
| 97 | // CleanUp methods |
---|
| 98 | // ----------------------------------------------------------------------- |
---|
| 99 | void cleanUp(); |
---|
| 100 | |
---|
| 101 | // ----------------------------------------------------------------------- |
---|
| 102 | // Helper |
---|
| 103 | // ----------------------------------------------------------------------- |
---|
| 104 | void activateSelectorFor( |
---|
| 105 | IdentityConstraint* const ic |
---|
| 106 | , const int initialDepth |
---|
| 107 | ) ; |
---|
| 108 | |
---|
| 109 | // ----------------------------------------------------------------------- |
---|
| 110 | // Data members |
---|
| 111 | // |
---|
| 112 | // fMatcherStack |
---|
| 113 | // Stack of active XPath matchers for identity constraints. All |
---|
| 114 | // active XPath matchers are notified of startElement, characters |
---|
| 115 | // and endElement callbacks in order to perform their matches. |
---|
| 116 | // |
---|
| 117 | // fValueStoreCache |
---|
| 118 | // Cache of value stores for identity constraint fields. |
---|
| 119 | // |
---|
| 120 | // fFieldActivator |
---|
| 121 | // Activates fields within a certain scope when a selector matches |
---|
| 122 | // its xpath. |
---|
| 123 | // |
---|
| 124 | // ----------------------------------------------------------------------- |
---|
| 125 | XMLScanner* fScanner; |
---|
| 126 | MemoryManager* fMemoryManager; |
---|
| 127 | |
---|
| 128 | XPathMatcherStack* fMatcherStack; |
---|
| 129 | ValueStoreCache* fValueStoreCache; |
---|
| 130 | FieldActivator* fFieldActivator; |
---|
| 131 | |
---|
| 132 | }; |
---|
| 133 | |
---|
| 134 | |
---|
| 135 | // --------------------------------------------------------------------------- |
---|
| 136 | // IdentityConstraintHandler: |
---|
| 137 | // --------------------------------------------------------------------------- |
---|
| 138 | |
---|
| 139 | inline |
---|
| 140 | void IdentityConstraintHandler::endDocument() |
---|
| 141 | { |
---|
| 142 | fValueStoreCache->endDocument(); |
---|
| 143 | } |
---|
| 144 | |
---|
| 145 | inline |
---|
| 146 | int IdentityConstraintHandler::getMatcherCount() const |
---|
| 147 | { |
---|
| 148 | return fMatcherStack->getMatcherCount(); |
---|
| 149 | } |
---|
| 150 | |
---|
| 151 | XERCES_CPP_NAMESPACE_END |
---|
| 152 | |
---|
| 153 | #endif |
---|
| 154 | |
---|
| 155 | /** |
---|
| 156 | * End of file IdentityConstraintHandler.hpp |
---|
| 157 | */ |
---|
| 158 | |
---|