Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:14:53

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  *
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  *
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_XMLATTDEFLIST_HPP)
0023 #define XERCESC_INCLUDE_GUARD_XMLATTDEFLIST_HPP
0024 
0025 #include <xercesc/util/XercesDefs.hpp>
0026 #include <xercesc/util/XMemory.hpp>
0027 #include <xercesc/internal/XSerializable.hpp>
0028 
0029 XERCES_CPP_NAMESPACE_BEGIN
0030 
0031 class XMLAttDef;
0032 
0033 /**
0034  *  This class defines an abstract interface that all validators must support.
0035  *  When the scanner scans the attributes in a start tag, it must have a list
0036  *  of the defined attributes for that element. This is used to fault in
0037  *  defaulted and fixed attributes, to know which ones are required, and to
0038  *  know the their types in order to do the correct normalization.
0039  *
0040  *  Since each validator will have its own derivatives of XMLAttDef and will
0041  *  have its own specialized storage mechanisms for elements and the att
0042  *  defs that they own, there must be an abstracted way for the scanner to
0043  *  deal with this list.
0044  *
0045  *  It does not derive from the generic Enumerator template class, because
0046  *  there are portability issues with deriving from a template class in a
0047  *  DLL. It does though provide a similar enumerator interface.
0048  */
0049 
0050 class XMLPARSER_EXPORT XMLAttDefList : public XSerializable, public XMemory
0051 {
0052 public:
0053     // -----------------------------------------------------------------------
0054     //  Constructors and Destructor
0055     // -----------------------------------------------------------------------
0056 
0057     /** @name Destructor */
0058     //@{
0059     virtual ~XMLAttDefList();
0060     //@}
0061 
0062 
0063     // -----------------------------------------------------------------------
0064     //  The virtual interface
0065     // -----------------------------------------------------------------------
0066 
0067     virtual bool isEmpty() const = 0;
0068     virtual XMLAttDef* findAttDef
0069     (
0070         const   unsigned int        uriID
0071         , const XMLCh* const        attName
0072     ) = 0;
0073     virtual const XMLAttDef* findAttDef
0074     (
0075         const   unsigned int        uriID
0076         , const XMLCh* const        attName
0077     )   const = 0;
0078     virtual XMLAttDef* findAttDef
0079     (
0080         const   XMLCh* const        attURI
0081         , const XMLCh* const        attName
0082     ) = 0;
0083     virtual const XMLAttDef* findAttDef
0084     (
0085         const   XMLCh* const        attURI
0086         , const XMLCh* const        attName
0087     )   const = 0;
0088 
0089     /**
0090      * return total number of attributes in this list
0091      */
0092     virtual XMLSize_t getAttDefCount() const = 0;
0093 
0094     /**
0095      * return attribute at the index-th position in the list.
0096      */
0097     virtual XMLAttDef &getAttDef(XMLSize_t index) = 0;
0098 
0099     /**
0100      * return attribute at the index-th position in the list.
0101      */
0102     virtual const XMLAttDef &getAttDef(XMLSize_t index) const = 0;
0103 
0104     /***
0105      * Support for Serialization/De-serialization
0106      ***/
0107     DECL_XSERIALIZABLE(XMLAttDefList)
0108 
0109 
0110     // -----------------------------------------------------------------------
0111     //  Getter methods
0112     // -----------------------------------------------------------------------
0113 
0114     /** @name Getter methods */
0115     //@{
0116 
0117     /** Get the memory manager
0118       *
0119       * This method returns the configurable memory manager used by the
0120       * element declaration for dynamic allocation/deallocation.
0121       *
0122       * @return the memory manager
0123       */
0124     MemoryManager* getMemoryManager() const;
0125 
0126     //@}
0127 
0128 protected :
0129     // -----------------------------------------------------------------------
0130     //  Hidden constructors and operators
0131     // -----------------------------------------------------------------------
0132     XMLAttDefList(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0133 
0134 private:
0135     // unimplemented
0136     XMLAttDefList(const XMLAttDefList&);
0137     XMLAttDefList& operator=(const XMLAttDefList&);
0138 
0139     MemoryManager*      fMemoryManager;
0140 };
0141 
0142 
0143 
0144 // ---------------------------------------------------------------------------
0145 //  XMLAttDefList: Getter methods
0146 // ---------------------------------------------------------------------------
0147 
0148 inline MemoryManager* XMLAttDefList::getMemoryManager() const
0149 {
0150     return fMemoryManager;
0151 }
0152 
0153 // ---------------------------------------------------------------------------
0154 //  XMLAttDefList: Constructors and Destructor
0155 // ---------------------------------------------------------------------------
0156 inline XMLAttDefList::~XMLAttDefList()
0157 {
0158 }
0159 
0160 
0161 // ---------------------------------------------------------------------------
0162 //  XMLAttDefList: Protected Constructor
0163 // ---------------------------------------------------------------------------
0164 inline XMLAttDefList::XMLAttDefList(MemoryManager* const manager):
0165 fMemoryManager(manager)
0166 {
0167 }
0168 
0169 XERCES_CPP_NAMESPACE_END
0170 
0171 #endif