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: XSTypeDefinition.hpp,v $ 00019 * Revision 1.9 2004/09/08 13:56:09 peiyongz 00020 * Apache License Version 2.0 00021 * 00022 * Revision 1.8 2003/12/01 23:23:26 neilg 00023 * fix for bug 25118; thanks to Jeroen Witmond 00024 * 00025 * Revision 1.7 2003/11/25 18:08:31 knoaman 00026 * Misc. PSVI updates. Thanks to David Cargill. 00027 * 00028 * Revision 1.6 2003/11/21 17:34:04 knoaman 00029 * PSVI update 00030 * 00031 * Revision 1.5 2003/11/15 21:19:01 neilg 00032 * fixes for compilation under gcc 00033 * 00034 * Revision 1.4 2003/11/14 22:47:53 neilg 00035 * fix bogus log message from previous commit... 00036 * 00037 * Revision 1.3 2003/11/14 22:33:30 neilg 00038 * Second phase of schema component model implementation. 00039 * Implement XSModel, XSNamespaceItem, and the plumbing necessary 00040 * to connect them to the other components. 00041 * Thanks to David Cargill. 00042 * 00043 * Revision 1.2 2003/11/06 15:30:04 neilg 00044 * 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. 00045 * 00046 * Revision 1.1 2003/09/16 14:33:36 neilg 00047 * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them 00048 * 00049 */ 00050 00051 #if !defined(XSTYPEDEFINITION_HPP) 00052 #define XSTYPEDEFINITION_HPP 00053 00054 #include <xercesc/framework/psvi/XSObject.hpp> 00055 00056 XERCES_CPP_NAMESPACE_BEGIN 00057 00058 // forward declarations 00059 class XSNamespaceItem; 00060 00068 class XSTypeDefinition : public XSObject 00069 { 00070 public: 00071 00072 enum TYPE_CATEGORY { 00076 COMPLEX_TYPE = 15, 00080 SIMPLE_TYPE = 16 00081 }; 00082 00083 // Constructors and Destructor 00084 // ----------------------------------------------------------------------- 00087 00096 XSTypeDefinition 00097 ( 00098 TYPE_CATEGORY typeCategory 00099 , XSTypeDefinition* const xsBaseType 00100 , XSModel* const xsModel 00101 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00102 ); 00103 00105 00108 virtual ~XSTypeDefinition(); 00110 00111 //--------------------- 00114 00119 virtual const XMLCh* getName() = 0; 00120 00125 virtual const XMLCh* getNamespace() = 0; 00126 00132 virtual XSNamespaceItem *getNamespaceItem() = 0; 00133 00135 00136 //--------------------- 00140 00144 TYPE_CATEGORY getTypeCategory() const; 00145 00150 virtual XSTypeDefinition *getBaseType() = 0; 00151 00160 bool isFinal(short toTest); 00161 00172 short getFinal() const; 00173 00178 virtual bool getAnonymous() const = 0; 00179 00187 virtual bool derivedFromType(const XSTypeDefinition* const ancestorType) = 0; 00188 00197 bool derivedFrom(const XMLCh* typeNamespace, 00198 const XMLCh* name); 00199 00201 00202 //---------------------------------- 00206 00208 private: 00209 00210 // ----------------------------------------------------------------------- 00211 // Unimplemented constructors and operators 00212 // ----------------------------------------------------------------------- 00213 XSTypeDefinition(const XSTypeDefinition&); 00214 XSTypeDefinition & operator=(const XSTypeDefinition &); 00215 00216 protected: 00217 00218 // ----------------------------------------------------------------------- 00219 // data members 00220 // ----------------------------------------------------------------------- 00221 // fTypeCategory 00222 // whether this is a simpleType or complexType 00223 // fFinal 00224 // the final properties which is set by the derived class. 00225 TYPE_CATEGORY fTypeCategory; 00226 short fFinal; 00227 XSTypeDefinition* fBaseType; // owned by XSModel 00228 }; 00229 00230 inline XSTypeDefinition::TYPE_CATEGORY XSTypeDefinition::getTypeCategory() const 00231 { 00232 return fTypeCategory; 00233 } 00234 00235 inline short XSTypeDefinition::getFinal() const 00236 { 00237 return fFinal; 00238 } 00239 00240 00241 XERCES_CPP_NAMESPACE_END 00242 00243 #endif