[188] | 1 | /*
|
---|
| 2 | * The Apache Software License, Version 1.1
|
---|
| 3 | *
|
---|
| 4 | * Copyright (c) 1999-2000 The Apache Software Foundation. All rights
|
---|
| 5 | * reserved.
|
---|
| 6 | *
|
---|
| 7 | * Redistribution and use in source and binary forms, with or without
|
---|
| 8 | * modification, are permitted provided that the following conditions
|
---|
| 9 | * are met:
|
---|
| 10 | *
|
---|
| 11 | * 1. Redistributions of source code must retain the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer.
|
---|
| 13 | *
|
---|
| 14 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
| 15 | * notice, this list of conditions and the following disclaimer in
|
---|
| 16 | * the documentation and/or other materials provided with the
|
---|
| 17 | * distribution.
|
---|
| 18 | *
|
---|
| 19 | * 3. The end-user documentation included with the redistribution,
|
---|
| 20 | * if any, must include the following acknowledgment:
|
---|
| 21 | * "This product includes software developed by the
|
---|
| 22 | * Apache Software Foundation (http://www.apache.org/)."
|
---|
| 23 | * Alternately, this acknowledgment may appear in the software itself,
|
---|
| 24 | * if and wherever such third-party acknowledgments normally appear.
|
---|
| 25 | *
|
---|
| 26 | * 4. The names "Xerces" and "Apache Software Foundation" must
|
---|
| 27 | * not be used to endorse or promote products derived from this
|
---|
| 28 | * software without prior written permission. For written
|
---|
| 29 | * permission, please contact apache\@apache.org.
|
---|
| 30 | *
|
---|
| 31 | * 5. Products derived from this software may not be called "Apache",
|
---|
| 32 | * nor may "Apache" appear in their name, without prior written
|
---|
| 33 | * permission of the Apache Software Foundation.
|
---|
| 34 | *
|
---|
| 35 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
---|
| 36 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 37 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
| 38 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
---|
| 39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
| 40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
| 41 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
---|
| 42 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
| 43 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
| 44 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
---|
| 45 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
| 46 | * SUCH DAMAGE.
|
---|
| 47 | * ====================================================================
|
---|
| 48 | *
|
---|
| 49 | * This software consists of voluntary contributions made by many
|
---|
| 50 | * individuals on behalf of the Apache Software Foundation, and was
|
---|
| 51 | * originally based on software copyright (c) 1999, International
|
---|
| 52 | * Business Machines, Inc., http://www.ibm.com . For more information
|
---|
| 53 | * on the Apache Software Foundation, please see
|
---|
| 54 | * <http://www.apache.org/>.
|
---|
| 55 | */
|
---|
| 56 |
|
---|
| 57 | /*
|
---|
| 58 | * $Log: DTDAttDef.hpp,v $
|
---|
| 59 | * Revision 1.8 2004/01/29 11:52:30 cargilld
|
---|
| 60 | * Code cleanup changes to get rid of various compiler diagnostic messages.
|
---|
| 61 | *
|
---|
| 62 | * Revision 1.7 2003/12/17 00:18:40 cargilld
|
---|
| 63 | * Update to memory management so that the static memory manager (one used to call Initialize) is only for static data.
|
---|
| 64 | *
|
---|
| 65 | * Revision 1.6 2003/10/10 16:24:51 peiyongz
|
---|
| 66 | * Implementation of Serialization/Deserialization
|
---|
| 67 | *
|
---|
| 68 | * Revision 1.5 2003/05/16 21:43:19 knoaman
|
---|
| 69 | * Memory manager implementation: Modify constructors to pass in the memory manager.
|
---|
| 70 | *
|
---|
| 71 | * Revision 1.4 2003/05/15 18:54:50 knoaman
|
---|
| 72 | * Partial implementation of the configurable memory manager.
|
---|
| 73 | *
|
---|
| 74 | * Revision 1.3 2003/01/29 19:46:40 gareth
|
---|
| 75 | * added DOMTypeInfo API
|
---|
| 76 | *
|
---|
| 77 | * Revision 1.2 2002/11/04 14:50:40 tng
|
---|
| 78 | * C++ Namespace Support.
|
---|
| 79 | *
|
---|
| 80 | * Revision 1.1.1.1 2002/02/01 22:22:43 peiyongz
|
---|
| 81 | * sane_include
|
---|
| 82 | *
|
---|
| 83 | * Revision 1.3 2000/02/24 20:16:48 abagchi
|
---|
| 84 | * Swat for removing Log from API docs
|
---|
| 85 | *
|
---|
| 86 | * Revision 1.2 2000/02/09 21:42:37 abagchi
|
---|
| 87 | * Copyright swat
|
---|
| 88 | *
|
---|
| 89 | * Revision 1.1.1.1 1999/11/09 01:03:26 twl
|
---|
| 90 | * Initial checkin
|
---|
| 91 | *
|
---|
| 92 | * Revision 1.2 1999/11/08 20:45:39 rahul
|
---|
| 93 | * Swat for adding in Product name and CVS comment log variable.
|
---|
| 94 | *
|
---|
| 95 | */
|
---|
| 96 |
|
---|
| 97 | #if !defined(DTDATTDEF_HPP)
|
---|
| 98 | #define DTDATTDEF_HPP
|
---|
| 99 |
|
---|
| 100 | #include <xercesc/framework/XMLAttDef.hpp>
|
---|
| 101 |
|
---|
| 102 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
| 103 |
|
---|
| 104 | //
|
---|
| 105 | // This class is a derivative of the core XMLAttDef class. This class adds
|
---|
| 106 | // any DTD specific data members and provides DTD specific implementations
|
---|
| 107 | // of any underlying attribute def virtual methods.
|
---|
| 108 | //
|
---|
| 109 | // In the DTD we don't do namespaces, so the attribute names are just the
|
---|
| 110 | // QName literally from the DTD. This is what we return as the full name,
|
---|
| 111 | // which is what is used to key these in any name keyed collections.
|
---|
| 112 | //
|
---|
| 113 | class VALIDATORS_EXPORT DTDAttDef : public XMLAttDef
|
---|
| 114 | {
|
---|
| 115 | public :
|
---|
| 116 | // -----------------------------------------------------------------------
|
---|
| 117 | // Constructors and Destructors
|
---|
| 118 | // -----------------------------------------------------------------------
|
---|
| 119 | DTDAttDef(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
---|
| 120 | DTDAttDef
|
---|
| 121 | (
|
---|
| 122 | const XMLCh* const attName
|
---|
| 123 | , const XMLAttDef::AttTypes type = CData
|
---|
| 124 | , const XMLAttDef::DefAttTypes defType = Implied
|
---|
| 125 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
| 126 | );
|
---|
| 127 | DTDAttDef
|
---|
| 128 | (
|
---|
| 129 | const XMLCh* const attName
|
---|
| 130 | , const XMLCh* const attValue
|
---|
| 131 | , const XMLAttDef::AttTypes type
|
---|
| 132 | , const XMLAttDef::DefAttTypes defType
|
---|
| 133 | , const XMLCh* const enumValues = 0
|
---|
| 134 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
| 135 | );
|
---|
| 136 | ~DTDAttDef();
|
---|
| 137 |
|
---|
| 138 |
|
---|
| 139 | // -----------------------------------------------------------------------
|
---|
| 140 | // Implementation of the XMLAttDef interface
|
---|
| 141 | // -----------------------------------------------------------------------
|
---|
| 142 | virtual const XMLCh* getFullName() const;
|
---|
| 143 |
|
---|
| 144 | //does nothing currently
|
---|
| 145 | virtual void reset() {};
|
---|
| 146 |
|
---|
| 147 | // -----------------------------------------------------------------------
|
---|
| 148 | // Getter methods
|
---|
| 149 | // -----------------------------------------------------------------------
|
---|
| 150 | unsigned int getElemId() const;
|
---|
| 151 |
|
---|
| 152 | virtual const XMLCh* getDOMTypeInfoName() const;
|
---|
| 153 |
|
---|
| 154 | virtual const XMLCh* getDOMTypeInfoUri() const;
|
---|
| 155 |
|
---|
| 156 |
|
---|
| 157 | // -----------------------------------------------------------------------
|
---|
| 158 | // Setter methods
|
---|
| 159 | // -----------------------------------------------------------------------
|
---|
| 160 | void setElemId(const unsigned int newId);
|
---|
| 161 | void setName(const XMLCh* const newName);
|
---|
| 162 |
|
---|
| 163 | /***
|
---|
| 164 | * Support for Serialization/De-serialization
|
---|
| 165 | ***/
|
---|
| 166 | DECL_XSERIALIZABLE(DTDAttDef)
|
---|
| 167 |
|
---|
| 168 | private :
|
---|
| 169 | // -----------------------------------------------------------------------
|
---|
| 170 | // Unimplemented constructors and operators
|
---|
| 171 | // -----------------------------------------------------------------------
|
---|
| 172 | DTDAttDef(const DTDAttDef &);
|
---|
| 173 | DTDAttDef& operator = (const DTDAttDef&);
|
---|
| 174 |
|
---|
| 175 | // -----------------------------------------------------------------------
|
---|
| 176 | // Private data members
|
---|
| 177 | //
|
---|
| 178 | // fElemId
|
---|
| 179 | // This is the id of the element (the id is into the element decl
|
---|
| 180 | // pool) of the element this attribute def said it belonged to.
|
---|
| 181 | // This is used later to link back to the element, mostly for
|
---|
| 182 | // validation purposes.
|
---|
| 183 | //
|
---|
| 184 | // fName
|
---|
| 185 | // This is the name of the attribute. Since we don't do namespaces
|
---|
| 186 | // in the DTD, its just the fully qualified name.
|
---|
| 187 | // -----------------------------------------------------------------------
|
---|
| 188 | unsigned int fElemId;
|
---|
| 189 | XMLCh* fName;
|
---|
| 190 | };
|
---|
| 191 |
|
---|
| 192 |
|
---|
| 193 | // ---------------------------------------------------------------------------
|
---|
| 194 | // DTDAttDef: Implementation of the XMLAttDef interface
|
---|
| 195 | // ---------------------------------------------------------------------------
|
---|
| 196 | inline const XMLCh* DTDAttDef::getFullName() const
|
---|
| 197 | {
|
---|
| 198 | return fName;
|
---|
| 199 | }
|
---|
| 200 |
|
---|
| 201 |
|
---|
| 202 | // ---------------------------------------------------------------------------
|
---|
| 203 | // DTDAttDef: Getter methods
|
---|
| 204 | // ---------------------------------------------------------------------------
|
---|
| 205 | inline unsigned int DTDAttDef::getElemId() const
|
---|
| 206 | {
|
---|
| 207 | return fElemId;
|
---|
| 208 | }
|
---|
| 209 |
|
---|
| 210 | inline const XMLCh* DTDAttDef::getDOMTypeInfoName() const
|
---|
| 211 | {
|
---|
| 212 | return getAttTypeString(getType(), getMemoryManager());
|
---|
| 213 | }
|
---|
| 214 |
|
---|
| 215 | inline const XMLCh* DTDAttDef::getDOMTypeInfoUri() const
|
---|
| 216 | {
|
---|
| 217 | return 0;
|
---|
| 218 | }
|
---|
| 219 |
|
---|
| 220 | // ---------------------------------------------------------------------------
|
---|
| 221 | // DTDAttDef: Setter methods
|
---|
| 222 | // ---------------------------------------------------------------------------
|
---|
| 223 | inline void DTDAttDef::setElemId(const unsigned int newId)
|
---|
| 224 | {
|
---|
| 225 | fElemId = newId;
|
---|
| 226 | }
|
---|
| 227 |
|
---|
| 228 |
|
---|
| 229 | XERCES_CPP_NAMESPACE_END
|
---|
| 230 |
|
---|
| 231 | #endif
|
---|