|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 /* |
|
18 * Licensed to the Apache Software Foundation (ASF) under one or more |
|
19 * contributor license agreements. See the NOTICE file distributed with |
|
20 * this work for additional information regarding copyright ownership. |
|
21 * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
22 * (the "License"); you may not use this file except in compliance with |
|
23 * the License. You may obtain a copy of the License at |
|
24 * |
|
25 * http://www.apache.org/licenses/LICENSE-2.0 |
|
26 * |
|
27 * Unless required by applicable law or agreed to in writing, software |
|
28 * distributed under the License is distributed on an "AS IS" BASIS, |
|
29 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
30 * See the License for the specific language governing permissions and |
|
31 * limitations under the License. |
|
32 */ |
|
33 |
|
34 /* |
|
35 * $Id: DatatypeValidator.hpp 568078 2007-08-21 11:43:25Z amassari $ |
|
36 */ |
|
37 |
|
38 #if !defined(DATATYPEVALIDATOR_HPP) |
|
39 #define DATATYPEVALIDATOR_HPP |
|
40 |
|
41 #include <xercesc/util/PlatformUtils.hpp> |
|
42 #include <xercesc/util/RefHashTableOf.hpp> |
|
43 #include <xercesc/util/KVStringPair.hpp> |
|
44 #include <xercesc/util/XMLUniDefs.hpp> |
|
45 #include <xercesc/util/regx/RegularExpression.hpp> |
|
46 #include <xercesc/validators/schema/SchemaSymbols.hpp> |
|
47 #include <xercesc/internal/XSerializable.hpp> |
|
48 #include <xercesc/framework/psvi/XSSimpleTypeDefinition.hpp> |
|
49 #include <xercesc/framework/ValidationContext.hpp> |
|
50 |
|
51 XERCES_CPP_NAMESPACE_BEGIN |
|
52 |
|
53 class MemoryManager; |
|
54 |
|
55 /** |
|
56 * DataTypeValidator defines the interface that data type validators must |
|
57 * obey. These validators can be supplied by the application writer and may |
|
58 * be useful as standalone code as well as plugins to the validator |
|
59 * architecture. |
|
60 * |
|
61 * Notice: |
|
62 * The datatype validator will own the facets hashtable passed to it during |
|
63 * construction, which means that the datatype validator will be responsible |
|
64 * for the deletion. The facets hashtable will be created during parsing and |
|
65 * passed to the appropriate datatype validator which in turn will delete it |
|
66 * upon its destruction. |
|
67 * |
|
68 */ |
|
69 |
|
70 |
|
71 class VALIDATORS_EXPORT DatatypeValidator : public XSerializable, public XMemory |
|
72 { |
|
73 public: |
|
74 // ----------------------------------------------------------------------- |
|
75 // Constant data |
|
76 // ----------------------------------------------------------------------- |
|
77 //facets |
|
78 enum { |
|
79 FACET_LENGTH = 1, |
|
80 FACET_MINLENGTH = 1<<1, |
|
81 FACET_MAXLENGTH = 1<<2, |
|
82 FACET_PATTERN = 1<<3, |
|
83 FACET_ENUMERATION = 1<<4, |
|
84 FACET_MAXINCLUSIVE = 1<<5, |
|
85 FACET_MAXEXCLUSIVE = 1<<6, |
|
86 FACET_MININCLUSIVE = 1<<7, |
|
87 FACET_MINEXCLUSIVE = 1<<8, |
|
88 FACET_TOTALDIGITS = 1<<9, |
|
89 FACET_FRACTIONDIGITS = 1<<10, |
|
90 FACET_ENCODING = 1<<11, |
|
91 FACET_DURATION = 1<<12, |
|
92 FACET_PERIOD = 1<<13, |
|
93 FACET_WHITESPACE = 1<<14 |
|
94 }; |
|
95 |
|
96 //2.4.2.6 whiteSpace - Datatypes |
|
97 enum { |
|
98 PRESERVE = 0, |
|
99 REPLACE = 1, |
|
100 COLLAPSE = 2 |
|
101 }; |
|
102 |
|
103 enum ValidatorType { |
|
104 String, |
|
105 AnyURI, |
|
106 QName, |
|
107 Name, |
|
108 NCName, |
|
109 Boolean, |
|
110 Float, |
|
111 Double, |
|
112 Decimal, |
|
113 HexBinary, |
|
114 Base64Binary, |
|
115 Duration, |
|
116 DateTime, |
|
117 Date, |
|
118 Time, |
|
119 MonthDay, |
|
120 YearMonth, |
|
121 Year, |
|
122 Month, |
|
123 Day, |
|
124 ID, |
|
125 IDREF, |
|
126 ENTITY, |
|
127 NOTATION, |
|
128 List, |
|
129 Union, |
|
130 AnySimpleType, |
|
131 UnKnown |
|
132 }; |
|
133 |
|
134 // ----------------------------------------------------------------------- |
|
135 // Public Destructor |
|
136 // ----------------------------------------------------------------------- |
|
137 /** @name Destructor. */ |
|
138 //@{ |
|
139 |
|
140 virtual ~DatatypeValidator(); |
|
141 |
|
142 //@} |
|
143 |
|
144 // ----------------------------------------------------------------------- |
|
145 // Getter methods |
|
146 // ----------------------------------------------------------------------- |
|
147 /** @name Getter Functions */ |
|
148 //@{ |
|
149 |
|
150 /** |
|
151 * Returns the final values of the simpleType |
|
152 */ |
|
153 int getFinalSet() const; |
|
154 |
|
155 /** |
|
156 * Returns the datatype facet if any is set. |
|
157 */ |
|
158 RefHashTableOf<KVStringPair>* getFacets() const; |
|
159 |
|
160 /** |
|
161 * Returns default value (collapse) for whiteSpace facet. |
|
162 * This function is overwritten in StringDatatypeValidator. |
|
163 */ |
|
164 short getWSFacet () const; |
|
165 |
|
166 /** |
|
167 * Returns the base datatype validator if set. |
|
168 */ |
|
169 DatatypeValidator* getBaseValidator() const; |
|
170 |
|
171 /** |
|
172 * Returns the 'class' type of datatype validator |
|
173 */ |
|
174 ValidatorType getType() const; |
|
175 |
|
176 /** |
|
177 * Returns whether the type is atomic or not |
|
178 * |
|
179 * To be redefined in List/Union validators |
|
180 */ |
|
181 virtual bool isAtomic() const; |
|
182 |
|
183 /** |
|
184 * Returns the datatype enumeration if any is set. |
|
185 * Derived class shall provide their own copy. |
|
186 */ |
|
187 virtual const RefArrayVectorOf<XMLCh>* getEnumString() const = 0; |
|
188 |
|
189 /** |
|
190 * returns true if this type is anonymous |
|
191 **/ |
|
192 bool getAnonymous() const; |
|
193 |
|
194 /** |
|
195 * sets this type to be anonymous |
|
196 **/ |
|
197 void setAnonymous(); |
|
198 |
|
199 /** |
|
200 * Fundamental Facet: ordered |
|
201 */ |
|
202 XSSimpleTypeDefinition::ORDERING getOrdered() const; |
|
203 |
|
204 /** |
|
205 * Fundamental Facet: cardinality. |
|
206 */ |
|
207 bool getFinite() const; |
|
208 |
|
209 /** |
|
210 * Fundamental Facet: bounded. |
|
211 */ |
|
212 bool getBounded() const; |
|
213 |
|
214 /** |
|
215 * Fundamental Facet: numeric. |
|
216 */ |
|
217 bool getNumeric() const; |
|
218 |
|
219 /** |
|
220 * Canonical Representation |
|
221 * |
|
222 * Derivative datatype may overwrite this method once |
|
223 * it has its own canonical representation other than |
|
224 * the default one. |
|
225 * |
|
226 * @param rawData: data in raw string |
|
227 * @param memMgr: memory manager |
|
228 * @param toValiate: to validate the raw string or not |
|
229 * |
|
230 * @return: canonical representation of the data |
|
231 * |
|
232 * Note: |
|
233 * |
|
234 * 1. the return value is kept in memory allocated |
|
235 * by the memory manager passed in or by dv's |
|
236 * if no memory manager is provided. |
|
237 * |
|
238 * 2. client application is responsible for the |
|
239 * proper deallcation of the memory allocated |
|
240 * for the returned value. |
|
241 * |
|
242 * 3. In the case where the rawData is not valid |
|
243 * with regards to the fundamental datatype, |
|
244 * a null string is returned. |
|
245 * |
|
246 */ |
|
247 virtual const XMLCh* getCanonicalRepresentation |
|
248 ( |
|
249 const XMLCh* const rawData |
|
250 , MemoryManager* const memMgr = 0 |
|
251 , bool toValidate = false |
|
252 ) const; |
|
253 |
|
254 //@} |
|
255 |
|
256 // ----------------------------------------------------------------------- |
|
257 // Validation methods |
|
258 // ----------------------------------------------------------------------- |
|
259 /** @name Validation Function */ |
|
260 //@{ |
|
261 |
|
262 /** |
|
263 * Checks that the "content" string is valid datatype. |
|
264 * If invalid, a Datatype validation exception is thrown. |
|
265 * |
|
266 * @param content A string containing the content to be validated |
|
267 * |
|
268 */ |
|
269 virtual void validate |
|
270 ( |
|
271 const XMLCh* const content |
|
272 , ValidationContext* const context = 0 |
|
273 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
|
274 ) = 0; |
|
275 |
|
276 /** |
|
277 * Checks whether a given type can be used as a substitute |
|
278 * |
|
279 * @param toCheck A datatype validator of the type to be used as a |
|
280 * substitute |
|
281 * |
|
282 * To be redefined in UnionDatatypeValidator |
|
283 */ |
|
284 |
|
285 virtual bool isSubstitutableBy(const DatatypeValidator* const toCheck); |
|
286 |
|
287 //@} |
|
288 |
|
289 // ----------------------------------------------------------------------- |
|
290 // Compare methods |
|
291 // ----------------------------------------------------------------------- |
|
292 /** @name Compare Function */ |
|
293 //@{ |
|
294 |
|
295 /** |
|
296 * Compares content in the Domain value vs. lexical value. |
|
297 * |
|
298 * e.g. If type is a float then 1.0 may be equivalent to 1 even though |
|
299 * both are lexically different. |
|
300 * |
|
301 * @param value1 string to compare |
|
302 * |
|
303 * @param value2 string to compare |
|
304 * |
|
305 * We will provide a default behavior that should be redefined at the |
|
306 * children level, if necessary (i.e. boolean case). |
|
307 */ |
|
308 virtual int compare(const XMLCh* const value1, const XMLCh* const value2 |
|
309 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
|
310 ); |
|
311 |
|
312 //@} |
|
313 |
|
314 /** |
|
315 * Returns an instance of the base datatype validator class |
|
316 * Used by the DatatypeValidatorFactory. |
|
317 */ |
|
318 virtual DatatypeValidator* newInstance |
|
319 ( |
|
320 RefHashTableOf<KVStringPair>* const facets |
|
321 , RefArrayVectorOf<XMLCh>* const enums |
|
322 , const int finalSet |
|
323 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
|
324 ) = 0; |
|
325 |
|
326 /** |
|
327 * Returns the uri,name of the type this validator is for |
|
328 */ |
|
329 const XMLCh* getTypeName() const; |
|
330 |
|
331 /** |
|
332 * sets the uri,name that this validator is for - typeName is uri,name string. |
|
333 * due to the internals of xerces this will set the uri to be the schema uri if |
|
334 * there is no comma in typeName |
|
335 */ |
|
336 void setTypeName(const XMLCh* const typeName); |
|
337 |
|
338 /** |
|
339 * sets the uri,name that this validator is for |
|
340 */ |
|
341 void setTypeName(const XMLCh* const name, const XMLCh* const uri); |
|
342 |
|
343 /** |
|
344 * Returns the uri of the type this validator is for |
|
345 */ |
|
346 const XMLCh* getTypeUri() const; |
|
347 |
|
348 /** |
|
349 * Returns the name of the type this validator is for |
|
350 */ |
|
351 const XMLCh* getTypeLocalName() const; |
|
352 |
|
353 /** |
|
354 * Returns the plugged-in memory manager |
|
355 */ |
|
356 MemoryManager* getMemoryManager() const; |
|
357 |
|
358 /*** |
|
359 * Support for Serialization/De-serialization |
|
360 ***/ |
|
361 DECL_XSERIALIZABLE(DatatypeValidator) |
|
362 |
|
363 /*** |
|
364 * |
|
365 * Serialzie DatatypeValidator derivative |
|
366 * |
|
367 * Param |
|
368 * serEng: serialize engine |
|
369 * dv: DatatypeValidator derivative |
|
370 * |
|
371 * Return: |
|
372 * |
|
373 ***/ |
|
374 static void storeDV(XSerializeEngine& serEng |
|
375 , DatatypeValidator* const dv); |
|
376 |
|
377 /*** |
|
378 * |
|
379 * Create a DatatypeValidator derivative from the binary |
|
380 * stream. |
|
381 * |
|
382 * Param |
|
383 * serEng: serialize engine |
|
384 * |
|
385 * Return: |
|
386 * DatatypeValidator derivative |
|
387 * |
|
388 ***/ |
|
389 static DatatypeValidator* loadDV(XSerializeEngine& serEng); |
|
390 |
|
391 protected: |
|
392 // ----------------------------------------------------------------------- |
|
393 // Protected Constructors |
|
394 // ----------------------------------------------------------------------- |
|
395 /** @name Constructors */ |
|
396 //@{ |
|
397 |
|
398 /** |
|
399 * |
|
400 * @param baseValidator The base datatype validator for derived |
|
401 * validators. Null if native validator. |
|
402 * |
|
403 * @param facets A hashtable of datatype facets (except enum). |
|
404 * |
|
405 * @param finalSet 'final' value of the simpleType |
|
406 */ |
|
407 |
|
408 DatatypeValidator(DatatypeValidator* const baseValidator, |
|
409 RefHashTableOf<KVStringPair>* const facets, |
|
410 const int finalSet, |
|
411 const ValidatorType type, |
|
412 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
|
413 |
|
414 //@} |
|
415 |
|
416 |
|
417 friend class DatatypeValidatorFactory; |
|
418 friend class XSObjectFactory; |
|
419 |
|
420 /** |
|
421 * facetDefined |
|
422 */ |
|
423 int getFacetsDefined() const; |
|
424 void setFacetsDefined(int); |
|
425 |
|
426 /** |
|
427 * fixed |
|
428 */ |
|
429 int getFixed() const; |
|
430 void setFixed(int); |
|
431 |
|
432 |
|
433 /** |
|
434 * fPattern |
|
435 */ |
|
436 const XMLCh* getPattern() const; |
|
437 void setPattern(const XMLCh* ); |
|
438 |
|
439 /** |
|
440 * fRegex |
|
441 */ |
|
442 RegularExpression* getRegex() const; |
|
443 void setRegex(RegularExpression* const); |
|
444 |
|
445 /** |
|
446 * set fType |
|
447 */ |
|
448 void setType(ValidatorType); |
|
449 |
|
450 /** |
|
451 * set fWhiteSpace |
|
452 */ |
|
453 void setWhiteSpace(short); |
|
454 |
|
455 /** |
|
456 * get WSString |
|
457 */ |
|
458 const XMLCh* getWSstring(const short WSType) const; |
|
459 |
|
460 /** |
|
461 * Fundamental Facet: ordered |
|
462 */ |
|
463 void setOrdered(XSSimpleTypeDefinition::ORDERING ordered); |
|
464 |
|
465 /** |
|
466 * Fundamental Facet: cardinality. |
|
467 */ |
|
468 void setFinite(bool finite); |
|
469 |
|
470 /** |
|
471 * Fundamental Facet: bounded. |
|
472 */ |
|
473 void setBounded(bool bounded); |
|
474 |
|
475 /** |
|
476 * Fundamental Facet: numeric. |
|
477 */ |
|
478 void setNumeric(bool numeric); |
|
479 |
|
480 private: |
|
481 // ----------------------------------------------------------------------- |
|
482 // CleanUp methods |
|
483 // ----------------------------------------------------------------------- |
|
484 void cleanUp(); |
|
485 |
|
486 // ----------------------------------------------------------------------- |
|
487 // Unimplemented constructors and operators |
|
488 // ----------------------------------------------------------------------- |
|
489 DatatypeValidator(const DatatypeValidator&); |
|
490 DatatypeValidator& operator=(const DatatypeValidator&); |
|
491 |
|
492 // ----------------------------------------------------------------------- |
|
493 // Private data members |
|
494 // |
|
495 // fFinalSet |
|
496 // stores "final" values of simpleTypes |
|
497 // |
|
498 // fBaseValidator |
|
499 // This is a pointer to a base datatype validator. If value is null, |
|
500 // it means we have a native datatype validator not a derived one. |
|
501 // |
|
502 // fFacets |
|
503 // This is a hashtable of dataype facets. |
|
504 // |
|
505 // fType |
|
506 // Stores the class type of datatype validator |
|
507 // |
|
508 // fFacetsDefined |
|
509 // Stores the constaiting facets flag |
|
510 // |
|
511 // fPattern |
|
512 // the pointer to the String of the pattern. The actual data is |
|
513 // in the Facets. |
|
514 // |
|
515 // fRegex |
|
516 // pointer to the RegularExpress object |
|
517 // |
|
518 // |
|
519 // fFixed |
|
520 // if {fixed} is true, then types for which this type is the |
|
521 // {base type definition} cannot specify a value for a specific |
|
522 // facet. |
|
523 // |
|
524 // fTypeName |
|
525 // the uri,name of the type this validator will validate |
|
526 // |
|
527 // fTypeLocalName |
|
528 // the name of the type this validator will validate |
|
529 // |
|
530 // fTypeUri |
|
531 // the uri of the type this validator will validate |
|
532 // fAnonymous |
|
533 // true if this type is anonynous |
|
534 // |
|
535 // ----------------------------------------------------------------------- |
|
536 bool fAnonymous; |
|
537 bool fFinite; |
|
538 bool fBounded; |
|
539 bool fNumeric; |
|
540 |
|
541 short fWhiteSpace; |
|
542 int fFinalSet; |
|
543 int fFacetsDefined; |
|
544 int fFixed; |
|
545 |
|
546 ValidatorType fType; |
|
547 XSSimpleTypeDefinition::ORDERING fOrdered; |
|
548 |
|
549 DatatypeValidator* fBaseValidator; |
|
550 RefHashTableOf<KVStringPair>* fFacets; |
|
551 XMLCh* fPattern; |
|
552 RegularExpression* fRegex; |
|
553 XMLCh* fTypeName; |
|
554 const XMLCh* fTypeLocalName; |
|
555 const XMLCh* fTypeUri; |
|
556 |
|
557 protected: |
|
558 // ----------------------------------------------------------------------- |
|
559 // Protected data members |
|
560 // |
|
561 // fMemoryManager |
|
562 // Pluggable memory manager for dynamic allocation/deallocation. |
|
563 // ----------------------------------------------------------------------- |
|
564 MemoryManager* fMemoryManager; |
|
565 |
|
566 }; |
|
567 |
|
568 |
|
569 // --------------------------------------------------------------------------- |
|
570 // DatatypeValidator: Getters |
|
571 // --------------------------------------------------------------------------- |
|
572 inline int DatatypeValidator::getFinalSet() const { |
|
573 |
|
574 return fFinalSet; |
|
575 } |
|
576 |
|
577 inline RefHashTableOf<KVStringPair>* DatatypeValidator::getFacets() const { |
|
578 |
|
579 return fFacets; |
|
580 } |
|
581 |
|
582 inline DatatypeValidator* DatatypeValidator::getBaseValidator() const { |
|
583 |
|
584 return fBaseValidator; |
|
585 } |
|
586 |
|
587 inline short DatatypeValidator::getWSFacet() const { |
|
588 |
|
589 return fWhiteSpace; |
|
590 } |
|
591 |
|
592 inline DatatypeValidator::ValidatorType DatatypeValidator::getType() const |
|
593 { |
|
594 return fType; |
|
595 } |
|
596 |
|
597 inline int DatatypeValidator::getFacetsDefined() const |
|
598 { |
|
599 return fFacetsDefined; |
|
600 } |
|
601 |
|
602 inline int DatatypeValidator::getFixed() const |
|
603 { |
|
604 return fFixed; |
|
605 } |
|
606 |
|
607 inline const XMLCh* DatatypeValidator::getPattern() const |
|
608 { |
|
609 return fPattern; |
|
610 } |
|
611 |
|
612 inline RegularExpression* DatatypeValidator::getRegex() const |
|
613 { |
|
614 return fRegex; |
|
615 } |
|
616 |
|
617 inline const XMLCh* DatatypeValidator::getTypeName() const |
|
618 { |
|
619 return fTypeName; |
|
620 } |
|
621 |
|
622 inline bool DatatypeValidator::getAnonymous() const |
|
623 { |
|
624 return fAnonymous; |
|
625 } |
|
626 |
|
627 inline const XMLCh* DatatypeValidator::getTypeLocalName() const |
|
628 { |
|
629 return fTypeLocalName; |
|
630 } |
|
631 |
|
632 inline const XMLCh* DatatypeValidator::getTypeUri() const |
|
633 { |
|
634 return fTypeUri; |
|
635 } |
|
636 |
|
637 inline MemoryManager* DatatypeValidator::getMemoryManager() const |
|
638 { |
|
639 return fMemoryManager; |
|
640 } |
|
641 |
|
642 inline XSSimpleTypeDefinition::ORDERING DatatypeValidator::getOrdered() const |
|
643 { |
|
644 return fOrdered; |
|
645 } |
|
646 |
|
647 inline bool DatatypeValidator::getFinite() const |
|
648 { |
|
649 return fFinite; |
|
650 } |
|
651 |
|
652 inline bool DatatypeValidator::getBounded() const |
|
653 { |
|
654 return fBounded; |
|
655 } |
|
656 |
|
657 inline bool DatatypeValidator::getNumeric() const |
|
658 { |
|
659 return fNumeric; |
|
660 } |
|
661 |
|
662 // --------------------------------------------------------------------------- |
|
663 // DatatypeValidator: Setters |
|
664 // --------------------------------------------------------------------------- |
|
665 inline void DatatypeValidator::setType(ValidatorType theType) |
|
666 { |
|
667 fType = theType; |
|
668 } |
|
669 |
|
670 inline void DatatypeValidator::setWhiteSpace(short newValue) |
|
671 { |
|
672 fWhiteSpace = newValue; |
|
673 } |
|
674 |
|
675 inline void DatatypeValidator::setFacetsDefined(int facets) |
|
676 { |
|
677 fFacetsDefined |= facets; |
|
678 } |
|
679 |
|
680 inline void DatatypeValidator::setFixed(int fixed) |
|
681 { |
|
682 fFixed |= fixed; |
|
683 } |
|
684 |
|
685 inline void DatatypeValidator::setPattern(const XMLCh* pattern) |
|
686 { |
|
687 if (fPattern) { |
|
688 fMemoryManager->deallocate(fPattern);//delete [] fPattern; |
|
689 delete fRegex; |
|
690 } |
|
691 fPattern = XMLString::replicate(pattern, fMemoryManager); |
|
692 fRegex = new (fMemoryManager) RegularExpression(fPattern, SchemaSymbols::fgRegEx_XOption, fMemoryManager); |
|
693 } |
|
694 |
|
695 inline void DatatypeValidator::setRegex(RegularExpression* const regex) |
|
696 { |
|
697 fRegex = regex; |
|
698 } |
|
699 |
|
700 inline bool DatatypeValidator::isAtomic() const { |
|
701 |
|
702 return true; |
|
703 } |
|
704 |
|
705 inline void DatatypeValidator::setAnonymous() { |
|
706 fAnonymous = true; |
|
707 } |
|
708 |
|
709 inline void DatatypeValidator::setOrdered(XSSimpleTypeDefinition::ORDERING ordered) |
|
710 { |
|
711 fOrdered = ordered; |
|
712 } |
|
713 |
|
714 inline void DatatypeValidator::setFinite(bool finite) |
|
715 { |
|
716 fFinite = finite; |
|
717 } |
|
718 |
|
719 inline void DatatypeValidator::setBounded(bool bounded) |
|
720 { |
|
721 fBounded = bounded; |
|
722 } |
|
723 |
|
724 inline void DatatypeValidator::setNumeric(bool numeric) |
|
725 { |
|
726 fNumeric = numeric; |
|
727 } |
|
728 |
|
729 // --------------------------------------------------------------------------- |
|
730 // DatatypeValidators: Compare methods |
|
731 // --------------------------------------------------------------------------- |
|
732 inline int DatatypeValidator::compare(const XMLCh* const lValue, |
|
733 const XMLCh* const rValue |
|
734 , MemoryManager* const) |
|
735 { |
|
736 return XMLString::compareString(lValue, rValue); |
|
737 } |
|
738 |
|
739 // --------------------------------------------------------------------------- |
|
740 // DatatypeValidators: Validation methods |
|
741 // --------------------------------------------------------------------------- |
|
742 inline bool |
|
743 DatatypeValidator::isSubstitutableBy(const DatatypeValidator* const toCheck) |
|
744 { |
|
745 const DatatypeValidator* dv = toCheck; |
|
746 |
|
747 while (dv != 0) { |
|
748 |
|
749 if (dv == this) { |
|
750 return true; |
|
751 } |
|
752 |
|
753 dv = dv->getBaseValidator(); |
|
754 } |
|
755 |
|
756 return false; |
|
757 } |
|
758 |
|
759 XERCES_CPP_NAMESPACE_END |
|
760 |
|
761 #endif |
|
762 |
|
763 /** |
|
764 * End of file DatatypeValidator.hpp |
|
765 */ |
|
766 |