[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: ENTITYDatatypeValidator.hpp,v 1.9 2004/09/08 13:56:53 peiyongz Exp $
|
---|
| 19 | * $Log: ENTITYDatatypeValidator.hpp,v $
|
---|
| 20 | * Revision 1.9 2004/09/08 13:56:53 peiyongz
|
---|
| 21 | * Apache License Version 2.0
|
---|
| 22 | *
|
---|
| 23 | * Revision 1.8 2004/01/29 11:51:22 cargilld
|
---|
| 24 | * Code cleanup changes to get rid of various compiler diagnostic messages.
|
---|
| 25 | *
|
---|
| 26 | * Revision 1.7 2003/12/17 00:18:39 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.6 2003/11/12 20:32:03 peiyongz
|
---|
| 30 | * Statless Grammar: ValidationContext
|
---|
| 31 | *
|
---|
| 32 | * Revision 1.5 2003/09/30 18:17:53 peiyongz
|
---|
| 33 | * Implementation of Serialization/Deserialization
|
---|
| 34 | *
|
---|
| 35 | * Revision 1.4 2003/05/15 18:53:26 knoaman
|
---|
| 36 | * Partial implementation of the configurable memory manager.
|
---|
| 37 | *
|
---|
| 38 | * Revision 1.3 2002/12/18 14:17:55 gareth
|
---|
| 39 | * Fix to bug #13438. When you eant a vector that calls delete[] on its members you should use RefArrayVectorOf.
|
---|
| 40 | *
|
---|
| 41 | * Revision 1.2 2002/11/04 14:53:28 tng
|
---|
| 42 | * C++ Namespace Support.
|
---|
| 43 | *
|
---|
| 44 | * Revision 1.1.1.1 2002/02/01 22:22:41 peiyongz
|
---|
| 45 | * sane_include
|
---|
| 46 | *
|
---|
| 47 | * Revision 1.7 2001/11/22 20:23:20 peiyongz
|
---|
| 48 | * _declspec(dllimport) and inline warning C4273
|
---|
| 49 | *
|
---|
| 50 | * Revision 1.6 2001/10/09 20:50:27 peiyongz
|
---|
| 51 | * init(): take 1 arg
|
---|
| 52 | *
|
---|
| 53 | * Revision 1.5 2001/09/27 13:51:25 peiyongz
|
---|
| 54 | * DTV Reorganization: ctor/init created to be used by derived class
|
---|
| 55 | *
|
---|
| 56 | * Revision 1.4 2001/09/24 21:39:29 peiyongz
|
---|
| 57 | * DTV Reorganization: checkValueSpace()
|
---|
| 58 | *
|
---|
| 59 | * Revision 1.3 2001/08/24 17:12:01 knoaman
|
---|
| 60 | * Add support for anySimpleType.
|
---|
| 61 | * Remove parameter 'baseValidator' from the virtual method 'newInstance'.
|
---|
| 62 | *
|
---|
| 63 | * Revision 1.2 2001/07/24 21:23:40 tng
|
---|
| 64 | * Schema: Use DatatypeValidator for ID/IDREF/ENTITY/ENTITIES/NOTATION.
|
---|
| 65 | *
|
---|
| 66 | * Revision 1.1 2001/07/06 20:19:52 peiyongz
|
---|
| 67 | * ENTITYDTV
|
---|
| 68 | *
|
---|
| 69 | */
|
---|
| 70 |
|
---|
| 71 | #if !defined(ENTITY_DATATYPEVALIDATOR_HPP)
|
---|
| 72 | #define ENTITY_DATATYPEVALIDATOR_HPP
|
---|
| 73 |
|
---|
| 74 | #include <xercesc/validators/datatype/StringDatatypeValidator.hpp>
|
---|
| 75 | #include <xercesc/util/NameIdPool.hpp>
|
---|
| 76 | #include <xercesc/validators/DTD/DTDEntityDecl.hpp>
|
---|
| 77 |
|
---|
| 78 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
| 79 |
|
---|
| 80 | class VALIDATORS_EXPORT ENTITYDatatypeValidator : public StringDatatypeValidator
|
---|
| 81 | {
|
---|
| 82 | public:
|
---|
| 83 |
|
---|
| 84 | // -----------------------------------------------------------------------
|
---|
| 85 | // Public ctor/dtor
|
---|
| 86 | // -----------------------------------------------------------------------
|
---|
| 87 | /** @name Constructors and Destructor. */
|
---|
| 88 | //@{
|
---|
| 89 |
|
---|
| 90 | ENTITYDatatypeValidator
|
---|
| 91 | (
|
---|
| 92 | MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
| 93 | );
|
---|
| 94 | ENTITYDatatypeValidator
|
---|
| 95 | (
|
---|
| 96 | DatatypeValidator* const baseValidator
|
---|
| 97 | , RefHashTableOf<KVStringPair>* const facets
|
---|
| 98 | , RefArrayVectorOf<XMLCh>* const enums
|
---|
| 99 | , const int finalSet
|
---|
| 100 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
| 101 | );
|
---|
| 102 |
|
---|
| 103 | virtual ~ENTITYDatatypeValidator();
|
---|
| 104 |
|
---|
| 105 | //@}
|
---|
| 106 |
|
---|
| 107 | // -----------------------------------------------------------------------
|
---|
| 108 | // Validation methods
|
---|
| 109 | // -----------------------------------------------------------------------
|
---|
| 110 | /** @name Validation Function */
|
---|
| 111 | //@{
|
---|
| 112 |
|
---|
| 113 | /**
|
---|
| 114 | * validate that a string matches the boolean datatype
|
---|
| 115 | * @param content A string containing the content to be validated
|
---|
| 116 | *
|
---|
| 117 | * @exception throws InvalidDatatypeException if the content is
|
---|
| 118 | * is not valid.
|
---|
| 119 | */
|
---|
| 120 |
|
---|
| 121 | virtual void validate
|
---|
| 122 | (
|
---|
| 123 | const XMLCh* const content
|
---|
| 124 | , ValidationContext* const context = 0
|
---|
| 125 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
| 126 | );
|
---|
| 127 |
|
---|
| 128 | //@}
|
---|
| 129 |
|
---|
| 130 | // -----------------------------------------------------------------------
|
---|
| 131 | // Compare methods
|
---|
| 132 | // -----------------------------------------------------------------------
|
---|
| 133 | /** @name Compare Function */
|
---|
| 134 | //@{
|
---|
| 135 |
|
---|
| 136 | /**
|
---|
| 137 | * Compare two boolean data types
|
---|
| 138 | *
|
---|
| 139 | * @param content1
|
---|
| 140 | * @param content2
|
---|
| 141 | * @return
|
---|
| 142 | */
|
---|
| 143 | virtual int compare(const XMLCh* const, const XMLCh* const
|
---|
| 144 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
---|
| 145 |
|
---|
| 146 | //@}
|
---|
| 147 |
|
---|
| 148 | /**
|
---|
| 149 | * Returns an instance of the base datatype validator class
|
---|
| 150 | * Used by the DatatypeValidatorFactory.
|
---|
| 151 | */
|
---|
| 152 | virtual DatatypeValidator* newInstance
|
---|
| 153 | (
|
---|
| 154 | RefHashTableOf<KVStringPair>* const facets
|
---|
| 155 | , RefArrayVectorOf<XMLCh>* const enums
|
---|
| 156 | , const int finalSet
|
---|
| 157 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
| 158 | );
|
---|
| 159 |
|
---|
| 160 | // -----------------------------------------------------------------------
|
---|
| 161 | // Setter methods
|
---|
| 162 | // -----------------------------------------------------------------------
|
---|
| 163 | /** @name Setter Functions */
|
---|
| 164 | //@{
|
---|
| 165 |
|
---|
| 166 | //deprecated
|
---|
| 167 | inline void setEntityDeclPool(NameIdPool<DTDEntityDecl>* const entityDeclPool);
|
---|
| 168 |
|
---|
| 169 | //@}
|
---|
| 170 |
|
---|
| 171 | /***
|
---|
| 172 | * Support for Serialization/De-serialization
|
---|
| 173 | ***/
|
---|
| 174 | DECL_XSERIALIZABLE(ENTITYDatatypeValidator)
|
---|
| 175 |
|
---|
| 176 | protected:
|
---|
| 177 |
|
---|
| 178 | //
|
---|
| 179 | // ctor provided to be used by derived classes
|
---|
| 180 | //
|
---|
| 181 | ENTITYDatatypeValidator(DatatypeValidator* const baseValidator
|
---|
| 182 | , RefHashTableOf<KVStringPair>* const facets
|
---|
| 183 | , const int finalSet
|
---|
| 184 | , const ValidatorType type);
|
---|
| 185 |
|
---|
| 186 | virtual void checkValueSpace(const XMLCh* const content
|
---|
| 187 | , MemoryManager* const manager);
|
---|
| 188 |
|
---|
| 189 | private:
|
---|
| 190 | // -----------------------------------------------------------------------
|
---|
| 191 | // Unimplemented constructors and operators
|
---|
| 192 | // -----------------------------------------------------------------------
|
---|
| 193 | ENTITYDatatypeValidator(const ENTITYDatatypeValidator&);
|
---|
| 194 | ENTITYDatatypeValidator& operator = (const ENTITYDatatypeValidator&);
|
---|
| 195 |
|
---|
| 196 | };
|
---|
| 197 |
|
---|
| 198 | // -----------------------------------------------------------------------
|
---|
| 199 | // Setter methods
|
---|
| 200 | // -----------------------------------------------------------------------
|
---|
| 201 | inline void ENTITYDatatypeValidator::setEntityDeclPool(NameIdPool<DTDEntityDecl>* const )
|
---|
| 202 | {
|
---|
| 203 | }
|
---|
| 204 |
|
---|
| 205 | XERCES_CPP_NAMESPACE_END
|
---|
| 206 |
|
---|
| 207 | #endif
|
---|
| 208 |
|
---|
| 209 | /**
|
---|
| 210 | * End of file ENTITYDatatypeValidator.hpp
|
---|
| 211 | */
|
---|