source: NonGTP/Xerces/xerces/include/xercesc/validators/schema/identity/FieldActivator.hpp @ 358

Revision 358, 4.9 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
1/*
2 * Copyright 2001-2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * $Id: FieldActivator.hpp,v 1.7 2004/09/08 13:56:59 peiyongz Exp $
19 */
20
21#if !defined(FIELDACTIVATOR_HPP)
22#define FIELDACTIVATOR_HPP
23
24/**
25  * This class is responsible for activating fields within a specific scope;
26  * the caller merely requests the fields to be activated.
27  */
28
29// ---------------------------------------------------------------------------
30//  Includes
31// ---------------------------------------------------------------------------
32#include <xercesc/util/ValueHashTableOf.hpp>
33
34XERCES_CPP_NAMESPACE_BEGIN
35
36// ---------------------------------------------------------------------------
37//  Forward Declaration
38// ---------------------------------------------------------------------------
39class IdentityConstraint;
40class XPathMatcher;
41class ValueStoreCache;
42class IC_Field;
43class XPathMatcherStack;
44
45
46class VALIDATORS_EXPORT FieldActivator : public XMemory
47{
48public:
49    // -----------------------------------------------------------------------
50    //  Constructors/Destructor
51    // -----------------------------------------------------------------------
52    FieldActivator(ValueStoreCache* const valueStoreCache,
53                   XPathMatcherStack* const matcherStack,
54                   MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
55        FieldActivator(const FieldActivator& other);
56        ~FieldActivator();
57
58    // -----------------------------------------------------------------------
59    //  Operator methods
60    // -----------------------------------------------------------------------
61    FieldActivator& operator =(const FieldActivator& other);
62
63    // -----------------------------------------------------------------------
64    //  Getter methods
65    // -----------------------------------------------------------------------
66    bool getMayMatch(IC_Field* const field);
67
68    // -----------------------------------------------------------------------
69    //  Setter methods
70    // -----------------------------------------------------------------------
71    void setValueStoreCache(ValueStoreCache* const other);
72    void setMatcherStack(XPathMatcherStack* const matcherStack);
73    void setMayMatch(IC_Field* const field, bool value);
74
75        // -----------------------------------------------------------------------
76    //  Activation methods
77    // -----------------------------------------------------------------------
78    /**
79      * Start the value scope for the specified identity constraint. This
80      * method is called when the selector matches in order to initialize
81      * the value store.
82      */
83    void startValueScopeFor(const IdentityConstraint* const ic, const int initialDepth);
84
85    /**
86      * Request to activate the specified field. This method returns the
87      * matcher for the field.
88      */
89    XPathMatcher* activateField(IC_Field* const field, const int initialDepth);
90
91    /**
92      * Ends the value scope for the specified identity constraint.
93      */
94    void endValueScopeFor(const IdentityConstraint* const ic, const int initialDepth);
95
96private:
97    // -----------------------------------------------------------------------
98    //  Data
99    // -----------------------------------------------------------------------
100    ValueStoreCache*        fValueStoreCache;
101    XPathMatcherStack*      fMatcherStack;
102    ValueHashTableOf<bool>* fMayMatch;
103    MemoryManager*          fMemoryManager;
104};
105
106
107// ---------------------------------------------------------------------------
108//  FieldActivator: Getter methods
109// ---------------------------------------------------------------------------
110inline bool FieldActivator::getMayMatch(IC_Field* const field) {
111
112    return fMayMatch->get(field);
113}
114
115// ---------------------------------------------------------------------------
116//  FieldActivator: Setter methods
117// ---------------------------------------------------------------------------
118inline void FieldActivator::setValueStoreCache(ValueStoreCache* const other) {
119
120    fValueStoreCache = other;
121}
122
123inline void
124FieldActivator::setMatcherStack(XPathMatcherStack* const matcherStack) {
125
126    fMatcherStack = matcherStack;
127}
128
129inline void FieldActivator::setMayMatch(IC_Field* const field, bool value) {
130
131    fMayMatch->put(field, value);
132}
133
134XERCES_CPP_NAMESPACE_END
135
136#endif
137
138/**
139  * End of file FieldActivator.hpp
140  */
141
Note: See TracBrowser for help on using the repository browser.