source: icXML/icXML-devel/src/xercesc/validators/schema/identity/FieldActivator.hpp @ 3565

Last change on this file since 3565 was 3565, checked in by cameron, 6 years ago

Updates to xercesc sources

File size: 5.2 KB
Line 
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: FieldActivator.hpp 679340 2008-07-24 10:28:29Z borisk $
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_FIELDACTIVATOR_HPP)
23#define XERCESC_INCLUDE_GUARD_FIELDACTIVATOR_HPP
24
25/**
26  * This class is responsible for activating fields within a specific scope;
27  * the caller merely requests the fields to be activated.
28  */
29
30// ---------------------------------------------------------------------------
31//  Includes
32// ---------------------------------------------------------------------------
33#include <icxercesc/util/ValueHashTableOf.hpp>
34
35XERCES_CPP_NAMESPACE_BEGIN
36
37// ---------------------------------------------------------------------------
38//  Forward Declaration
39// ---------------------------------------------------------------------------
40class IdentityConstraint;
41class XPathMatcher;
42class ValueStoreCache;
43class IC_Field;
44class XPathMatcherStack;
45class XMLStringPool;
46
47class VALIDATORS_EXPORT FieldActivator : public XMemory
48{
49public:
50    // -----------------------------------------------------------------------
51    //  Constructors/Destructor
52    // -----------------------------------------------------------------------
53    FieldActivator
54    (
55        ValueStoreCache* const      valueStoreCache
56        , XPathMatcherStack* const  matcherStack
57        , MemoryManager* const      manager = XMLPlatformUtils::fgMemoryManager
58    );
59
60        FieldActivator(const FieldActivator& other);
61
62
63        ~FieldActivator();
64
65    // -----------------------------------------------------------------------
66    //  Operator methods
67    // -----------------------------------------------------------------------
68    FieldActivator& operator =(const FieldActivator& other);
69
70    // -----------------------------------------------------------------------
71    //  Getter methods
72    // -----------------------------------------------------------------------
73    bool getMayMatch(IC_Field* const field);
74
75    // -----------------------------------------------------------------------
76    //  Setter methods
77    // -----------------------------------------------------------------------
78    void setValueStoreCache(ValueStoreCache* const other);
79    void setMatcherStack(XPathMatcherStack* const matcherStack);
80    void setMayMatch(IC_Field* const field, bool value);
81
82        // -----------------------------------------------------------------------
83    //  Activation methods
84    // -----------------------------------------------------------------------
85    /**
86      * Start the value scope for the specified identity constraint. This
87      * method is called when the selector matches in order to initialize
88      * the value store.
89      */
90    void startValueScopeFor(const IdentityConstraint* const ic, const int initialDepth);
91
92    /**
93      * Request to activate the specified field. This method returns the
94      * matcher for the field.
95      */
96    XPathMatcher* activateField(IC_Field* const field, const int initialDepth);
97
98    XPathMatcher* activateField(IC_Field* const field, XMLStringPool * const stringPool, const int initialDepth);
99
100    /**
101      * Ends the value scope for the specified identity constraint.
102      */
103    void endValueScopeFor(const IdentityConstraint* const ic, const int initialDepth);
104
105private:
106    // -----------------------------------------------------------------------
107    //  Data
108    // -----------------------------------------------------------------------
109    ValueStoreCache*                   fValueStoreCache;
110    XPathMatcherStack*                 fMatcherStack;
111    ValueHashTableOf<bool, PtrHasher>* fMayMatch;
112    MemoryManager*                     fMemoryManager;
113};
114
115
116// ---------------------------------------------------------------------------
117//  FieldActivator: Getter methods
118// ---------------------------------------------------------------------------
119inline bool FieldActivator::getMayMatch(IC_Field* const field) {
120
121    return fMayMatch->get(field);
122}
123
124// ---------------------------------------------------------------------------
125//  FieldActivator: Setter methods
126// ---------------------------------------------------------------------------
127inline void FieldActivator::setValueStoreCache(ValueStoreCache* const other) {
128
129    fValueStoreCache = other;
130}
131
132inline void
133FieldActivator::setMatcherStack(XPathMatcherStack* const matcherStack) {
134
135    fMatcherStack = matcherStack;
136}
137
138inline void FieldActivator::setMayMatch(IC_Field* const field, bool value) {
139
140    fMayMatch->put(field, value);
141}
142
143XERCES_CPP_NAMESPACE_END
144
145#endif
146
147/**
148  * End of file FieldActivator.hpp
149  */
Note: See TracBrowser for help on using the repository browser.