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 * $Id: XSElementDeclaration.hpp 191054 2005-06-17 02:56:35Z jberry $ 00019 */ 00020 00021 #if !defined(XSELEMENTDECLARATION_HPP) 00022 #define XSELEMENTDECLARATION_HPP 00023 00024 #include <xercesc/framework/psvi/XSObject.hpp> 00025 #include <xercesc/framework/psvi/XSNamedMap.hpp> 00026 00027 XERCES_CPP_NAMESPACE_BEGIN 00028 00036 // forward declarations 00037 class XSAnnotation; 00038 class XSComplexTypeDefinition; 00039 class XSIDCDefinition; 00040 class XSTypeDefinition; 00041 class SchemaElementDecl; 00042 00043 class XSElementDeclaration : public XSObject 00044 { 00045 public: 00046 00047 // Constructors and Destructor 00048 // ----------------------------------------------------------------------- 00051 00065 XSElementDeclaration 00066 ( 00067 SchemaElementDecl* const schemaElementDecl 00068 , XSTypeDefinition* const typeDefinition 00069 , XSElementDeclaration* const substitutionGroupAffiliation 00070 , XSAnnotation* const annot 00071 , XSNamedMap<XSIDCDefinition>* const identityConstraints 00072 , XSModel* const xsModel 00073 , XSConstants::SCOPE elemScope = XSConstants::SCOPE_ABSENT 00074 , XSComplexTypeDefinition* const enclosingTypeDefinition = 0 00075 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00076 ); 00077 00079 00082 ~XSElementDeclaration(); 00084 00085 //--------------------- 00089 00094 const XMLCh* getName(); 00095 00100 const XMLCh* getNamespace(); 00101 00107 XSNamespaceItem *getNamespaceItem(); 00108 00110 00111 //--------------------- 00115 00120 XSTypeDefinition *getTypeDefinition() const; 00121 00127 XSConstants::SCOPE getScope() const; 00128 00133 XSComplexTypeDefinition *getEnclosingCTDefinition() const; 00134 00138 XSConstants::VALUE_CONSTRAINT getConstraintType() const; 00139 00144 const XMLCh *getConstraintValue(); 00145 00154 bool getNillable() const; 00155 00159 XSNamedMap <XSIDCDefinition> *getIdentityConstraints(); 00160 00165 XSElementDeclaration *getSubstitutionGroupAffiliation() const; 00166 00176 bool isSubstitutionGroupExclusion(XSConstants::DERIVATION_TYPE exclusion); 00177 00184 short getSubstitutionGroupExclusions() const; 00185 00196 bool isDisallowedSubstitution(XSConstants::DERIVATION_TYPE disallowed); 00197 00205 short getDisallowedSubstitutions() const; 00206 00210 bool getAbstract() const; 00211 00215 XSAnnotation *getAnnotation() const; 00216 00218 00219 //---------------------------------- 00223 00224 void setTypeDefinition(XSTypeDefinition* typeDefinition); 00225 00227 private: 00228 00229 void setEnclosingCTDefinition(XSComplexTypeDefinition* const toSet); 00230 friend class XSObjectFactory; 00231 00232 // ----------------------------------------------------------------------- 00233 // Unimplemented constructors and operators 00234 // ----------------------------------------------------------------------- 00235 XSElementDeclaration(const XSElementDeclaration&); 00236 XSElementDeclaration & operator=(const XSElementDeclaration &); 00237 00238 protected: 00239 00240 // ----------------------------------------------------------------------- 00241 // data members 00242 // ----------------------------------------------------------------------- 00243 short fDisallowedSubstitutions; 00244 short fSubstitutionGroupExclusions; 00245 XSConstants::SCOPE fScope; 00246 SchemaElementDecl* fSchemaElementDecl; 00247 XSTypeDefinition* fTypeDefinition; 00248 XSComplexTypeDefinition* fEnclosingTypeDefinition; 00249 XSElementDeclaration* fSubstitutionGroupAffiliation; 00250 XSAnnotation* fAnnotation; 00251 XSNamedMap<XSIDCDefinition>* fIdentityConstraints; 00252 }; 00253 00254 inline XSTypeDefinition* XSElementDeclaration::getTypeDefinition() const 00255 { 00256 return fTypeDefinition; 00257 } 00258 00259 inline XSNamedMap<XSIDCDefinition>* XSElementDeclaration::getIdentityConstraints() 00260 { 00261 return fIdentityConstraints; 00262 } 00263 00264 inline XSElementDeclaration* XSElementDeclaration::getSubstitutionGroupAffiliation() const 00265 { 00266 return fSubstitutionGroupAffiliation; 00267 } 00268 00269 inline short XSElementDeclaration::getSubstitutionGroupExclusions() const 00270 { 00271 return fSubstitutionGroupExclusions; 00272 } 00273 00274 inline short XSElementDeclaration::getDisallowedSubstitutions() const 00275 { 00276 return fDisallowedSubstitutions; 00277 } 00278 00279 inline XSAnnotation *XSElementDeclaration::getAnnotation() const 00280 { 00281 return fAnnotation; 00282 } 00283 00284 inline XSConstants::SCOPE XSElementDeclaration::getScope() const 00285 { 00286 return fScope; 00287 } 00288 00289 inline XSComplexTypeDefinition *XSElementDeclaration::getEnclosingCTDefinition() const 00290 { 00291 return fEnclosingTypeDefinition; 00292 } 00293 00294 inline void XSElementDeclaration::setTypeDefinition(XSTypeDefinition* typeDefinition) 00295 { 00296 fTypeDefinition = typeDefinition; 00297 } 00298 00299 inline void XSElementDeclaration::setEnclosingCTDefinition(XSComplexTypeDefinition* const toSet) 00300 { 00301 fEnclosingTypeDefinition = toSet; 00302 } 00303 00304 XERCES_CPP_NAMESPACE_END 00305 00306 #endif