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: ValidationContextImpl.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
20 | */ |
---|
21 | |
---|
22 | #if !defined(VALIDATION_CONTEXTIMPL_HPP) |
---|
23 | #define VALIDATION_CONTEXTIMPL_HPP |
---|
24 | |
---|
25 | #include <xercesc/framework/ValidationContext.hpp> |
---|
26 | |
---|
27 | XERCES_CPP_NAMESPACE_BEGIN |
---|
28 | class ElemStack; |
---|
29 | |
---|
30 | class XMLPARSER_EXPORT ValidationContextImpl : public ValidationContext |
---|
31 | { |
---|
32 | public : |
---|
33 | // ----------------------------------------------------------------------- |
---|
34 | /** @name Virtual destructor for derived classes */ |
---|
35 | // ----------------------------------------------------------------------- |
---|
36 | //@{ |
---|
37 | |
---|
38 | /** |
---|
39 | * virtual destructor |
---|
40 | * |
---|
41 | */ |
---|
42 | virtual ~ValidationContextImpl(); |
---|
43 | |
---|
44 | ValidationContextImpl(MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager); |
---|
45 | |
---|
46 | //@} |
---|
47 | |
---|
48 | // ----------------------------------------------------------------------- |
---|
49 | /** @name The ValidationContextImpl Interface */ |
---|
50 | // ----------------------------------------------------------------------- |
---|
51 | //@{ |
---|
52 | |
---|
53 | /** |
---|
54 | * IDRefList |
---|
55 | * |
---|
56 | */ |
---|
57 | virtual RefHashTableOf<XMLRefInfo>* getIdRefList() const; |
---|
58 | |
---|
59 | virtual void setIdRefList(RefHashTableOf<XMLRefInfo>* const); |
---|
60 | |
---|
61 | virtual void clearIdRefList(); |
---|
62 | |
---|
63 | virtual void addId(const XMLCh * const ); |
---|
64 | |
---|
65 | virtual void addIdRef(const XMLCh * const ); |
---|
66 | |
---|
67 | virtual void toCheckIdRefList(bool); |
---|
68 | |
---|
69 | /** |
---|
70 | * EntityDeclPool |
---|
71 | * |
---|
72 | */ |
---|
73 | virtual const NameIdPool<DTDEntityDecl>* getEntityDeclPool() const; |
---|
74 | |
---|
75 | virtual const NameIdPool<DTDEntityDecl>* setEntityDeclPool(const NameIdPool<DTDEntityDecl>* const); |
---|
76 | |
---|
77 | virtual void checkEntity(const XMLCh * const ) const; |
---|
78 | |
---|
79 | |
---|
80 | /** |
---|
81 | * Union datatype handling |
---|
82 | * |
---|
83 | */ |
---|
84 | |
---|
85 | virtual DatatypeValidator * getValidatingMemberType() const; |
---|
86 | virtual void setValidatingMemberType(DatatypeValidator * validatingMemberType) ; |
---|
87 | |
---|
88 | /** |
---|
89 | * QName datatype handling |
---|
90 | * Create default implementations for source code compatibility |
---|
91 | */ |
---|
92 | virtual bool isPrefixUnknown(XMLCh* prefix); |
---|
93 | virtual void setElemStack(ElemStack* elemStack); |
---|
94 | |
---|
95 | //@} |
---|
96 | |
---|
97 | private: |
---|
98 | // ----------------------------------------------------------------------- |
---|
99 | /** name Unimplemented copy constructor and operator= */ |
---|
100 | // ----------------------------------------------------------------------- |
---|
101 | //@{ |
---|
102 | ValidationContextImpl(const ValidationContextImpl& ); |
---|
103 | ValidationContextImpl& operator=(const ValidationContextImpl& ); |
---|
104 | //@} |
---|
105 | |
---|
106 | // ----------------------------------------------------------------------- |
---|
107 | // Data members |
---|
108 | // |
---|
109 | // fIDRefList: owned/adopted |
---|
110 | // This is a list of XMLRefInfo objects. This member lets us do all |
---|
111 | // needed ID-IDREF balancing checks. |
---|
112 | // |
---|
113 | // fEntityDeclPool: referenced only |
---|
114 | // This is a pool of EntityDecl objects, which contains all of the |
---|
115 | // general entities that are declared in the DTD subsets, plus the |
---|
116 | // default entities (such as > < ...) defined by the XML Standard. |
---|
117 | // |
---|
118 | // fToAddToList |
---|
119 | // fValidatingMemberType |
---|
120 | // The member type in a union that actually |
---|
121 | // validated some text. Note that the validationContext does not |
---|
122 | // own this object, and the value of getValidatingMemberType |
---|
123 | // will not be accurate unless the type of the most recently-validated |
---|
124 | // element/attribute is in fact a union datatype. |
---|
125 | // fElemStack |
---|
126 | // Need access to elemstack to look up URI's that are inscope. |
---|
127 | // ----------------------------------------------------------------------- |
---|
128 | |
---|
129 | RefHashTableOf<XMLRefInfo>* fIdRefList; |
---|
130 | const NameIdPool<DTDEntityDecl>* fEntityDeclPool; |
---|
131 | bool fToCheckIdRefList; |
---|
132 | DatatypeValidator * fValidatingMemberType; |
---|
133 | ElemStack* fElemStack; |
---|
134 | |
---|
135 | }; |
---|
136 | |
---|
137 | |
---|
138 | |
---|
139 | inline DatatypeValidator * ValidationContextImpl::getValidatingMemberType() const |
---|
140 | { |
---|
141 | return fValidatingMemberType; |
---|
142 | } |
---|
143 | |
---|
144 | inline void ValidationContextImpl::setValidatingMemberType(DatatypeValidator * validatingMemberType) |
---|
145 | { |
---|
146 | fValidatingMemberType = validatingMemberType; |
---|
147 | } |
---|
148 | |
---|
149 | inline void ValidationContextImpl::setElemStack(ElemStack* elemStack) { |
---|
150 | fElemStack = elemStack; |
---|
151 | } |
---|
152 | |
---|
153 | XERCES_CPP_NAMESPACE_END |
---|
154 | |
---|
155 | #endif |
---|