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 * $Log: XSParticle.hpp,v $ 00019 * Revision 1.6 2004/09/08 13:56:09 peiyongz 00020 * Apache License Version 2.0 00021 * 00022 * Revision 1.5 2003/12/01 23:23:26 neilg 00023 * fix for bug 25118; thanks to Jeroen Witmond 00024 * 00025 * Revision 1.4 2003/11/21 17:34:04 knoaman 00026 * PSVI update 00027 * 00028 * Revision 1.3 2003/11/14 22:47:53 neilg 00029 * fix bogus log message from previous commit... 00030 * 00031 * Revision 1.2 2003/11/14 22:33:30 neilg 00032 * Second phase of schema component model implementation. 00033 * Implement XSModel, XSNamespaceItem, and the plumbing necessary 00034 * to connect them to the other components. 00035 * Thanks to David Cargill. 00036 * 00037 * Revision 1.1 2003/09/16 14:33:36 neilg 00038 * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them 00039 * 00040 */ 00041 00042 #if !defined(XSPARTICLE_HPP) 00043 #define XSPARTICLE_HPP 00044 00045 #include <xercesc/framework/psvi/XSObject.hpp> 00046 00047 XERCES_CPP_NAMESPACE_BEGIN 00048 00056 // forward declarations 00057 class XSElementDeclaration; 00058 class XSModelGroup; 00059 class XSWildcard; 00060 00061 class XSParticle : public XSObject 00062 { 00063 public: 00064 00065 // possible terms of this particle 00066 enum TERM_TYPE { 00067 /* 00068 * an empty particle 00069 */ 00070 TERM_EMPTY = 0, 00071 /* 00072 * the particle has element content 00073 */ 00074 TERM_ELEMENT = XSConstants::ELEMENT_DECLARATION, 00075 /* 00076 * the particle's content is a model group 00077 */ 00078 TERM_MODELGROUP = XSConstants::MODEL_GROUP_DEFINITION, 00079 /* 00080 * the particle's content is a wildcard 00081 */ 00082 TERM_WILDCARD = XSConstants::WILDCARD 00083 }; 00084 00085 // Constructors and Destructor 00086 // ----------------------------------------------------------------------- 00089 00100 XSParticle 00101 ( 00102 TERM_TYPE termType 00103 , XSModel* const xsModel 00104 , XSObject* const particleTerm 00105 , int minOccurs 00106 , int maxOccurs 00107 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00108 ); 00109 00111 00114 ~XSParticle(); 00116 00117 //--------------------- 00120 00124 int getMinOccurs() const; 00125 00130 int getMaxOccurs() const; 00131 00135 bool getMaxOccursUnbounded() const; 00136 00141 TERM_TYPE getTermType() const; 00142 00149 XSElementDeclaration *getElementTerm(); 00150 00157 XSModelGroup *getModelGroupTerm(); 00158 00165 XSWildcard *getWildcardTerm(); 00166 00168 00169 //---------------------------------- 00172 00174 private: 00175 00176 // ----------------------------------------------------------------------- 00177 // Unimplemented constructors and operators 00178 // ----------------------------------------------------------------------- 00179 XSParticle(const XSParticle&); 00180 XSParticle & operator=(const XSParticle &); 00181 00182 protected: 00183 00184 // ----------------------------------------------------------------------- 00185 // data members 00186 // ----------------------------------------------------------------------- 00187 TERM_TYPE fTermType; 00188 int fMinOccurs; 00189 int fMaxOccurs; 00190 XSObject* fTerm; 00191 }; 00192 00193 inline int XSParticle::getMinOccurs() const 00194 { 00195 return fMinOccurs; 00196 } 00197 00198 inline int XSParticle::getMaxOccurs() const 00199 { 00200 return fMaxOccurs; 00201 } 00202 00203 inline bool XSParticle::getMaxOccursUnbounded() const 00204 { 00205 return (fMaxOccurs == -1); 00206 } 00207 00208 inline XSParticle::TERM_TYPE XSParticle::getTermType() const 00209 { 00210 return fTermType; 00211 } 00212 00213 XERCES_CPP_NAMESPACE_END 00214 00215 #endif