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: AnySimpleTypeDatatypeValidator.hpp,v 1.12 2004/09/08 13:56:52 peiyongz Exp $
|
---|
19 | */
|
---|
20 |
|
---|
21 | #if !defined(ANYSIMPLETYPEDATATYPEVALIDATOR_HPP)
|
---|
22 | #define ANYSIMPLETYPEDATATYPEVALIDATOR_HPP
|
---|
23 |
|
---|
24 | #include <xercesc/validators/datatype/DatatypeValidator.hpp>
|
---|
25 |
|
---|
26 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
27 |
|
---|
28 | class VALIDATORS_EXPORT AnySimpleTypeDatatypeValidator : public DatatypeValidator
|
---|
29 | {
|
---|
30 | public:
|
---|
31 | // -----------------------------------------------------------------------
|
---|
32 | // Public Constructor
|
---|
33 | // -----------------------------------------------------------------------
|
---|
34 | /** @name Constructor */
|
---|
35 | //@{
|
---|
36 |
|
---|
37 | AnySimpleTypeDatatypeValidator
|
---|
38 | (
|
---|
39 | MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
40 | );
|
---|
41 |
|
---|
42 | //@}
|
---|
43 |
|
---|
44 | // -----------------------------------------------------------------------
|
---|
45 | // Public Destructor
|
---|
46 | // -----------------------------------------------------------------------
|
---|
47 | /** @name Destructor. */
|
---|
48 | //@{
|
---|
49 |
|
---|
50 | virtual ~AnySimpleTypeDatatypeValidator();
|
---|
51 |
|
---|
52 | //@}
|
---|
53 |
|
---|
54 | virtual const RefArrayVectorOf<XMLCh>* getEnumString() const;
|
---|
55 |
|
---|
56 | // -----------------------------------------------------------------------
|
---|
57 | // Getter methods
|
---|
58 | // -----------------------------------------------------------------------
|
---|
59 | /** @name Getter Functions */
|
---|
60 | //@{
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * Returns whether the type is atomic or not
|
---|
64 | */
|
---|
65 | virtual bool isAtomic() const;
|
---|
66 |
|
---|
67 | //@}
|
---|
68 |
|
---|
69 | // -----------------------------------------------------------------------
|
---|
70 | // Validation methods
|
---|
71 | // -----------------------------------------------------------------------
|
---|
72 | /** @name Validation Function */
|
---|
73 | //@{
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * Checks that the "content" string is valid datatype.
|
---|
77 | * If invalid, a Datatype validation exception is thrown.
|
---|
78 | *
|
---|
79 | * @param content A string containing the content to be validated
|
---|
80 | *
|
---|
81 | */
|
---|
82 | virtual void validate
|
---|
83 | (
|
---|
84 | const XMLCh* const content
|
---|
85 | , ValidationContext* const context = 0
|
---|
86 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
87 | );
|
---|
88 |
|
---|
89 | /**
|
---|
90 | * Checks whether a given type can be used as a substitute
|
---|
91 | *
|
---|
92 | * @param toCheck A datatype validator of the type to be used as a
|
---|
93 | * substitute
|
---|
94 | *
|
---|
95 | */
|
---|
96 |
|
---|
97 | bool isSubstitutableBy(const DatatypeValidator* const toCheck);
|
---|
98 |
|
---|
99 | //@}
|
---|
100 |
|
---|
101 | // -----------------------------------------------------------------------
|
---|
102 | // Compare methods
|
---|
103 | // -----------------------------------------------------------------------
|
---|
104 | /** @name Compare Function */
|
---|
105 | //@{
|
---|
106 |
|
---|
107 | /**
|
---|
108 | * Compares content in the Domain value vs. lexical value.
|
---|
109 | *
|
---|
110 | * @param value1 string to compare
|
---|
111 | *
|
---|
112 | * @param value2 string to compare
|
---|
113 | *
|
---|
114 | */
|
---|
115 | int compare(const XMLCh* const value1, const XMLCh* const value2
|
---|
116 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
117 | );
|
---|
118 |
|
---|
119 | //@}
|
---|
120 |
|
---|
121 | /**
|
---|
122 | * Returns an instance of the base datatype validator class
|
---|
123 | * Used by the DatatypeValidatorFactory.
|
---|
124 | */
|
---|
125 | virtual DatatypeValidator* newInstance
|
---|
126 | (
|
---|
127 | RefHashTableOf<KVStringPair>* const facets
|
---|
128 | , RefArrayVectorOf<XMLCh>* const enums
|
---|
129 | , const int finalSet
|
---|
130 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
131 | );
|
---|
132 |
|
---|
133 | /***
|
---|
134 | * Support for Serialization/De-serialization
|
---|
135 | ***/
|
---|
136 | DECL_XSERIALIZABLE(AnySimpleTypeDatatypeValidator)
|
---|
137 |
|
---|
138 | private:
|
---|
139 | // -----------------------------------------------------------------------
|
---|
140 | // Unimplemented constructors and operators
|
---|
141 | // -----------------------------------------------------------------------
|
---|
142 | AnySimpleTypeDatatypeValidator(const AnySimpleTypeDatatypeValidator&);
|
---|
143 | AnySimpleTypeDatatypeValidator& operator=(const AnySimpleTypeDatatypeValidator&);
|
---|
144 | };
|
---|
145 |
|
---|
146 |
|
---|
147 | // ---------------------------------------------------------------------------
|
---|
148 | // DatatypeValidator: Getters
|
---|
149 | // ---------------------------------------------------------------------------
|
---|
150 | inline bool AnySimpleTypeDatatypeValidator::isAtomic() const {
|
---|
151 |
|
---|
152 | return false;
|
---|
153 | }
|
---|
154 |
|
---|
155 |
|
---|
156 | // ---------------------------------------------------------------------------
|
---|
157 | // DatatypeValidators: Compare methods
|
---|
158 | // ---------------------------------------------------------------------------
|
---|
159 | inline int AnySimpleTypeDatatypeValidator::compare(const XMLCh* const,
|
---|
160 | const XMLCh* const
|
---|
161 | , MemoryManager* const)
|
---|
162 | {
|
---|
163 | return -1;
|
---|
164 | }
|
---|
165 |
|
---|
166 | // ---------------------------------------------------------------------------
|
---|
167 | // DatatypeValidators: Validation methods
|
---|
168 | // ---------------------------------------------------------------------------
|
---|
169 | inline bool
|
---|
170 | AnySimpleTypeDatatypeValidator::isSubstitutableBy(const DatatypeValidator* const)
|
---|
171 | {
|
---|
172 | return true;
|
---|
173 | }
|
---|
174 |
|
---|
175 | inline void
|
---|
176 | AnySimpleTypeDatatypeValidator::validate(const XMLCh* const
|
---|
177 | , ValidationContext* const
|
---|
178 | , MemoryManager* const)
|
---|
179 | {
|
---|
180 | return;
|
---|
181 | }
|
---|
182 |
|
---|
183 | XERCES_CPP_NAMESPACE_END
|
---|
184 |
|
---|
185 | #endif
|
---|
186 |
|
---|
187 | /**
|
---|
188 | * End of file AnySimpleTypeDatatypeValidator.hpp
|
---|
189 | */
|
---|
190 |
|
---|