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$ 00020 */ 00021 00022 #if !defined(XERCESC_INCLUDE_GUARD_XSELEMENTDECLARATION_HPP) 00023 #define XERCESC_INCLUDE_GUARD_XSELEMENTDECLARATION_HPP 00024 00025 #include <xercesc/framework/psvi/XSObject.hpp> 00026 #include <xercesc/framework/psvi/XSNamedMap.hpp> 00027 00028 XERCES_CPP_NAMESPACE_BEGIN 00029 00037 // forward declarations 00038 class XSAnnotation; 00039 class XSComplexTypeDefinition; 00040 class XSIDCDefinition; 00041 class XSTypeDefinition; 00042 class SchemaElementDecl; 00043 00044 class XMLPARSER_EXPORT XSElementDeclaration : public XSObject 00045 { 00046 public: 00047 00048 // Constructors and Destructor 00049 // ----------------------------------------------------------------------- 00052 00066 XSElementDeclaration 00067 ( 00068 SchemaElementDecl* const schemaElementDecl 00069 , XSTypeDefinition* const typeDefinition 00070 , XSElementDeclaration* const substitutionGroupAffiliation 00071 , XSAnnotation* const annot 00072 , XSNamedMap<XSIDCDefinition>* const identityConstraints 00073 , XSModel* const xsModel 00074 , XSConstants::SCOPE elemScope = XSConstants::SCOPE_ABSENT 00075 , XSComplexTypeDefinition* const enclosingTypeDefinition = 0 00076 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00077 ); 00078 00080 00083 ~XSElementDeclaration(); 00085 00086 //--------------------- 00090 00095 const XMLCh* getName() const; 00096 00101 const XMLCh* getNamespace(); 00102 00108 XSNamespaceItem *getNamespaceItem(); 00109 00111 00112 //--------------------- 00116 00121 XSTypeDefinition *getTypeDefinition() const; 00122 00128 XSConstants::SCOPE getScope() const; 00129 00134 XSComplexTypeDefinition *getEnclosingCTDefinition() const; 00135 00139 XSConstants::VALUE_CONSTRAINT getConstraintType() const; 00140 00145 const XMLCh *getConstraintValue(); 00146 00155 bool getNillable() const; 00156 00160 XSNamedMap <XSIDCDefinition> *getIdentityConstraints(); 00161 00166 XSElementDeclaration *getSubstitutionGroupAffiliation() const; 00167 00177 bool isSubstitutionGroupExclusion(XSConstants::DERIVATION_TYPE exclusion); 00178 00185 short getSubstitutionGroupExclusions() const; 00186 00197 bool isDisallowedSubstitution(XSConstants::DERIVATION_TYPE disallowed); 00198 00206 short getDisallowedSubstitutions() const; 00207 00211 bool getAbstract() const; 00212 00216 XSAnnotation *getAnnotation() const; 00217 00219 00220 //---------------------------------- 00224 00225 void setTypeDefinition(XSTypeDefinition* typeDefinition); 00226 00228 private: 00229 00230 void setEnclosingCTDefinition(XSComplexTypeDefinition* const toSet); 00231 friend class XSObjectFactory; 00232 00233 // ----------------------------------------------------------------------- 00234 // Unimplemented constructors and operators 00235 // ----------------------------------------------------------------------- 00236 XSElementDeclaration(const XSElementDeclaration&); 00237 XSElementDeclaration & operator=(const XSElementDeclaration &); 00238 00239 protected: 00240 00241 // ----------------------------------------------------------------------- 00242 // data members 00243 // ----------------------------------------------------------------------- 00244 short fDisallowedSubstitutions; 00245 short fSubstitutionGroupExclusions; 00246 XSConstants::SCOPE fScope; 00247 SchemaElementDecl* fSchemaElementDecl; 00248 XSTypeDefinition* fTypeDefinition; 00249 XSComplexTypeDefinition* fEnclosingTypeDefinition; 00250 XSElementDeclaration* fSubstitutionGroupAffiliation; 00251 XSAnnotation* fAnnotation; 00252 XSNamedMap<XSIDCDefinition>* fIdentityConstraints; 00253 }; 00254 00255 inline XSTypeDefinition* XSElementDeclaration::getTypeDefinition() const 00256 { 00257 return fTypeDefinition; 00258 } 00259 00260 inline XSNamedMap<XSIDCDefinition>* XSElementDeclaration::getIdentityConstraints() 00261 { 00262 return fIdentityConstraints; 00263 } 00264 00265 inline XSElementDeclaration* XSElementDeclaration::getSubstitutionGroupAffiliation() const 00266 { 00267 return fSubstitutionGroupAffiliation; 00268 } 00269 00270 inline short XSElementDeclaration::getSubstitutionGroupExclusions() const 00271 { 00272 return fSubstitutionGroupExclusions; 00273 } 00274 00275 inline short XSElementDeclaration::getDisallowedSubstitutions() const 00276 { 00277 return fDisallowedSubstitutions; 00278 } 00279 00280 inline XSAnnotation *XSElementDeclaration::getAnnotation() const 00281 { 00282 return fAnnotation; 00283 } 00284 00285 inline XSConstants::SCOPE XSElementDeclaration::getScope() const 00286 { 00287 return fScope; 00288 } 00289 00290 inline XSComplexTypeDefinition *XSElementDeclaration::getEnclosingCTDefinition() const 00291 { 00292 return fEnclosingTypeDefinition; 00293 } 00294 00295 inline void XSElementDeclaration::setTypeDefinition(XSTypeDefinition* typeDefinition) 00296 { 00297 fTypeDefinition = typeDefinition; 00298 } 00299 00300 inline void XSElementDeclaration::setEnclosingCTDefinition(XSComplexTypeDefinition* const toSet) 00301 { 00302 fEnclosingTypeDefinition = toSet; 00303 } 00304 00305 XERCES_CPP_NAMESPACE_END 00306 00307 #endif