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

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

Original Xerces files with import mods for icxercesc

File size: 5.1 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;
45
46
47class VALIDATORS_EXPORT FieldActivator : public XMemory
48{
49public:
50    // -----------------------------------------------------------------------
51    //  Constructors/Destructor
52    // -----------------------------------------------------------------------
53    FieldActivator(ValueStoreCache* const valueStoreCache,
54                   XPathMatcherStack* const matcherStack,
55                   MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
56        FieldActivator(const FieldActivator& other);
57        ~FieldActivator();
58
59    // -----------------------------------------------------------------------
60    //  Operator methods
61    // -----------------------------------------------------------------------
62    FieldActivator& operator =(const FieldActivator& other);
63
64    // -----------------------------------------------------------------------
65    //  Getter methods
66    // -----------------------------------------------------------------------
67    bool getMayMatch(IC_Field* const field);
68
69    // -----------------------------------------------------------------------
70    //  Setter methods
71    // -----------------------------------------------------------------------
72    void setValueStoreCache(ValueStoreCache* const other);
73    void setMatcherStack(XPathMatcherStack* const matcherStack);
74    void setMayMatch(IC_Field* const field, bool value);
75
76        // -----------------------------------------------------------------------
77    //  Activation methods
78    // -----------------------------------------------------------------------
79    /**
80      * Start the value scope for the specified identity constraint. This
81      * method is called when the selector matches in order to initialize
82      * the value store.
83      */
84    void startValueScopeFor(const IdentityConstraint* const ic, const int initialDepth);
85
86    /**
87      * Request to activate the specified field. This method returns the
88      * matcher for the field.
89      */
90    XPathMatcher* activateField(IC_Field* const field, const int initialDepth);
91
92    /**
93      * Ends the value scope for the specified identity constraint.
94      */
95    void endValueScopeFor(const IdentityConstraint* const ic, const int initialDepth);
96
97private:
98    // -----------------------------------------------------------------------
99    //  Data
100    // -----------------------------------------------------------------------
101    ValueStoreCache*                   fValueStoreCache;
102    XPathMatcherStack*                 fMatcherStack;
103    ValueHashTableOf<bool, PtrHasher>* fMayMatch;
104    MemoryManager*                     fMemoryManager;
105};
106
107
108// ---------------------------------------------------------------------------
109//  FieldActivator: Getter methods
110// ---------------------------------------------------------------------------
111inline bool FieldActivator::getMayMatch(IC_Field* const field) {
112
113    return fMayMatch->get(field);
114}
115
116// ---------------------------------------------------------------------------
117//  FieldActivator: Setter methods
118// ---------------------------------------------------------------------------
119inline void FieldActivator::setValueStoreCache(ValueStoreCache* const other) {
120
121    fValueStoreCache = other;
122}
123
124inline void
125FieldActivator::setMatcherStack(XPathMatcherStack* const matcherStack) {
126
127    fMatcherStack = matcherStack;
128}
129
130inline void FieldActivator::setMayMatch(IC_Field* const field, bool value) {
131
132    fMayMatch->put(field, value);
133}
134
135XERCES_CPP_NAMESPACE_END
136
137#endif
138
139/**
140  * End of file FieldActivator.hpp
141  */
Note: See TracBrowser for help on using the repository browser.