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