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 * $Log: XSElementDeclaration.hpp,v $ 00019 * Revision 1.11 2004/09/08 13:56:08 peiyongz 00020 * Apache License Version 2.0 00021 * 00022 * Revision 1.10 2004/05/04 19:02:40 cargilld 00023 * Enable IDs to work on all kinds of schema components 00024 * 00025 * Revision 1.9 2003/12/24 17:42:02 knoaman 00026 * Misc. PSVI updates 00027 * 00028 * Revision 1.8 2003/12/01 23:23:26 neilg 00029 * fix for bug 25118; thanks to Jeroen Witmond 00030 * 00031 * Revision 1.7 2003/12/01 20:41:25 neilg 00032 * fix for infinite loop between XSComplexTypeDefinitions and XSElementDeclarations; from David Cargill 00033 * 00034 * Revision 1.6 2003/11/23 16:20:16 knoaman 00035 * PSVI: pass scope and enclosing type during construction. 00036 * 00037 * Revision 1.5 2003/11/21 17:29:53 knoaman 00038 * PSVI update 00039 * 00040 * Revision 1.4 2003/11/14 22:47:53 neilg 00041 * fix bogus log message from previous commit... 00042 * 00043 * Revision 1.3 2003/11/14 22:33:30 neilg 00044 * Second phase of schema component model implementation. 00045 * Implement XSModel, XSNamespaceItem, and the plumbing necessary 00046 * to connect them to the other components. 00047 * Thanks to David Cargill. 00048 * 00049 * Revision 1.2 2003/11/06 15:30:04 neilg 00050 * first part of PSVI/schema component model implementation, thanks to David Cargill. This covers setting the PSVIHandler on parser objects, as well as implementing XSNotation, XSSimpleTypeDefinition, XSIDCDefinition, and most of XSWildcard, XSComplexTypeDefinition, XSElementDeclaration, XSAttributeDeclaration and XSAttributeUse. 00051 * 00052 * Revision 1.1 2003/09/16 14:33:36 neilg 00053 * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them 00054 * 00055 */ 00056 00057 #if !defined(XSELEMENTDECLARATION_HPP) 00058 #define XSELEMENTDECLARATION_HPP 00059 00060 #include <xercesc/framework/psvi/XSObject.hpp> 00061 #include <xercesc/framework/psvi/XSNamedMap.hpp> 00062 00063 XERCES_CPP_NAMESPACE_BEGIN 00064 00072 // forward declarations 00073 class XSAnnotation; 00074 class XSComplexTypeDefinition; 00075 class XSIDCDefinition; 00076 class XSTypeDefinition; 00077 class SchemaElementDecl; 00078 00079 class XSElementDeclaration : public XSObject 00080 { 00081 public: 00082 00083 // Constructors and Destructor 00084 // ----------------------------------------------------------------------- 00087 00101 XSElementDeclaration 00102 ( 00103 SchemaElementDecl* const schemaElementDecl 00104 , XSTypeDefinition* const typeDefinition 00105 , XSElementDeclaration* const substitutionGroupAffiliation 00106 , XSAnnotation* const annot 00107 , XSNamedMap<XSIDCDefinition>* const identityConstraints 00108 , XSModel* const xsModel 00109 , XSConstants::SCOPE elemScope = XSConstants::SCOPE_ABSENT 00110 , XSComplexTypeDefinition* const enclosingTypeDefinition = 0 00111 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00112 ); 00113 00115 00118 ~XSElementDeclaration(); 00120 00121 //--------------------- 00125 00130 const XMLCh* getName(); 00131 00136 const XMLCh* getNamespace(); 00137 00143 XSNamespaceItem *getNamespaceItem(); 00144 00146 00147 //--------------------- 00151 00156 XSTypeDefinition *getTypeDefinition() const; 00157 00163 XSConstants::SCOPE getScope() const; 00164 00169 XSComplexTypeDefinition *getEnclosingCTDefinition() const; 00170 00174 XSConstants::VALUE_CONSTRAINT getConstraintType() const; 00175 00180 const XMLCh *getConstraintValue(); 00181 00190 bool getNillable() const; 00191 00195 XSNamedMap <XSIDCDefinition> *getIdentityConstraints(); 00196 00201 XSElementDeclaration *getSubstitutionGroupAffiliation() const; 00202 00212 bool isSubstitutionGroupExclusion(XSConstants::DERIVATION_TYPE exclusion); 00213 00220 short getSubstitutionGroupExclusions() const; 00221 00232 bool isDisallowedSubstitution(XSConstants::DERIVATION_TYPE disallowed); 00233 00241 short getDisallowedSubstitutions() const; 00242 00246 bool getAbstract() const; 00247 00251 XSAnnotation *getAnnotation() const; 00252 00254 00255 //---------------------------------- 00259 00260 void setTypeDefinition(XSTypeDefinition* typeDefinition); 00261 00263 private: 00264 00265 void setEnclosingCTDefinition(XSComplexTypeDefinition* const toSet); 00266 friend class XSObjectFactory; 00267 00268 // ----------------------------------------------------------------------- 00269 // Unimplemented constructors and operators 00270 // ----------------------------------------------------------------------- 00271 XSElementDeclaration(const XSElementDeclaration&); 00272 XSElementDeclaration & operator=(const XSElementDeclaration &); 00273 00274 protected: 00275 00276 // ----------------------------------------------------------------------- 00277 // data members 00278 // ----------------------------------------------------------------------- 00279 short fDisallowedSubstitutions; 00280 short fSubstitutionGroupExclusions; 00281 XSConstants::SCOPE fScope; 00282 SchemaElementDecl* fSchemaElementDecl; 00283 XSTypeDefinition* fTypeDefinition; 00284 XSComplexTypeDefinition* fEnclosingTypeDefinition; 00285 XSElementDeclaration* fSubstitutionGroupAffiliation; 00286 XSAnnotation* fAnnotation; 00287 XSNamedMap<XSIDCDefinition>* fIdentityConstraints; 00288 }; 00289 00290 inline XSTypeDefinition* XSElementDeclaration::getTypeDefinition() const 00291 { 00292 return fTypeDefinition; 00293 } 00294 00295 inline XSNamedMap<XSIDCDefinition>* XSElementDeclaration::getIdentityConstraints() 00296 { 00297 return fIdentityConstraints; 00298 } 00299 00300 inline XSElementDeclaration* XSElementDeclaration::getSubstitutionGroupAffiliation() const 00301 { 00302 return fSubstitutionGroupAffiliation; 00303 } 00304 00305 inline short XSElementDeclaration::getSubstitutionGroupExclusions() const 00306 { 00307 return fSubstitutionGroupExclusions; 00308 } 00309 00310 inline short XSElementDeclaration::getDisallowedSubstitutions() const 00311 { 00312 return fDisallowedSubstitutions; 00313 } 00314 00315 inline XSAnnotation *XSElementDeclaration::getAnnotation() const 00316 { 00317 return fAnnotation; 00318 } 00319 00320 inline XSConstants::SCOPE XSElementDeclaration::getScope() const 00321 { 00322 return fScope; 00323 } 00324 00325 inline XSComplexTypeDefinition *XSElementDeclaration::getEnclosingCTDefinition() const 00326 { 00327 return fEnclosingTypeDefinition; 00328 } 00329 00330 inline void XSElementDeclaration::setTypeDefinition(XSTypeDefinition* typeDefinition) 00331 { 00332 fTypeDefinition = typeDefinition; 00333 } 00334 00335 inline void XSElementDeclaration::setEnclosingCTDefinition(XSComplexTypeDefinition* const toSet) 00336 { 00337 fEnclosingTypeDefinition = toSet; 00338 } 00339 00340 XERCES_CPP_NAMESPACE_END 00341 00342 #endif