Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:15:19

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_SCHEMAATTDEF_HPP)
0023 #define XERCESC_INCLUDE_GUARD_SCHEMAATTDEF_HPP
0024 
0025 #include <xercesc/util/XMLString.hpp>
0026 #include <xercesc/framework/XMLAttDef.hpp>
0027 #include <xercesc/util/ValueVectorOf.hpp>
0028 #include <xercesc/validators/datatype/DatatypeValidator.hpp>
0029 #include <xercesc/validators/datatype/UnionDatatypeValidator.hpp>
0030 #include <xercesc/validators/schema/PSVIDefs.hpp>
0031 
0032 XERCES_CPP_NAMESPACE_BEGIN
0033 
0034 class DatatypeValidator;
0035 class QName;
0036 class ComplexTypeInfo;
0037 //
0038 //  This class is a derivative of the core XMLAttDef class. This class adds
0039 //  any Schema specific data members and provides Schema specific implementations
0040 //  of any underlying attribute def virtual methods.
0041 //
0042 class VALIDATORS_EXPORT SchemaAttDef : public XMLAttDef
0043 {
0044 public :
0045     // -----------------------------------------------------------------------
0046     //  Constructors and Destructors
0047     // -----------------------------------------------------------------------
0048     SchemaAttDef(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
0049     SchemaAttDef
0050     (
0051           const XMLCh* const           prefix
0052         , const XMLCh* const           localPart
0053         , const int                    uriId
0054         , const XMLAttDef::AttTypes    type = CData
0055         , const XMLAttDef::DefAttTypes defType = Implied
0056         , MemoryManager* const         manager = XMLPlatformUtils::fgMemoryManager
0057     );
0058     SchemaAttDef
0059     (
0060           const XMLCh* const           prefix
0061         , const XMLCh* const           localPart
0062         , const int                    uriId
0063         , const XMLCh* const           attValue
0064         , const XMLAttDef::AttTypes    type
0065         , const XMLAttDef::DefAttTypes defType
0066         , const XMLCh* const           enumValues = 0
0067         , MemoryManager* const         manager = XMLPlatformUtils::fgMemoryManager
0068     );
0069     SchemaAttDef
0070     (
0071           const SchemaAttDef*                   other
0072     );
0073     virtual ~SchemaAttDef();
0074 
0075     // -----------------------------------------------------------------------
0076     //  Implementation of the XMLAttDef interface
0077     // -----------------------------------------------------------------------
0078     virtual const XMLCh* getFullName() const;
0079     virtual void reset();
0080 
0081     // -----------------------------------------------------------------------
0082     //  Getter methods
0083     // -----------------------------------------------------------------------
0084     XMLSize_t getElemId() const;
0085     QName* getAttName() const;
0086     DatatypeValidator* getDatatypeValidator() const;
0087     ValueVectorOf<unsigned int>* getNamespaceList() const;
0088     const SchemaAttDef* getBaseAttDecl() const;
0089     SchemaAttDef* getBaseAttDecl();
0090     PSVIDefs::PSVIScope getPSVIScope() const;
0091 
0092     // -----------------------------------------------------------------------
0093     //  Setter methods
0094     // -----------------------------------------------------------------------
0095     void setElemId(const XMLSize_t newId);
0096     void setAttName
0097     (
0098         const XMLCh* const        prefix
0099        ,const XMLCh* const        localPart
0100        ,const int                 uriId = -1
0101     );
0102     void setDatatypeValidator(DatatypeValidator* newDatatypeValidator);    
0103     void setBaseAttDecl(SchemaAttDef* const attDef);
0104     void setPSVIScope(const PSVIDefs::PSVIScope toSet);
0105     
0106     void setNamespaceList(const ValueVectorOf<unsigned int>* const toSet);
0107     void resetNamespaceList();
0108     void setEnclosingCT(ComplexTypeInfo* complexTypeInfo);
0109     /***
0110      * Support for Serialization/De-serialization
0111      ***/
0112     DECL_XSERIALIZABLE(SchemaAttDef)
0113 
0114 private :
0115     // -----------------------------------------------------------------------
0116     //  Unimplemented constructors and operators
0117     // -----------------------------------------------------------------------
0118     SchemaAttDef(const SchemaAttDef&);
0119     SchemaAttDef& operator=(const SchemaAttDef&);
0120 
0121     // -----------------------------------------------------------------------
0122     //  Private data members
0123     //
0124     //  fElemId
0125     //      This is the id of the element (the id is into the element decl
0126     //      pool) of the element this attribute def said it belonged to.
0127     //      This is used later to link back to the element, mostly for
0128     //      validation purposes.
0129     //
0130     //  fAttName
0131     //      This is the name of the attribute.
0132     //
0133     //  fDatatypeValidator
0134     //      The DatatypeValidator used to validate this attribute type.        
0135     //    
0136     //  fNamespaceList
0137     //      The list of namespace values for a wildcard attribute
0138     //    
0139     //  fBaseAttDecl
0140     //      The base attribute declaration that this attribute is based on
0141     //      NOTE: we do not have a notion of attribute use, so in the case
0142     //      of ref'd attributes and inherited attributes, we make a copy
0143     //      of the actual attribute declaration. The fBaseAttDecl stores that
0144     //      declaration, and will be helpful when we build the XSModel (i.e
0145     //      easy access the XSAnnotation object).
0146     // -----------------------------------------------------------------------
0147     XMLSize_t                    fElemId;
0148 
0149     PSVIDefs::PSVIScope          fPSVIScope;
0150 
0151     QName*                       fAttName;
0152     DatatypeValidator*           fDatatypeValidator;    
0153     ValueVectorOf<unsigned int>* fNamespaceList;
0154     SchemaAttDef*                fBaseAttDecl;
0155 };
0156 
0157 
0158 // ---------------------------------------------------------------------------
0159 //  SchemaAttDef: Getter methods
0160 // ---------------------------------------------------------------------------
0161 inline XMLSize_t SchemaAttDef::getElemId() const
0162 {
0163     return fElemId;
0164 }
0165 
0166 
0167 inline QName* SchemaAttDef::getAttName() const
0168 {
0169     return fAttName;
0170 }
0171 
0172 inline DatatypeValidator* SchemaAttDef::getDatatypeValidator() const
0173 {
0174     return fDatatypeValidator;
0175 }
0176 
0177 inline ValueVectorOf<unsigned int>*
0178 SchemaAttDef::getNamespaceList() const {
0179     return fNamespaceList;
0180 }
0181 
0182 inline SchemaAttDef* SchemaAttDef::getBaseAttDecl()
0183 {
0184     return fBaseAttDecl;
0185 }
0186 
0187 inline const SchemaAttDef* SchemaAttDef::getBaseAttDecl() const
0188 {
0189     return fBaseAttDecl;
0190 }
0191 
0192 inline PSVIDefs::PSVIScope SchemaAttDef::getPSVIScope() const
0193 {
0194     return fPSVIScope;
0195 }
0196 
0197 // ---------------------------------------------------------------------------
0198 //  SchemaAttDef: Setter methods
0199 // ---------------------------------------------------------------------------
0200 inline void SchemaAttDef::setElemId(const XMLSize_t newId)
0201 {
0202     fElemId = newId;
0203 }
0204 
0205 inline void SchemaAttDef::setDatatypeValidator(DatatypeValidator* newDatatypeValidator)
0206 {
0207     fDatatypeValidator = newDatatypeValidator;
0208 }
0209 
0210 inline void SchemaAttDef::resetNamespaceList() {
0211 
0212     if (fNamespaceList && fNamespaceList->size()) {
0213         fNamespaceList->removeAllElements();
0214     }
0215 }
0216 
0217 inline void SchemaAttDef::setNamespaceList(const ValueVectorOf<unsigned int>* const toSet) {
0218 
0219     if (toSet && toSet->size()) {
0220 
0221         if (fNamespaceList) {
0222             *fNamespaceList = *toSet;
0223         }
0224         else {
0225             fNamespaceList = new (getMemoryManager()) ValueVectorOf<unsigned int>(*toSet);
0226         }
0227     }
0228     else  {
0229         resetNamespaceList();
0230     }
0231 }
0232 
0233 inline void SchemaAttDef::reset() {    
0234 }
0235 
0236 inline void SchemaAttDef::setEnclosingCT(ComplexTypeInfo*)
0237 {
0238 }
0239 
0240 inline void SchemaAttDef::setBaseAttDecl(SchemaAttDef* const attDef)
0241 {
0242     fBaseAttDecl = attDef;
0243 }
0244 
0245 inline void SchemaAttDef::setPSVIScope(const PSVIDefs::PSVIScope toSet)
0246 {
0247     fPSVIScope = toSet;
0248 }
0249 
0250 XERCES_CPP_NAMESPACE_END
0251 
0252 #endif