[2674] | 1 | /* |
---|
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
---|
| 3 | * contributor license agreements. See the NOTICE file distributed with |
---|
| 4 | * this work for additional information regarding copyright ownership. |
---|
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
| 6 | * (the "License"); you may not use this file except in compliance with |
---|
| 7 | * the License. You may obtain a copy of the License at |
---|
| 8 | * |
---|
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 10 | * |
---|
| 11 | * Unless required by applicable law or agreed to in writing, software |
---|
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 14 | * See the License for the specific language governing permissions and |
---|
| 15 | * limitations under the License. |
---|
| 16 | */ |
---|
| 17 | |
---|
| 18 | /* |
---|
| 19 | * $Id: XMLAttDefList.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | #if !defined(XMLATTDEFLIST_HPP) |
---|
| 23 | #define XMLATTDEFLIST_HPP |
---|
| 24 | |
---|
| 25 | #include <xercesc/util/XercesDefs.hpp> |
---|
| 26 | #include <xercesc/util/XMemory.hpp> |
---|
| 27 | #include <xercesc/internal/XSerializable.hpp> |
---|
| 28 | |
---|
| 29 | XERCES_CPP_NAMESPACE_BEGIN |
---|
| 30 | |
---|
| 31 | class XMLAttDef; |
---|
| 32 | |
---|
| 33 | /** |
---|
| 34 | * This class defines an abstract interface that all validators must support. |
---|
| 35 | * When the scanner scans the attributes in a start tag, it must have a list |
---|
| 36 | * of the defined attributes for that element. This is used to fault in |
---|
| 37 | * defaulted and fixed attributes, to know which ones are required, and to |
---|
| 38 | * know the their types in order to do the correct normalization. |
---|
| 39 | * |
---|
| 40 | * Since each validator will have its own derivatives of XMLAttDef and will |
---|
| 41 | * have its own specialized storage mechanisms for elements and the att |
---|
| 42 | * defs that they own, there must be an abstracted way for the scanner to |
---|
| 43 | * deal with this list. |
---|
| 44 | * |
---|
| 45 | * It does not derive from the generic Enumerator template class, because |
---|
| 46 | * there are portability issues with deriving from a template class in a |
---|
| 47 | * DLL. It does though provide a similar enumerator interface. |
---|
| 48 | */ |
---|
| 49 | |
---|
| 50 | class XMLPARSER_EXPORT XMLAttDefList : public XSerializable, public XMemory |
---|
| 51 | { |
---|
| 52 | public: |
---|
| 53 | // ----------------------------------------------------------------------- |
---|
| 54 | // Constructors and Destructor |
---|
| 55 | // ----------------------------------------------------------------------- |
---|
| 56 | |
---|
| 57 | /** @name Destructor */ |
---|
| 58 | //@{ |
---|
| 59 | virtual ~XMLAttDefList(); |
---|
| 60 | //@} |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | // ----------------------------------------------------------------------- |
---|
| 64 | // The virtual interface |
---|
| 65 | // ----------------------------------------------------------------------- |
---|
| 66 | |
---|
| 67 | /** |
---|
| 68 | * @deprecated This method is not thread-safe. |
---|
| 69 | */ |
---|
| 70 | virtual bool hasMoreElements() const = 0; |
---|
| 71 | virtual bool isEmpty() const = 0; |
---|
| 72 | virtual XMLAttDef* findAttDef |
---|
| 73 | ( |
---|
| 74 | const unsigned long uriID |
---|
| 75 | , const XMLCh* const attName |
---|
| 76 | ) = 0; |
---|
| 77 | virtual const XMLAttDef* findAttDef |
---|
| 78 | ( |
---|
| 79 | const unsigned long uriID |
---|
| 80 | , const XMLCh* const attName |
---|
| 81 | ) const = 0; |
---|
| 82 | virtual XMLAttDef* findAttDef |
---|
| 83 | ( |
---|
| 84 | const XMLCh* const attURI |
---|
| 85 | , const XMLCh* const attName |
---|
| 86 | ) = 0; |
---|
| 87 | virtual const XMLAttDef* findAttDef |
---|
| 88 | ( |
---|
| 89 | const XMLCh* const attURI |
---|
| 90 | , const XMLCh* const attName |
---|
| 91 | ) const = 0; |
---|
| 92 | |
---|
| 93 | /** |
---|
| 94 | * @deprecated This method is not thread-safe. |
---|
| 95 | */ |
---|
| 96 | virtual XMLAttDef& nextElement() = 0; |
---|
| 97 | |
---|
| 98 | /** |
---|
| 99 | * @deprecated This method is not thread-safe. |
---|
| 100 | */ |
---|
| 101 | virtual void Reset() = 0; |
---|
| 102 | |
---|
| 103 | /** |
---|
| 104 | * return total number of attributes in this list |
---|
| 105 | */ |
---|
| 106 | virtual unsigned int getAttDefCount() const = 0; |
---|
| 107 | |
---|
| 108 | /** |
---|
| 109 | * return attribute at the index-th position in the list. |
---|
| 110 | */ |
---|
| 111 | virtual XMLAttDef &getAttDef(unsigned int index) = 0; |
---|
| 112 | |
---|
| 113 | /** |
---|
| 114 | * return attribute at the index-th position in the list. |
---|
| 115 | */ |
---|
| 116 | virtual const XMLAttDef &getAttDef(unsigned int index) const = 0; |
---|
| 117 | |
---|
| 118 | /*** |
---|
| 119 | * Support for Serialization/De-serialization |
---|
| 120 | ***/ |
---|
| 121 | DECL_XSERIALIZABLE(XMLAttDefList) |
---|
| 122 | |
---|
| 123 | |
---|
| 124 | // ----------------------------------------------------------------------- |
---|
| 125 | // Getter methods |
---|
| 126 | // ----------------------------------------------------------------------- |
---|
| 127 | |
---|
| 128 | /** @name Getter methods */ |
---|
| 129 | //@{ |
---|
| 130 | |
---|
| 131 | /** Get the memory manager |
---|
| 132 | * |
---|
| 133 | * This method returns the configurable memory manager used by the |
---|
| 134 | * element declaration for dynamic allocation/deacllocation. |
---|
| 135 | * |
---|
| 136 | * @return the memory manager |
---|
| 137 | */ |
---|
| 138 | MemoryManager* getMemoryManager() const; |
---|
| 139 | |
---|
| 140 | //@} |
---|
| 141 | |
---|
| 142 | protected : |
---|
| 143 | // ----------------------------------------------------------------------- |
---|
| 144 | // Hidden constructors and operators |
---|
| 145 | // ----------------------------------------------------------------------- |
---|
| 146 | XMLAttDefList(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
---|
| 147 | |
---|
| 148 | private: |
---|
| 149 | // unimplemented |
---|
| 150 | XMLAttDefList(const XMLAttDefList&); |
---|
| 151 | XMLAttDefList& operator=(const XMLAttDefList&); |
---|
| 152 | |
---|
| 153 | MemoryManager* fMemoryManager; |
---|
| 154 | }; |
---|
| 155 | |
---|
| 156 | |
---|
| 157 | |
---|
| 158 | // --------------------------------------------------------------------------- |
---|
| 159 | // XMLAttDefList: Getter methods |
---|
| 160 | // --------------------------------------------------------------------------- |
---|
| 161 | |
---|
| 162 | inline MemoryManager* XMLAttDefList::getMemoryManager() const |
---|
| 163 | { |
---|
| 164 | return fMemoryManager; |
---|
| 165 | } |
---|
| 166 | |
---|
| 167 | // --------------------------------------------------------------------------- |
---|
| 168 | // XMLAttDefList: Constructors and Destructor |
---|
| 169 | // --------------------------------------------------------------------------- |
---|
| 170 | inline XMLAttDefList::~XMLAttDefList() |
---|
| 171 | { |
---|
| 172 | } |
---|
| 173 | |
---|
| 174 | |
---|
| 175 | // --------------------------------------------------------------------------- |
---|
| 176 | // XMLAttDefList: Protected Constructor |
---|
| 177 | // --------------------------------------------------------------------------- |
---|
| 178 | inline XMLAttDefList::XMLAttDefList(MemoryManager* const manager): |
---|
| 179 | fMemoryManager(manager) |
---|
| 180 | { |
---|
| 181 | } |
---|
| 182 | |
---|
| 183 | XERCES_CPP_NAMESPACE_END |
---|
| 184 | |
---|
| 185 | #endif |
---|