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 * $Log$ 00020 * Revision 1.10 2004/09/08 13:56:07 peiyongz 00021 * Apache License Version 2.0 00022 * 00023 * Revision 1.9 2004/05/04 19:02:40 cargilld 00024 * Enable IDs to work on all kinds of schema components 00025 * 00026 * Revision 1.8 2003/12/24 17:42:02 knoaman 00027 * Misc. PSVI updates 00028 * 00029 * Revision 1.7 2003/12/01 23:23:26 neilg 00030 * fix for bug 25118; thanks to Jeroen Witmond 00031 * 00032 * Revision 1.6 2003/11/21 22:34:45 neilg 00033 * More schema component model implementation, thanks to David Cargill. 00034 * In particular, this cleans up and completes the XSModel, XSNamespaceItem, 00035 * XSAttributeDeclaration and XSAttributeGroup implementations. 00036 * 00037 * Revision 1.5 2003/11/21 17:19:30 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(XSATTRIBUTEDECLARATION_HPP) 00058 #define XSATTRIBUTEDECLARATION_HPP 00059 00060 #include <xercesc/framework/psvi/XSObject.hpp> 00061 00062 XERCES_CPP_NAMESPACE_BEGIN 00063 00071 // forward declarations 00072 class XSAnnotation; 00073 class XSComplexTypeDefinition; 00074 class XSSimpleTypeDefinition; 00075 class SchemaAttDef; 00076 00077 class XSAttributeDeclaration : public XSObject 00078 { 00079 public: 00080 00081 // Constructors and Destructor 00082 // ----------------------------------------------------------------------- 00085 00097 XSAttributeDeclaration 00098 ( 00099 SchemaAttDef* const attDef 00100 , XSSimpleTypeDefinition* const typeDef 00101 , XSAnnotation* const annot 00102 , XSModel* const xsModel 00103 , XSConstants::SCOPE scope 00104 , XSComplexTypeDefinition* enclosingCTDefinition 00105 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00106 ); 00107 00109 00112 ~XSAttributeDeclaration(); 00114 00115 //--------------------- 00119 00124 const XMLCh* getName(); 00125 00130 const XMLCh* getNamespace(); 00131 00137 XSNamespaceItem* getNamespaceItem(); 00138 00140 00144 00148 XSSimpleTypeDefinition *getTypeDefinition() const; 00149 00155 XSConstants::SCOPE getScope() const; 00156 00161 XSComplexTypeDefinition *getEnclosingCTDefinition(); 00162 00166 XSConstants::VALUE_CONSTRAINT getConstraintType() const; 00167 00172 const XMLCh *getConstraintValue(); 00173 00177 XSAnnotation *getAnnotation() const; 00178 00180 00181 //---------------------------------- 00185 00186 bool getRequired() const; 00188 00189 private: 00190 00191 void setEnclosingCTDefinition(XSComplexTypeDefinition* const toSet); 00192 friend class XSObjectFactory; 00193 00194 // ----------------------------------------------------------------------- 00195 // Unimplemented constructors and operators 00196 // ----------------------------------------------------------------------- 00197 XSAttributeDeclaration(const XSAttributeDeclaration&); 00198 XSAttributeDeclaration & operator=(const XSAttributeDeclaration &); 00199 00200 protected: 00201 00202 // ----------------------------------------------------------------------- 00203 // data members 00204 // ----------------------------------------------------------------------- 00205 SchemaAttDef* fAttDef; 00206 XSSimpleTypeDefinition* fTypeDefinition; 00207 XSAnnotation* fAnnotation; 00208 XSConstants::SCOPE fScope; 00209 XSComplexTypeDefinition* fEnclosingCTDefinition; 00210 }; 00211 00212 // --------------------------------------------------------------------------- 00213 // XSAttributeDeclaration: inline methods 00214 // --------------------------------------------------------------------------- 00215 inline XSSimpleTypeDefinition* XSAttributeDeclaration::getTypeDefinition() const 00216 { 00217 return fTypeDefinition; 00218 } 00219 00220 inline XSAnnotation *XSAttributeDeclaration::getAnnotation() const 00221 { 00222 return fAnnotation; 00223 } 00224 00225 inline XSConstants::SCOPE XSAttributeDeclaration::getScope() const 00226 { 00227 return fScope; 00228 } 00229 00230 inline XSComplexTypeDefinition *XSAttributeDeclaration::getEnclosingCTDefinition() 00231 { 00232 return fEnclosingCTDefinition; 00233 } 00234 00235 inline void XSAttributeDeclaration::setEnclosingCTDefinition 00236 ( 00237 XSComplexTypeDefinition* const toSet 00238 ) 00239 { 00240 fEnclosingCTDefinition = toSet; 00241 } 00242 00243 XERCES_CPP_NAMESPACE_END 00244 00245 #endif