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_XSPARTICLE_HPP)
0023 #define XERCESC_INCLUDE_GUARD_XSPARTICLE_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 Particle
0031  * component.
0032  * This is *always* owned by the validator /parser object from which
0033  * it is obtained.
0034  */
0035 
0036 // forward declarations
0037 class XSElementDeclaration;
0038 class XSModelGroup;
0039 class XSWildcard;
0040 
0041 class XMLPARSER_EXPORT XSParticle : public XSObject
0042 {
0043 public:
0044 
0045     // possible terms of this particle
0046     enum TERM_TYPE {
0047         /*
0048          * an empty particle
0049          */
0050         TERM_EMPTY          = 0,
0051         /*
0052          * the particle has element content
0053          */
0054         TERM_ELEMENT        = XSConstants::ELEMENT_DECLARATION,
0055         /*
0056          * the particle's content is a model group
0057          */
0058         TERM_MODELGROUP     = XSConstants::MODEL_GROUP_DEFINITION,
0059         /*
0060          * the particle's content is a wildcard
0061          */
0062         TERM_WILDCARD       = XSConstants::WILDCARD
0063     };
0064 
0065     //  Constructors and Destructor
0066     // -----------------------------------------------------------------------
0067     /** @name Constructors */
0068     //@{
0069 
0070     /**
0071       * The default constructor
0072       *
0073       * @param  termType
0074       * @param  xsModel
0075       * @param  particleTerm
0076       * @param  minOccurs
0077       * @param  maxOccurs
0078       * @param  unbounded
0079       * @param  manager     The configurable memory manager
0080       */
0081     XSParticle
0082     (
0083         TERM_TYPE              termType
0084         , XSModel* const       xsModel
0085         , XSObject* const      particleTerm
0086         , XMLSize_t            minOccurs
0087         , XMLSize_t            maxOccurs
0088         , bool                 unbounded
0089         , MemoryManager* const manager
0090     );
0091 
0092     //@};
0093 
0094     /** @name Destructor */
0095     //@{
0096     ~XSParticle();
0097     //@}
0098 
0099     //---------------------
0100     /** @name XSParticle methods */
0101     //@{
0102 
0103     /**
0104      * [min occurs]: determines the minimum number of terms that can occur.
0105      */
0106     XMLSize_t getMinOccurs() const;
0107 
0108     /**
0109      * [max occurs] determines the maximum number of terms that can occur. To
0110      * query for value of unbounded use <code>maxOccursUnbounded</code>.
0111      */
0112     XMLSize_t getMaxOccurs() const;
0113 
0114     /**
0115      * [max occurs] whether the maxOccurs value is unbounded.
0116      */
0117     bool getMaxOccursUnbounded() const;
0118 
0119     /**
0120      * Returns the type of the [term]: one of
0121      * TERM_EMPTY, TERM_ELEMENT, TERM_MODELGROUP, or TERM_WILDCARD.
0122      */
0123     TERM_TYPE getTermType() const;
0124 
0125     /**
0126      * If this particle has an [element declaration] for its term,
0127      * this method returns that declaration; otherwise, it returns 0.
0128      * @returns The element declaration that is the [term] of this Particle
0129      * if and only if getTermType() == TERM_ELEMENT.
0130      */
0131     XSElementDeclaration *getElementTerm();
0132 
0133     /**
0134      * If this particle has a [model group] for its term,
0135      * this method returns that definition; otherwise, it returns 0.
0136      * @returns The model group that is the [term] of this Particle
0137      * if and only if getTermType() == TERM_MODELGROUP.
0138      */
0139     XSModelGroup *getModelGroupTerm();
0140 
0141     /**
0142      * If this particle has an [wildcard] for its term,
0143      * this method returns that declaration; otherwise, it returns 0.
0144      * @returns The wildcard declaration that is the [term] of this Particle
0145      * if and only if getTermType() == TERM_WILDCARD.
0146      */
0147     XSWildcard *getWildcardTerm();
0148 
0149     //@}
0150 
0151     //----------------------------------
0152     /** methods needed by implementation */
0153     //@{
0154 
0155     //@}
0156 private:
0157 
0158     // -----------------------------------------------------------------------
0159     //  Unimplemented constructors and operators
0160     // -----------------------------------------------------------------------
0161     XSParticle(const XSParticle&);
0162     XSParticle & operator=(const XSParticle &);
0163 
0164 protected:
0165 
0166     // -----------------------------------------------------------------------
0167     //  data members
0168     // -----------------------------------------------------------------------
0169     TERM_TYPE fTermType;
0170     XMLSize_t fMinOccurs;
0171     XMLSize_t fMaxOccurs;
0172     bool      fUnbounded;
0173     XSObject* fTerm;
0174 };
0175 
0176 inline XMLSize_t XSParticle::getMinOccurs() const
0177 {
0178     return fMinOccurs;
0179 }
0180 
0181 inline XMLSize_t XSParticle::getMaxOccurs() const
0182 {
0183     return fMaxOccurs;
0184 }
0185 
0186 inline bool XSParticle::getMaxOccursUnbounded() const
0187 {
0188     return fUnbounded;
0189 }
0190 
0191 inline XSParticle::TERM_TYPE XSParticle::getTermType() const
0192 {
0193     return fTermType;
0194 }
0195 
0196 XERCES_CPP_NAMESPACE_END
0197 
0198 #endif