Back to home page

EIC code displayed by LXR

 
 

    


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

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_XSATTRIBUTEDECLARATION_HPP)
0023 #define XERCESC_INCLUDE_GUARD_XSATTRIBUTEDECLARATION_HPP
0024 
0025 #include <xercesc/framework/psvi/XSObject.hpp>
0026 
0027 XERCES_CPP_NAMESPACE_BEGIN
0028 
0029 /**
0030  * This class describes all properties of a Schema Attribute
0031  * Declaration component.
0032  * This is *always* owned by the validator /parser object from which
0033  * it is obtained.  
0034  */
0035 
0036 // forward declarations
0037 class XSAnnotation;
0038 class XSComplexTypeDefinition;
0039 class XSSimpleTypeDefinition;
0040 class SchemaAttDef;
0041 
0042 class XMLPARSER_EXPORT XSAttributeDeclaration : public XSObject
0043 {
0044 public:
0045 
0046     //  Constructors and Destructor
0047     // -----------------------------------------------------------------------
0048     /** @name Constructors */
0049     //@{
0050 
0051     /**
0052       * The default constructor 
0053       *
0054       * @param  attDef      
0055       * @param  typeDef     
0056       * @param  annot       
0057       * @param  xsModel     
0058       * @param  scope       
0059       * @param  enclosingCTDefinition
0060       * @param  manager     The configurable memory manager
0061       */
0062     XSAttributeDeclaration
0063     (
0064         SchemaAttDef* const             attDef
0065         , XSSimpleTypeDefinition* const typeDef
0066         , XSAnnotation* const           annot
0067         , XSModel* const                xsModel
0068         , XSConstants::SCOPE            scope
0069         , XSComplexTypeDefinition*      enclosingCTDefinition
0070         , MemoryManager* const          manager = XMLPlatformUtils::fgMemoryManager
0071     );
0072 
0073     //@};
0074 
0075     /** @name Destructor */
0076     //@{
0077     ~XSAttributeDeclaration();
0078     //@}
0079 
0080     //---------------------
0081     /** @name overridden XSObject methods */
0082 
0083     //@{
0084 
0085     /**
0086      * The name of type <code>NCName</code> of this declaration as defined in 
0087      * XML Namespaces.
0088      */
0089     const XMLCh* getName() const;
0090 
0091     /**
0092      *  The [target namespace] of this object, or <code>null</code> if it is 
0093      * unspecified. 
0094      */
0095     const XMLCh* getNamespace() const;
0096 
0097     /**
0098      * A namespace schema information item corresponding to the target 
0099      * namespace of the component, if it's globally declared; or null 
0100      * otherwise.
0101      */
0102     XSNamespaceItem* getNamespaceItem();
0103 
0104     //@}
0105 
0106     /** @name XSAttributeDeclaration methods **/
0107 
0108     //@{
0109 
0110     /**
0111      * [type definition]: A simple type definition 
0112      */
0113     XSSimpleTypeDefinition *getTypeDefinition() const;
0114 
0115     /**
0116      * Optional. One of <code>SCOPE_GLOBAL</code>, <code>SCOPE_LOCAL</code>, 
0117      * or <code>SCOPE_ABSENT</code>. If the scope is local, then the 
0118      * <code>enclosingCTDefinition</code> is present. 
0119      */
0120     XSConstants::SCOPE getScope() const;
0121 
0122     /**
0123      * The complex type definition for locally scoped declarations (see 
0124      * <code>scope</code>). 
0125      */
0126     XSComplexTypeDefinition *getEnclosingCTDefinition();
0127 
0128     /**
0129      * Value constraint: one of <code>VC_NONE, VC_DEFAULT, VC_FIXED</code>. 
0130      */
0131     XSConstants::VALUE_CONSTRAINT getConstraintType() const;
0132 
0133     /**
0134      * Value constraint: The actual value with respect to the [type definition
0135      * ]. 
0136      */
0137     const XMLCh *getConstraintValue();
0138 
0139     /**
0140      * Optional. Annotation. 
0141      */
0142     XSAnnotation *getAnnotation() const;
0143 
0144     //@}
0145 
0146     //----------------------------------
0147     /** methods needed by implementation */
0148 
0149     //@{
0150 
0151     bool getRequired() const;
0152     //@}
0153 
0154 private:
0155 
0156     void setEnclosingCTDefinition(XSComplexTypeDefinition* const toSet);
0157     friend class XSObjectFactory;
0158 
0159     // -----------------------------------------------------------------------
0160     //  Unimplemented constructors and operators
0161     // -----------------------------------------------------------------------
0162     XSAttributeDeclaration(const XSAttributeDeclaration&);
0163     XSAttributeDeclaration & operator=(const XSAttributeDeclaration &);
0164 
0165 protected:
0166 
0167     // -----------------------------------------------------------------------
0168     //  data members
0169     // -----------------------------------------------------------------------
0170     SchemaAttDef*               fAttDef;
0171     XSSimpleTypeDefinition*     fTypeDefinition;
0172     XSAnnotation*               fAnnotation;
0173     XSConstants::SCOPE          fScope;
0174     XSComplexTypeDefinition*    fEnclosingCTDefinition;
0175 };
0176 
0177 // ---------------------------------------------------------------------------
0178 //  XSAttributeDeclaration: inline methods
0179 // ---------------------------------------------------------------------------
0180 inline XSSimpleTypeDefinition* XSAttributeDeclaration::getTypeDefinition() const
0181 {
0182     return fTypeDefinition;
0183 }
0184 
0185 inline XSAnnotation *XSAttributeDeclaration::getAnnotation() const
0186 {
0187     return fAnnotation;
0188 }
0189 
0190 inline XSConstants::SCOPE XSAttributeDeclaration::getScope() const
0191 {   
0192     return fScope;
0193 }
0194 
0195 inline XSComplexTypeDefinition *XSAttributeDeclaration::getEnclosingCTDefinition()
0196 {
0197     return fEnclosingCTDefinition;
0198 }
0199 
0200 inline void XSAttributeDeclaration::setEnclosingCTDefinition
0201 (
0202     XSComplexTypeDefinition* const toSet
0203 )
0204 {
0205     fEnclosingCTDefinition = toSet;
0206 }
0207 
0208 XERCES_CPP_NAMESPACE_END
0209 
0210 #endif