00001 /* 00002 * Copyright 2003,2004 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 /* 00018 * $Id: XSParticle.hpp 191054 2005-06-17 02:56:35Z jberry $ 00019 */ 00020 00021 #if !defined(XSPARTICLE_HPP) 00022 #define XSPARTICLE_HPP 00023 00024 #include <xercesc/framework/psvi/XSObject.hpp> 00025 00026 XERCES_CPP_NAMESPACE_BEGIN 00027 00035 // forward declarations 00036 class XSElementDeclaration; 00037 class XSModelGroup; 00038 class XSWildcard; 00039 00040 class XSParticle : public XSObject 00041 { 00042 public: 00043 00044 // possible terms of this particle 00045 enum TERM_TYPE { 00046 /* 00047 * an empty particle 00048 */ 00049 TERM_EMPTY = 0, 00050 /* 00051 * the particle has element content 00052 */ 00053 TERM_ELEMENT = XSConstants::ELEMENT_DECLARATION, 00054 /* 00055 * the particle's content is a model group 00056 */ 00057 TERM_MODELGROUP = XSConstants::MODEL_GROUP_DEFINITION, 00058 /* 00059 * the particle's content is a wildcard 00060 */ 00061 TERM_WILDCARD = XSConstants::WILDCARD 00062 }; 00063 00064 // Constructors and Destructor 00065 // ----------------------------------------------------------------------- 00068 00079 XSParticle 00080 ( 00081 TERM_TYPE termType 00082 , XSModel* const xsModel 00083 , XSObject* const particleTerm 00084 , int minOccurs 00085 , int maxOccurs 00086 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00087 ); 00088 00090 00093 ~XSParticle(); 00095 00096 //--------------------- 00099 00103 int getMinOccurs() const; 00104 00109 int getMaxOccurs() const; 00110 00114 bool getMaxOccursUnbounded() const; 00115 00120 TERM_TYPE getTermType() const; 00121 00128 XSElementDeclaration *getElementTerm(); 00129 00136 XSModelGroup *getModelGroupTerm(); 00137 00144 XSWildcard *getWildcardTerm(); 00145 00147 00148 //---------------------------------- 00151 00153 private: 00154 00155 // ----------------------------------------------------------------------- 00156 // Unimplemented constructors and operators 00157 // ----------------------------------------------------------------------- 00158 XSParticle(const XSParticle&); 00159 XSParticle & operator=(const XSParticle &); 00160 00161 protected: 00162 00163 // ----------------------------------------------------------------------- 00164 // data members 00165 // ----------------------------------------------------------------------- 00166 TERM_TYPE fTermType; 00167 int fMinOccurs; 00168 int fMaxOccurs; 00169 XSObject* fTerm; 00170 }; 00171 00172 inline int XSParticle::getMinOccurs() const 00173 { 00174 return fMinOccurs; 00175 } 00176 00177 inline int XSParticle::getMaxOccurs() const 00178 { 00179 return fMaxOccurs; 00180 } 00181 00182 inline bool XSParticle::getMaxOccursUnbounded() const 00183 { 00184 return (fMaxOccurs == -1); 00185 } 00186 00187 inline XSParticle::TERM_TYPE XSParticle::getTermType() const 00188 { 00189 return fTermType; 00190 } 00191 00192 XERCES_CPP_NAMESPACE_END 00193 00194 #endif