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: XSAttributeDeclaration.hpp,v $ 00019 * Revision 1.10 2004/09/08 13:56:07 peiyongz 00020 * Apache License Version 2.0 00021 * 00022 * Revision 1.9 2004/05/04 19:02:40 cargilld 00023 * Enable IDs to work on all kinds of schema components 00024 * 00025 * Revision 1.8 2003/12/24 17:42:02 knoaman 00026 * Misc. PSVI updates 00027 * 00028 * Revision 1.7 2003/12/01 23:23:26 neilg 00029 * fix for bug 25118; thanks to Jeroen Witmond 00030 * 00031 * Revision 1.6 2003/11/21 22:34:45 neilg 00032 * More schema component model implementation, thanks to David Cargill. 00033 * In particular, this cleans up and completes the XSModel, XSNamespaceItem, 00034 * XSAttributeDeclaration and XSAttributeGroup implementations. 00035 * 00036 * Revision 1.5 2003/11/21 17:19:30 knoaman 00037 * PSVI update. 00038 * 00039 * Revision 1.4 2003/11/14 22:47:53 neilg 00040 * fix bogus log message from previous commit... 00041 * 00042 * Revision 1.3 2003/11/14 22:33:30 neilg 00043 * Second phase of schema component model implementation. 00044 * Implement XSModel, XSNamespaceItem, and the plumbing necessary 00045 * to connect them to the other components. 00046 * Thanks to David Cargill. 00047 * 00048 * Revision 1.2 2003/11/06 15:30:04 neilg 00049 * 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. 00050 * 00051 * Revision 1.1 2003/09/16 14:33:36 neilg 00052 * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them 00053 * 00054 */ 00055 00056 #if !defined(XSATTRIBUTEDECLARATION_HPP) 00057 #define XSATTRIBUTEDECLARATION_HPP 00058 00059 #include <xercesc/framework/psvi/XSObject.hpp> 00060 00061 XERCES_CPP_NAMESPACE_BEGIN 00062 00070 // forward declarations 00071 class XSAnnotation; 00072 class XSComplexTypeDefinition; 00073 class XSSimpleTypeDefinition; 00074 class SchemaAttDef; 00075 00076 class XSAttributeDeclaration : public XSObject 00077 { 00078 public: 00079 00080 // Constructors and Destructor 00081 // ----------------------------------------------------------------------- 00084 00096 XSAttributeDeclaration 00097 ( 00098 SchemaAttDef* const attDef 00099 , XSSimpleTypeDefinition* const typeDef 00100 , XSAnnotation* const annot 00101 , XSModel* const xsModel 00102 , XSConstants::SCOPE scope 00103 , XSComplexTypeDefinition* enclosingCTDefinition 00104 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00105 ); 00106 00108 00111 ~XSAttributeDeclaration(); 00113 00114 //--------------------- 00118 00123 const XMLCh* getName(); 00124 00129 const XMLCh* getNamespace(); 00130 00136 XSNamespaceItem* getNamespaceItem(); 00137 00139 00143 00147 XSSimpleTypeDefinition *getTypeDefinition() const; 00148 00154 XSConstants::SCOPE getScope() const; 00155 00160 XSComplexTypeDefinition *getEnclosingCTDefinition(); 00161 00165 XSConstants::VALUE_CONSTRAINT getConstraintType() const; 00166 00171 const XMLCh *getConstraintValue(); 00172 00176 XSAnnotation *getAnnotation() const; 00177 00179 00180 //---------------------------------- 00184 00185 bool getRequired() const; 00187 00188 private: 00189 00190 void setEnclosingCTDefinition(XSComplexTypeDefinition* const toSet); 00191 friend class XSObjectFactory; 00192 00193 // ----------------------------------------------------------------------- 00194 // Unimplemented constructors and operators 00195 // ----------------------------------------------------------------------- 00196 XSAttributeDeclaration(const XSAttributeDeclaration&); 00197 XSAttributeDeclaration & operator=(const XSAttributeDeclaration &); 00198 00199 protected: 00200 00201 // ----------------------------------------------------------------------- 00202 // data members 00203 // ----------------------------------------------------------------------- 00204 SchemaAttDef* fAttDef; 00205 XSSimpleTypeDefinition* fTypeDefinition; 00206 XSAnnotation* fAnnotation; 00207 XSConstants::SCOPE fScope; 00208 XSComplexTypeDefinition* fEnclosingCTDefinition; 00209 }; 00210 00211 // --------------------------------------------------------------------------- 00212 // XSAttributeDeclaration: inline methods 00213 // --------------------------------------------------------------------------- 00214 inline XSSimpleTypeDefinition* XSAttributeDeclaration::getTypeDefinition() const 00215 { 00216 return fTypeDefinition; 00217 } 00218 00219 inline XSAnnotation *XSAttributeDeclaration::getAnnotation() const 00220 { 00221 return fAnnotation; 00222 } 00223 00224 inline XSConstants::SCOPE XSAttributeDeclaration::getScope() const 00225 { 00226 return fScope; 00227 } 00228 00229 inline XSComplexTypeDefinition *XSAttributeDeclaration::getEnclosingCTDefinition() 00230 { 00231 return fEnclosingCTDefinition; 00232 } 00233 00234 inline void XSAttributeDeclaration::setEnclosingCTDefinition 00235 ( 00236 XSComplexTypeDefinition* const toSet 00237 ) 00238 { 00239 fEnclosingCTDefinition = toSet; 00240 } 00241 00242 XERCES_CPP_NAMESPACE_END 00243 00244 #endif