# XSParticle.hpp

Go to the documentation of this file.

    00001 /*
    00002  * Licensed to the Apache Software Foundation (ASF) under one or more
    00003  * contributor license agreements.  See the NOTICE file distributed with
    00004  * this work for additional information regarding copyright ownership.
    00005  * The ASF licenses this file to You under the Apache License, Version 2.0
    00006  * (the "License"); you may not use this file except in compliance with
    00007  * the License.  You may obtain a copy of the License at
    00008  *
    00009  *      http://www.apache.org/licenses/LICENSE-2.0
    00010  *
    00011  * Unless required by applicable law or agreed to in writing, software
    00012  * distributed under the License is distributed on an "AS IS" BASIS,
    00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00014  * See the License for the specific language governing permissions and
    00015  * limitations under the License.
    00016  */
    00017
    00018 /*
    00019  * $Id: XSParticle.hpp 674012 2008-07-04 11:18:21Z borisk $
    00020  */
    00021
    00022 #if !defined(XERCESC_INCLUDE_GUARD_XSPARTICLE_HPP)
    00023 #define XERCESC_INCLUDE_GUARD_XSPARTICLE_HPP
    00024
    00025 #include <xercesc/framework/psvi/XSObject.hpp>
    00026
    00027 XERCES_CPP_NAMESPACE_BEGIN
    00028
    00036 // forward declarations
    00037 class XSElementDeclaration;
    00038 class XSModelGroup;
    00039 class XSWildcard;
    00040
    00041 class XMLPARSER_EXPORT XSParticle : public XSObject
    00042 {
    00043 public:
    00044
    00045     // possible terms of this particle
    00046     enum TERM_TYPE {
    00047         /*
    00048          * an empty particle
    00049          */
    00050         TERM_EMPTY          = 0,
    00051         /*
    00052          * the particle has element content
    00053          */
    00054         TERM_ELEMENT        = XSConstants::ELEMENT_DECLARATION,
    00055         /*
    00056          * the particle's content is a model group
    00057          */
    00058         TERM_MODELGROUP     = XSConstants::MODEL_GROUP_DEFINITION,
    00059         /*
    00060          * the particle's content is a wildcard
    00061          */
    00062         TERM_WILDCARD       = XSConstants::WILDCARD
    00063     };
    00064
    00065     //  Constructors and Destructor
    00066     // -----------------------------------------------------------------------
    00069
    00080     XSParticle
    00081     (
    00082         TERM_TYPE              termType
    00083         , XSModel* const       xsModel
    00084         , XSObject* const      particleTerm
    00085         , XMLSize_t            minOccurs
    00086         , XMLSize_t            maxOccurs
    00087         , bool                 unbounded
    00088         , MemoryManager* const manager
    00089     );
    00090
    00092
    00095     ~XSParticle();
    00097
    00098     //---------------------
    00101
    00105     XMLSize_t getMinOccurs() const;
    00106
    00111     XMLSize_t getMaxOccurs() const;
    00112
    00116     bool getMaxOccursUnbounded() const;
    00117
    00122     TERM_TYPE getTermType() const;
    00123
    00130     XSElementDeclaration *getElementTerm();
    00131
    00138     XSModelGroup *getModelGroupTerm();
    00139
    00146     XSWildcard *getWildcardTerm();
    00147
    00149
    00150     //----------------------------------
    00153
    00155 private:
    00156
    00157     // -----------------------------------------------------------------------
    00158     //  Unimplemented constructors and operators
    00159     // -----------------------------------------------------------------------
    00160     XSParticle(const XSParticle&);
    00161     XSParticle & operator=(const XSParticle &);
    00162
    00163 protected:
    00164
    00165     // -----------------------------------------------------------------------
    00166     //  data members
    00167     // -----------------------------------------------------------------------
    00168     TERM_TYPE fTermType;
    00169     XMLSize_t fMinOccurs;
    00170     XMLSize_t fMaxOccurs;
    00171     bool      fUnbounded;
    00172     XSObject* fTerm;
    00173 };
    00174
    00175 inline XMLSize_t XSParticle::getMinOccurs() const
    00176 {
    00177     return fMinOccurs;
    00178 }
    00179
    00180 inline XMLSize_t XSParticle::getMaxOccurs() const
    00181 {
    00182     return fMaxOccurs;
    00183 }
    00184
    00185 inline bool XSParticle::getMaxOccursUnbounded() const
    00186 {
    00187     return fUnbounded;
    00188 }
    00189
    00190 inline XSParticle::TERM_TYPE XSParticle::getTermType() const
    00191 {
    00192     return fTermType;
    00193 }
    00194
    00195 XERCES_CPP_NAMESPACE_END
    00196
    00197 #endif