GME
13
|
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.cpp 674012 2008-07-04 11:18:21Z borisk $ 00020 */ 00021 00022 #include <xercesc/framework/psvi/XSParticle.hpp> 00023 #include <xercesc/framework/psvi/XSElementDeclaration.hpp> 00024 #include <xercesc/framework/psvi/XSModelGroup.hpp> 00025 #include <xercesc/framework/psvi/XSWildcard.hpp> 00026 00027 XERCES_CPP_NAMESPACE_BEGIN 00028 00029 // --------------------------------------------------------------------------- 00030 // XSParticle: Constructors and Destructor 00031 // --------------------------------------------------------------------------- 00032 XSParticle::XSParticle(TERM_TYPE termType, 00033 XSModel* const xsModel, 00034 XSObject* const particleTerm, 00035 XMLSize_t minOccurs, 00036 XMLSize_t maxOccurs, 00037 bool unbounded, 00038 MemoryManager* const manager) 00039 : XSObject(XSConstants::PARTICLE, xsModel, manager) 00040 , fTermType(termType) 00041 , fMinOccurs(minOccurs) 00042 , fMaxOccurs(maxOccurs) 00043 , fUnbounded (unbounded) 00044 , fTerm(particleTerm) 00045 { 00046 } 00047 00048 XSParticle::~XSParticle() 00049 { 00050 if (fTerm && (fTermType == TERM_MODELGROUP)) 00051 delete ((XSModelGroup*) fTerm); 00052 } 00053 00054 // --------------------------------------------------------------------------- 00055 // XSParticle: methods 00056 // --------------------------------------------------------------------------- 00057 XSElementDeclaration *XSParticle::getElementTerm() 00058 { 00059 if (fTermType == TERM_ELEMENT) 00060 return (XSElementDeclaration*) fTerm; 00061 00062 return 0; 00063 } 00064 00065 XSModelGroup *XSParticle::getModelGroupTerm() 00066 { 00067 if (fTermType == TERM_MODELGROUP) 00068 return (XSModelGroup*) fTerm; 00069 00070 return 0; 00071 } 00072 00073 XSWildcard *XSParticle::getWildcardTerm() 00074 { 00075 if (fTermType == TERM_WILDCARD) 00076 return (XSWildcard*) fTerm; 00077 00078 return 0; 00079 } 00080 00081 XERCES_CPP_NAMESPACE_END