00001 /*00002 * Licensed to the Apache Software Foundation (ASF) under one or more00003 * contributor license agreements. See the NOTICE file distributed with00004 * this work for additional information regarding copyright ownership.00005 * The ASF licenses this file to You under the Apache License, Version 2.000006 * (the "License"); you may not use this file except in compliance with00007 * the License. You may obtain a copy of the License at00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.000010 * 00011 * Unless required by applicable law or agreed to in writing, software00012 * 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 and00015 * 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_HPP00024
00025 #include <xercesc/framework/psvi/XSObject.hpp>00026
00027 XERCES_CPP_NAMESPACE_BEGIN00028
00036 // forward declarations00037 class XSElementDeclaration;
00038 class XSModelGroup;
00039 class XSWildcard;
00040
00041class XSParticle : publicXSObject00042 {
00043 public:
00044
00045 // possible terms of this particle00046enumTERM_TYPE {
00047 /*00048 * an empty particle00049 */00050 TERM_EMPTY = 0,
00051 /*00052 * the particle has element content00053 */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 wildcard00061 */00062 TERM_WILDCARD = XSConstants::WILDCARD00063 };
00064
00065 // Constructors and Destructor00066 // -----------------------------------------------------------------------00069
00080 XSParticle00081 (
00082 TERM_TYPE termType
00083 , XSModel* const xsModel
00084 , XSObject* const particleTerm
00085 , int minOccurs
00086 , int maxOccurs
00087 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager00088 );
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 operators00158 // -----------------------------------------------------------------------00159 XSParticle(constXSParticle&);
00160 XSParticle & operator=(constXSParticle &);
00161
00162 protected:
00163
00164 // -----------------------------------------------------------------------00165 // data members00166 // -----------------------------------------------------------------------00167TERM_TYPE fTermType;
00168int fMinOccurs;
00169int fMaxOccurs;
00170XSObject* fTerm;
00171 };
00172
00173inlineintXSParticle::getMinOccurs() const00174 {
00175 returnfMinOccurs;
00176 }
00177
00178inlineintXSParticle::getMaxOccurs() const00179 {
00180 returnfMaxOccurs;
00181 }
00182
00183inlineboolXSParticle::getMaxOccursUnbounded() const00184 {
00185 return (fMaxOccurs == -1);
00186 }
00187
00188inlineXSParticle::TERM_TYPEXSParticle::getTermType() const00189 {
00190 returnfTermType;
00191 }
00192
00193 XERCES_CPP_NAMESPACE_END00194
00195 #endif