[358] | 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: DateTimeValidator.hpp,v 1.10 2004/09/08 13:56:52 peiyongz Exp $
|
---|
| 19 | * $Log: DateTimeValidator.hpp,v $
|
---|
| 20 | * Revision 1.10 2004/09/08 13:56:52 peiyongz
|
---|
| 21 | * Apache License Version 2.0
|
---|
| 22 | *
|
---|
| 23 | * Revision 1.9 2004/01/29 11:51:22 cargilld
|
---|
| 24 | * Code cleanup changes to get rid of various compiler diagnostic messages.
|
---|
| 25 | *
|
---|
| 26 | * Revision 1.8 2003/12/17 00:18:38 cargilld
|
---|
| 27 | * Update to memory management so that the static memory manager (one used to call Initialize) is only for static data.
|
---|
| 28 | *
|
---|
| 29 | * Revision 1.7 2003/12/11 21:40:24 peiyongz
|
---|
| 30 | * support for Canonical Representation for Datatype
|
---|
| 31 | *
|
---|
| 32 | * Revision 1.6 2003/11/12 20:32:03 peiyongz
|
---|
| 33 | * Statless Grammar: ValidationContext
|
---|
| 34 | *
|
---|
| 35 | * Revision 1.5 2003/10/02 19:21:06 peiyongz
|
---|
| 36 | * Implementation of Serialization/Deserialization
|
---|
| 37 | *
|
---|
| 38 | * Revision 1.4 2003/08/14 03:00:11 knoaman
|
---|
| 39 | * Code refactoring to improve performance of validation.
|
---|
| 40 | *
|
---|
| 41 | * Revision 1.3 2003/05/15 18:53:26 knoaman
|
---|
| 42 | * Partial implementation of the configurable memory manager.
|
---|
| 43 | *
|
---|
| 44 | * Revision 1.2 2002/11/04 14:53:28 tng
|
---|
| 45 | * C++ Namespace Support.
|
---|
| 46 | *
|
---|
| 47 | * Revision 1.1.1.1 2002/02/01 22:22:41 peiyongz
|
---|
| 48 | * sane_include
|
---|
| 49 | *
|
---|
| 50 | * Revision 1.2 2001/11/12 20:37:57 peiyongz
|
---|
| 51 | * SchemaDateTimeException defined
|
---|
| 52 | *
|
---|
| 53 | * Revision 1.1 2001/11/07 19:18:52 peiyongz
|
---|
| 54 | * DateTime Port
|
---|
| 55 | *
|
---|
| 56 | */
|
---|
| 57 |
|
---|
| 58 | #if !defined(DATETIME_VALIDATOR_HPP)
|
---|
| 59 | #define DATETIME_VALIDATOR_HPP
|
---|
| 60 |
|
---|
| 61 | #include <xercesc/validators/datatype/AbstractNumericFacetValidator.hpp>
|
---|
| 62 | #include <xercesc/util/XMLDateTime.hpp>
|
---|
| 63 |
|
---|
| 64 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
| 65 |
|
---|
| 66 | class VALIDATORS_EXPORT DateTimeValidator : public AbstractNumericFacetValidator
|
---|
| 67 | {
|
---|
| 68 | public:
|
---|
| 69 |
|
---|
| 70 | // -----------------------------------------------------------------------
|
---|
| 71 | // Public dtor
|
---|
| 72 | // -----------------------------------------------------------------------
|
---|
| 73 | /** @name Constructor. */
|
---|
| 74 | //@{
|
---|
| 75 |
|
---|
| 76 | virtual ~DateTimeValidator();
|
---|
| 77 |
|
---|
| 78 | //@}
|
---|
| 79 |
|
---|
| 80 | virtual void validate
|
---|
| 81 | (
|
---|
| 82 | const XMLCh* const content
|
---|
| 83 | , ValidationContext* const context = 0
|
---|
| 84 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
| 85 | );
|
---|
| 86 |
|
---|
| 87 | virtual int compare(const XMLCh* const value1
|
---|
| 88 | , const XMLCh* const value2
|
---|
| 89 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
| 90 | );
|
---|
| 91 |
|
---|
| 92 | /***
|
---|
| 93 | * Support for Serialization/De-serialization
|
---|
| 94 | ***/
|
---|
| 95 | DECL_XSERIALIZABLE(DateTimeValidator)
|
---|
| 96 |
|
---|
| 97 | protected:
|
---|
| 98 |
|
---|
| 99 | // -----------------------------------------------------------------------
|
---|
| 100 | // ctor used by derived class
|
---|
| 101 | // -----------------------------------------------------------------------
|
---|
| 102 | DateTimeValidator
|
---|
| 103 | (
|
---|
| 104 | DatatypeValidator* const baseValidator
|
---|
| 105 | , RefHashTableOf<KVStringPair>* const facets
|
---|
| 106 | , const int finalSet
|
---|
| 107 | , const ValidatorType type
|
---|
| 108 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
| 109 | );
|
---|
| 110 |
|
---|
| 111 | //
|
---|
| 112 | // Abstract interface
|
---|
| 113 | //
|
---|
| 114 |
|
---|
| 115 | virtual int compareValues(const XMLNumber* const lValue
|
---|
| 116 | , const XMLNumber* const rValue);
|
---|
| 117 |
|
---|
| 118 | virtual void checkContent(const XMLCh* const content
|
---|
| 119 | , ValidationContext* const context
|
---|
| 120 | , bool asBase
|
---|
| 121 | , MemoryManager* const manager);
|
---|
| 122 |
|
---|
| 123 | virtual void setMaxInclusive(const XMLCh* const);
|
---|
| 124 |
|
---|
| 125 | virtual void setMaxExclusive(const XMLCh* const);
|
---|
| 126 |
|
---|
| 127 | virtual void setMinInclusive(const XMLCh* const);
|
---|
| 128 |
|
---|
| 129 | virtual void setMinExclusive(const XMLCh* const);
|
---|
| 130 |
|
---|
| 131 | virtual void setEnumeration(MemoryManager* const manager);
|
---|
| 132 |
|
---|
| 133 | protected:
|
---|
| 134 |
|
---|
| 135 | // -----------------------------------------------------------------------
|
---|
| 136 | // helper interface: to be implemented/overwritten by derived class
|
---|
| 137 | // -----------------------------------------------------------------------
|
---|
| 138 | virtual XMLDateTime* parse(const XMLCh* const, MemoryManager* const manager) = 0;
|
---|
| 139 | virtual void parse(XMLDateTime* const) = 0;
|
---|
| 140 |
|
---|
| 141 | // to be overwritten by duration
|
---|
| 142 | virtual int compareDates(const XMLDateTime* const lValue
|
---|
| 143 | , const XMLDateTime* const rValue
|
---|
| 144 | , bool strict);
|
---|
| 145 |
|
---|
| 146 | private:
|
---|
| 147 | // -----------------------------------------------------------------------
|
---|
| 148 | // Unimplemented constructors and operators
|
---|
| 149 | // -----------------------------------------------------------------------
|
---|
| 150 | DateTimeValidator(const DateTimeValidator&);
|
---|
| 151 | DateTimeValidator& operator=(const DateTimeValidator&);
|
---|
| 152 | };
|
---|
| 153 |
|
---|
| 154 | XERCES_CPP_NAMESPACE_END
|
---|
| 155 |
|
---|
| 156 | #endif
|
---|
| 157 |
|
---|
| 158 | /**
|
---|
| 159 | * End of file DateTimeValidator.hpp
|
---|
| 160 | */
|
---|
| 161 |
|
---|
| 162 |
|
---|