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$ 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 00081 XSParticle 00082 ( 00083 TERM_TYPE termType 00084 , XSModel* const xsModel 00085 , XSObject* const particleTerm 00086 , XMLSize_t minOccurs 00087 , XMLSize_t maxOccurs 00088 , bool unbounded 00089 , MemoryManager* const manager 00090 ); 00091 00093 00096 ~XSParticle(); 00098 00099 //--------------------- 00102 00106 XMLSize_t getMinOccurs() const; 00107 00112 XMLSize_t getMaxOccurs() const; 00113 00117 bool getMaxOccursUnbounded() const; 00118 00123 TERM_TYPE getTermType() const; 00124 00131 XSElementDeclaration *getElementTerm(); 00132 00139 XSModelGroup *getModelGroupTerm(); 00140 00147 XSWildcard *getWildcardTerm(); 00148 00150 00151 //---------------------------------- 00154 00156 private: 00157 00158 // ----------------------------------------------------------------------- 00159 // Unimplemented constructors and operators 00160 // ----------------------------------------------------------------------- 00161 XSParticle(const XSParticle&); 00162 XSParticle & operator=(const XSParticle &); 00163 00164 protected: 00165 00166 // ----------------------------------------------------------------------- 00167 // data members 00168 // ----------------------------------------------------------------------- 00169 TERM_TYPE fTermType; 00170 XMLSize_t fMinOccurs; 00171 XMLSize_t fMaxOccurs; 00172 bool fUnbounded; 00173 XSObject* fTerm; 00174 }; 00175 00176 inline XMLSize_t XSParticle::getMinOccurs() const 00177 { 00178 return fMinOccurs; 00179 } 00180 00181 inline XMLSize_t XSParticle::getMaxOccurs() const 00182 { 00183 return fMaxOccurs; 00184 } 00185 00186 inline bool XSParticle::getMaxOccursUnbounded() const 00187 { 00188 return fUnbounded; 00189 } 00190 00191 inline XSParticle::TERM_TYPE XSParticle::getTermType() const 00192 { 00193 return fTermType; 00194 } 00195 00196 XERCES_CPP_NAMESPACE_END 00197 00198 #endif