Back to home page

EIC code displayed by LXR

 
 

    


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

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_XSNAMESPACEITEM_HPP)
0023 #define XERCESC_INCLUDE_GUARD_XSNAMESPACEITEM_HPP
0024 
0025 #include <xercesc/util/PlatformUtils.hpp>
0026 #include <xercesc/framework/psvi/XSObject.hpp>
0027 #include <xercesc/framework/psvi/XSNamedMap.hpp>
0028 
0029 XERCES_CPP_NAMESPACE_BEGIN
0030 
0031 /**
0032  * This class contains all properties of the Schema Namespace Information infoitem.  
0033  * These items correspond to the result of processing a schema document
0034  * and all its included/redefined schema documents.  It corresponds to the
0035  * schema component discussed in the schema specifications, but since it
0036  * is not like other components does not inherit from the XSObject interface.
0037  * This is *always* owned by the validator /parser object from which
0038  * it is obtained.  It is designed to be subclassed; subclasses will
0039  * specify under what conditions it may be relied upon to have meaningful contents.
0040  */
0041 
0042 // forward declarations
0043 class XSAnnotation;
0044 class XSAttributeDeclaration;
0045 class XSAttributeGroupDefinition;
0046 class XSElementDeclaration;
0047 class XSModelGroupDefinition;
0048 class XSNotationDeclaration;
0049 class XSTypeDefinition;
0050 class SchemaGrammar;
0051 class XSModel;
0052 
0053 class XMLPARSER_EXPORT XSNamespaceItem : public XMemory
0054 {
0055 public:
0056 
0057     //  Constructors and Destructor
0058     // -----------------------------------------------------------------------
0059     /** @name Constructors */
0060     //@{
0061 
0062     /**
0063       * The default constructor 
0064       *
0065       * @param  xsModel
0066       * @param  grammar
0067       * @param  manager     The configurable memory manager
0068       */
0069     XSNamespaceItem
0070     (
0071         XSModel* const         xsModel
0072         , SchemaGrammar* const grammar
0073         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
0074     );
0075 
0076     XSNamespaceItem
0077     (
0078         XSModel* const         xsModel
0079         , const XMLCh* const   schemaNamespace
0080         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
0081     );
0082 
0083     //@};
0084 
0085     /** @name Destructor */
0086     //@{
0087     ~XSNamespaceItem();
0088     //@}
0089 
0090     //---------------------
0091     /** @name XSNamespaceItem methods */
0092 
0093     //@{
0094 
0095     /**
0096      * [schema namespace]: A namespace name or <code>null</code>
0097      * corresponding to the target namespace of the schema document.
0098      */
0099     const XMLCh *getSchemaNamespace() const;
0100 
0101     /**
0102      * [schema components]: a list of top-level components, i.e. element 
0103      * declarations, attribute declarations, etc. 
0104      * @param objectType The type of the declaration, i.e. 
0105      *   <code>ELEMENT_DECLARATION</code>, 
0106      *   <code>TYPE_DEFINITION</code> and any other component type that
0107      * may be a property of a schema component.
0108      * @return A list of top-level definition of the specified type in 
0109      *   <code>objectType</code> or <code>null</code>. 
0110      */
0111     XSNamedMap<XSObject> *getComponents(XSConstants::COMPONENT_TYPE objectType);
0112 
0113     /**
0114      *  [annotations]: a set of annotations.
0115      */
0116     XSAnnotationList *getAnnotations();
0117     const XSAnnotationList *getAnnotations() const;
0118 
0119     /**
0120      * Convenience method. Returns a top-level element declaration. 
0121      * @param name The name of the declaration.
0122      * @return A top-level element declaration or <code>null</code> if such 
0123      *   declaration does not exist. 
0124      */
0125     XSElementDeclaration *getElementDeclaration(const XMLCh *name);
0126 
0127     /**
0128      * Convenience method. Returns a top-level attribute declaration. 
0129      * @param name The name of the declaration.
0130      * @return A top-level attribute declaration or <code>null</code> if such 
0131      *   declaration does not exist. 
0132      */
0133     XSAttributeDeclaration *getAttributeDeclaration(const XMLCh *name);
0134 
0135     /**
0136      * Convenience method. Returns a top-level simple or complex type 
0137      * definition. 
0138      * @param name The name of the definition.
0139      * @return An <code>XSTypeDefinition</code> or <code>null</code> if such 
0140      *   definition does not exist. 
0141      */
0142     XSTypeDefinition *getTypeDefinition(const XMLCh *name);
0143 
0144     /**
0145      * Convenience method. Returns a top-level attribute group definition. 
0146      * @param name The name of the definition.
0147      * @return A top-level attribute group definition or <code>null</code> if 
0148      *   such definition does not exist. 
0149      */
0150     XSAttributeGroupDefinition *getAttributeGroup(const XMLCh *name);
0151 
0152     /**
0153      * Convenience method. Returns a top-level model group definition. 
0154      * @param name The name of the definition.
0155      * @return A top-level model group definition definition or 
0156      *   <code>null</code> if such definition does not exist. 
0157      */
0158     XSModelGroupDefinition *getModelGroupDefinition(const XMLCh *name);
0159 
0160     /**
0161      * Convenience method. Returns a top-level notation declaration. 
0162      * @param name The name of the declaration.
0163      * @return A top-level notation declaration or <code>null</code> if such 
0164      *   declaration does not exist. 
0165      */
0166     XSNotationDeclaration *getNotationDeclaration(const XMLCh *name);
0167 
0168     /**
0169      * [document location] - a list of locations URI for the documents that 
0170      * contributed to the XSModel.
0171      */
0172     const StringList *getDocumentLocations();
0173 
0174     //@}
0175 
0176     //----------------------------------
0177     /** methods needed by implementation */
0178 
0179     //@{
0180 
0181 
0182     //@}
0183 private:
0184 
0185     // -----------------------------------------------------------------------
0186     //  Unimplemented constructors and operators
0187     // -----------------------------------------------------------------------
0188     XSNamespaceItem(const XSNamespaceItem&);
0189     XSNamespaceItem & operator=(const XSNamespaceItem &);
0190 
0191 protected:
0192     friend class XSModel;
0193     friend class XSObjectFactory;
0194     // -----------------------------------------------------------------------
0195     //  data members
0196     // -----------------------------------------------------------------------
0197     // fMemoryManager:
0198     //  used for any memory allocations
0199     MemoryManager* const    fMemoryManager;
0200     SchemaGrammar*          fGrammar;
0201     XSModel*                fXSModel;
0202 
0203     /* Need a XSNamedMap for each component    top-level?
0204        that is top level.
0205           ATTRIBUTE_DECLARATION     = 1,       
0206           ELEMENT_DECLARATION       = 2,        
0207           TYPE_DEFINITION           = 3,        
0208           ATTRIBUTE_USE             = 4,       no 
0209           ATTRIBUTE_GROUP_DEFINITION= 5,        
0210           MODEL_GROUP_DEFINITION    = 6,       
0211           MODEL_GROUP               = 7,       no 
0212           PARTICLE                  = 8,       no
0213           WILDCARD                  = 9,       no
0214           IDENTITY_CONSTRAINT       = 10,      no
0215           NOTATION_DECLARATION      = 11,       
0216           ANNOTATION                = 12,      no
0217           FACET                     = 13,      no
0218           MULTIVALUE_FACET          = 14       no
0219     */
0220     XSNamedMap<XSObject>*                   fComponentMap[XSConstants::MULTIVALUE_FACET];
0221     XSAnnotationList*                       fXSAnnotationList;
0222     RefHashTableOf<XSObject>*               fHashMap[XSConstants::MULTIVALUE_FACET];
0223     const XMLCh*                            fSchemaNamespace;
0224 };
0225 
0226 inline XSAnnotationList* XSNamespaceItem::getAnnotations()
0227 {
0228     return fXSAnnotationList;
0229 }
0230 
0231 inline const XSAnnotationList* XSNamespaceItem::getAnnotations() const
0232 {
0233     return fXSAnnotationList;
0234 }
0235 
0236 inline const XMLCh *XSNamespaceItem::getSchemaNamespace() const
0237 {
0238     return fSchemaNamespace;
0239 }
0240 
0241 
0242 
0243 XERCES_CPP_NAMESPACE_END
0244 
0245 #endif