Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:34:32

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  *
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  *
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_FIELDACTIVATOR_HPP)
0023 #define XERCESC_INCLUDE_GUARD_FIELDACTIVATOR_HPP
0024 
0025 /**
0026   * This class is responsible for activating fields within a specific scope;
0027   * the caller merely requests the fields to be activated.
0028   */
0029 
0030 // ---------------------------------------------------------------------------
0031 //  Includes
0032 // ---------------------------------------------------------------------------
0033 #include <xercesc/util/ValueHashTableOf.hpp>
0034 
0035 XERCES_CPP_NAMESPACE_BEGIN
0036 
0037 // ---------------------------------------------------------------------------
0038 //  Forward Declaration
0039 // ---------------------------------------------------------------------------
0040 class IdentityConstraint;
0041 class XPathMatcher;
0042 class ValueStoreCache;
0043 class IC_Field;
0044 class XPathMatcherStack;
0045 
0046 
0047 class VALIDATORS_EXPORT FieldActivator : public XMemory
0048 {
0049 public:
0050     // -----------------------------------------------------------------------
0051     //  Constructors/Destructor
0052     // -----------------------------------------------------------------------
0053     FieldActivator(ValueStoreCache* const valueStoreCache,
0054                    XPathMatcherStack* const matcherStack,
0055                    MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0056     FieldActivator(const FieldActivator& other);
0057     ~FieldActivator();
0058 
0059     // -----------------------------------------------------------------------
0060     //  Operator methods
0061     // -----------------------------------------------------------------------
0062     FieldActivator& operator =(const FieldActivator& other);
0063 
0064     // -----------------------------------------------------------------------
0065     //  Getter methods
0066     // -----------------------------------------------------------------------
0067     bool getMayMatch(IC_Field* const field);
0068 
0069     // -----------------------------------------------------------------------
0070     //  Setter methods
0071     // -----------------------------------------------------------------------
0072     void setValueStoreCache(ValueStoreCache* const other);
0073     void setMatcherStack(XPathMatcherStack* const matcherStack);
0074     void setMayMatch(IC_Field* const field, bool value);
0075 
0076     // -----------------------------------------------------------------------
0077     //  Activation methods
0078     // -----------------------------------------------------------------------
0079     /**
0080       * Start the value scope for the specified identity constraint. This
0081       * method is called when the selector matches in order to initialize
0082       * the value store.
0083       */
0084     void startValueScopeFor(const IdentityConstraint* const ic, const int initialDepth);
0085 
0086     /**
0087       * Request to activate the specified field. This method returns the
0088       * matcher for the field.
0089       */
0090     XPathMatcher* activateField(IC_Field* const field, const int initialDepth);
0091 
0092     /**
0093       * Ends the value scope for the specified identity constraint.
0094       */
0095     void endValueScopeFor(const IdentityConstraint* const ic, const int initialDepth);
0096 
0097 private:
0098     // -----------------------------------------------------------------------
0099     //  Data
0100     // -----------------------------------------------------------------------
0101     ValueStoreCache*                   fValueStoreCache;
0102     XPathMatcherStack*                 fMatcherStack;
0103     ValueHashTableOf<bool, PtrHasher>* fMayMatch;
0104     MemoryManager*                     fMemoryManager;
0105 };
0106 
0107 
0108 // ---------------------------------------------------------------------------
0109 //  FieldActivator: Getter methods
0110 // ---------------------------------------------------------------------------
0111 inline bool FieldActivator::getMayMatch(IC_Field* const field) {
0112 
0113     return fMayMatch->get(field);
0114 }
0115 
0116 // ---------------------------------------------------------------------------
0117 //  FieldActivator: Setter methods
0118 // ---------------------------------------------------------------------------
0119 inline void FieldActivator::setValueStoreCache(ValueStoreCache* const other) {
0120 
0121     fValueStoreCache = other;
0122 }
0123 
0124 inline void
0125 FieldActivator::setMatcherStack(XPathMatcherStack* const matcherStack) {
0126 
0127     fMatcherStack = matcherStack;
0128 }
0129 
0130 inline void FieldActivator::setMayMatch(IC_Field* const field, bool value) {
0131 
0132     fMayMatch->put(field, value);
0133 }
0134 
0135 XERCES_CPP_NAMESPACE_END
0136 
0137 #endif
0138 
0139 /**
0140   * End of file FieldActivator.hpp
0141   */