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 568078 2007-08-21 11:43:25Z amassari $ 00020 */ 00021 00022 #if !defined(XSPARTICLE_HPP) 00023 #define 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 , int minOccurs 00086 , int maxOccurs 00087 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00088 ); 00089 00091 00094 ~XSParticle(); 00096 00097 //--------------------- 00100 00104 int getMinOccurs() const; 00105 00110 int getMaxOccurs() const; 00111 00115 bool getMaxOccursUnbounded() const; 00116 00121 TERM_TYPE getTermType() const; 00122 00129 XSElementDeclaration *getElementTerm(); 00130 00137 XSModelGroup *getModelGroupTerm(); 00138 00145 XSWildcard *getWildcardTerm(); 00146 00148 00149 //---------------------------------- 00152 00154 private: 00155 00156 // ----------------------------------------------------------------------- 00157 // Unimplemented constructors and operators 00158 // ----------------------------------------------------------------------- 00159 XSParticle(const XSParticle&); 00160 XSParticle & operator=(const XSParticle &); 00161 00162 protected: 00163 00164 // ----------------------------------------------------------------------- 00165 // data members 00166 // ----------------------------------------------------------------------- 00167 TERM_TYPE fTermType; 00168 int fMinOccurs; 00169 int fMaxOccurs; 00170 XSObject* fTerm; 00171 }; 00172 00173 inline int XSParticle::getMinOccurs() const 00174 { 00175 return fMinOccurs; 00176 } 00177 00178 inline int XSParticle::getMaxOccurs() const 00179 { 00180 return fMaxOccurs; 00181 } 00182 00183 inline bool XSParticle::getMaxOccursUnbounded() const 00184 { 00185 return (fMaxOccurs == -1); 00186 } 00187 00188 inline XSParticle::TERM_TYPE XSParticle::getTermType() const 00189 { 00190 return fTermType; 00191 } 00192 00193 XERCES_CPP_NAMESPACE_END 00194 00195 #endif
1.5.4