[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: IDDatatypeValidator.hpp,v 1.9 2004/09/08 13:56:53 peiyongz Exp $
|
---|
| 19 | * $Log: IDDatatypeValidator.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.8 2001/11/22 20:23:20 peiyongz
|
---|
| 48 | * _declspec(dllimport) and inline warning C4273
|
---|
| 49 | *
|
---|
| 50 | * Revision 1.7 2001/10/09 20:50:02 peiyongz
|
---|
| 51 | * init(): take 1 arg
|
---|
| 52 | *
|
---|
| 53 | * Revision 1.6 2001/09/27 13:51:25 peiyongz
|
---|
| 54 | * DTV Reorganization: ctor/init created to be used by derived class
|
---|
| 55 | *
|
---|
| 56 | * Revision 1.5 2001/09/25 14:23:42 peiyongz
|
---|
| 57 | * DTV Reorganization: checkValueSpace()
|
---|
| 58 | *
|
---|
| 59 | * Revision 1.4 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.3 2001/07/25 17:58:08 tng
|
---|
| 64 | * Fix compilation errors.
|
---|
| 65 | *
|
---|
| 66 | * Revision 1.2 2001/07/24 21:23:40 tng
|
---|
| 67 | * Schema: Use DatatypeValidator for ID/IDREF/ENTITY/ENTITIES/NOTATION.
|
---|
| 68 | *
|
---|
| 69 | * Revision 1.1 2001/07/04 14:38:25 peiyongz
|
---|
| 70 | * IDDatatypeValidator: created
|
---|
| 71 | * DatatypeValidatorFactory: IDDTV enabled
|
---|
| 72 | * XMLString:isValidName(): to validate Name (XML [4][5])
|
---|
| 73 | *
|
---|
| 74 | */
|
---|
| 75 |
|
---|
| 76 | #if !defined(ID_DATATYPEVALIDATOR_HPP)
|
---|
| 77 | #define ID_DATATYPEVALIDATOR_HPP
|
---|
| 78 |
|
---|
| 79 | #include <xercesc/validators/datatype/StringDatatypeValidator.hpp>
|
---|
| 80 | #include <xercesc/framework/XMLRefInfo.hpp>
|
---|
| 81 |
|
---|
| 82 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
| 83 |
|
---|
| 84 | class VALIDATORS_EXPORT IDDatatypeValidator : public StringDatatypeValidator
|
---|
| 85 | {
|
---|
| 86 | public:
|
---|
| 87 |
|
---|
| 88 | // -----------------------------------------------------------------------
|
---|
| 89 | // Public ctor/dtor
|
---|
| 90 | // -----------------------------------------------------------------------
|
---|
| 91 | /** @name Constructors and Destructor */
|
---|
| 92 | //@{
|
---|
| 93 |
|
---|
| 94 | IDDatatypeValidator
|
---|
| 95 | (
|
---|
| 96 | MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
| 97 | );
|
---|
| 98 | IDDatatypeValidator
|
---|
| 99 | (
|
---|
| 100 | DatatypeValidator* const baseValidator
|
---|
| 101 | , RefHashTableOf<KVStringPair>* const facets
|
---|
| 102 | , RefArrayVectorOf<XMLCh>* const enums
|
---|
| 103 | , const int finalSet
|
---|
| 104 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
| 105 | );
|
---|
| 106 | virtual ~IDDatatypeValidator();
|
---|
| 107 |
|
---|
| 108 | //@}
|
---|
| 109 |
|
---|
| 110 | // -----------------------------------------------------------------------
|
---|
| 111 | // Validation methods
|
---|
| 112 | // -----------------------------------------------------------------------
|
---|
| 113 | /** @name Validation Function */
|
---|
| 114 | //@{
|
---|
| 115 |
|
---|
| 116 | /**
|
---|
| 117 | * validate that a string matches the boolean datatype
|
---|
| 118 | * @param content A string containing the content to be validated
|
---|
| 119 | *
|
---|
| 120 | * @exception throws InvalidDatatypeException if the content is
|
---|
| 121 | * is not valid.
|
---|
| 122 | */
|
---|
| 123 |
|
---|
| 124 | virtual void validate
|
---|
| 125 | (
|
---|
| 126 | const XMLCh* const content
|
---|
| 127 | , ValidationContext* const context = 0
|
---|
| 128 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
| 129 | );
|
---|
| 130 |
|
---|
| 131 | /**
|
---|
| 132 | * Returns an instance of the base datatype validator class
|
---|
| 133 | * Used by the DatatypeValidatorFactory.
|
---|
| 134 | */
|
---|
| 135 | virtual DatatypeValidator* newInstance
|
---|
| 136 | (
|
---|
| 137 | RefHashTableOf<KVStringPair>* const facets
|
---|
| 138 | , RefArrayVectorOf<XMLCh>* const enums
|
---|
| 139 | , const int finalSet
|
---|
| 140 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
| 141 | );
|
---|
| 142 |
|
---|
| 143 | //@}
|
---|
| 144 |
|
---|
| 145 | //deprecated
|
---|
| 146 | inline void setIDRefList(RefHashTableOf<XMLRefInfo>* fIDRefList);
|
---|
| 147 |
|
---|
| 148 | /***
|
---|
| 149 | * Support for Serialization/De-serialization
|
---|
| 150 | ***/
|
---|
| 151 | DECL_XSERIALIZABLE(IDDatatypeValidator)
|
---|
| 152 |
|
---|
| 153 | protected:
|
---|
| 154 |
|
---|
| 155 | //
|
---|
| 156 | // ctor provided to be used by derived classes
|
---|
| 157 | //
|
---|
| 158 | IDDatatypeValidator
|
---|
| 159 | (
|
---|
| 160 | DatatypeValidator* const baseValidator
|
---|
| 161 | , RefHashTableOf<KVStringPair>* const facets
|
---|
| 162 | , const int finalSet
|
---|
| 163 | , const ValidatorType type
|
---|
| 164 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
| 165 | );
|
---|
| 166 |
|
---|
| 167 | virtual void checkValueSpace(const XMLCh* const content
|
---|
| 168 | , MemoryManager* const manager);
|
---|
| 169 |
|
---|
| 170 | private:
|
---|
| 171 | // -----------------------------------------------------------------------
|
---|
| 172 | // Unimplemented constructors and operators
|
---|
| 173 | // -----------------------------------------------------------------------
|
---|
| 174 | IDDatatypeValidator(const IDDatatypeValidator&);
|
---|
| 175 | IDDatatypeValidator& operator=(const IDDatatypeValidator&);
|
---|
| 176 | // -----------------------------------------------------------------------
|
---|
| 177 | // Private data members
|
---|
| 178 | //
|
---|
| 179 | //
|
---|
| 180 | // -----------------------------------------------------------------------
|
---|
| 181 | };
|
---|
| 182 |
|
---|
| 183 | inline void IDDatatypeValidator::setIDRefList(RefHashTableOf<XMLRefInfo>* )
|
---|
| 184 | {
|
---|
| 185 | }
|
---|
| 186 |
|
---|
| 187 | XERCES_CPP_NAMESPACE_END
|
---|
| 188 |
|
---|
| 189 | #endif
|
---|
| 190 | /**
|
---|
| 191 | * End of file IDDatatypeValidator.hpp
|
---|
| 192 | */
|
---|
| 193 |
|
---|