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 * $Id$ 00020 */ 00021 00022 #if !defined(XERCESC_INCLUDE_GUARD_XSTYPEDEFINITION_HPP) 00023 #define XERCESC_INCLUDE_GUARD_XSTYPEDEFINITION_HPP 00024 00025 #include <xercesc/framework/psvi/XSObject.hpp> 00026 00027 XERCES_CPP_NAMESPACE_BEGIN 00028 00029 // forward declarations 00030 class XSNamespaceItem; 00031 00039 class XMLPARSER_EXPORT XSTypeDefinition : public XSObject 00040 { 00041 public: 00042 00043 enum TYPE_CATEGORY { 00047 COMPLEX_TYPE = 15, 00051 SIMPLE_TYPE = 16 00052 }; 00053 00054 // Constructors and Destructor 00055 // ----------------------------------------------------------------------- 00058 00067 XSTypeDefinition 00068 ( 00069 TYPE_CATEGORY typeCategory 00070 , XSTypeDefinition* const xsBaseType 00071 , XSModel* const xsModel 00072 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 00073 ); 00074 00076 00079 virtual ~XSTypeDefinition(); 00081 00082 //--------------------- 00085 00090 virtual const XMLCh* getName() const = 0; 00091 00096 virtual const XMLCh* getNamespace() = 0; 00097 00103 virtual XSNamespaceItem *getNamespaceItem() = 0; 00104 00106 00107 //--------------------- 00111 00115 TYPE_CATEGORY getTypeCategory() const; 00116 00121 virtual XSTypeDefinition *getBaseType() = 0; 00122 00131 bool isFinal(short toTest); 00132 00143 short getFinal() const; 00144 00149 virtual bool getAnonymous() const = 0; 00150 00158 virtual bool derivedFromType(const XSTypeDefinition* const ancestorType) = 0; 00159 00168 bool derivedFrom(const XMLCh* typeNamespace, 00169 const XMLCh* name); 00170 00172 00173 //---------------------------------- 00177 00179 private: 00180 00181 // ----------------------------------------------------------------------- 00182 // Unimplemented constructors and operators 00183 // ----------------------------------------------------------------------- 00184 XSTypeDefinition(const XSTypeDefinition&); 00185 XSTypeDefinition & operator=(const XSTypeDefinition &); 00186 00187 protected: 00188 00189 // ----------------------------------------------------------------------- 00190 // data members 00191 // ----------------------------------------------------------------------- 00192 // fTypeCategory 00193 // whether this is a simpleType or complexType 00194 // fFinal 00195 // the final properties which is set by the derived class. 00196 TYPE_CATEGORY fTypeCategory; 00197 short fFinal; 00198 XSTypeDefinition* fBaseType; // owned by XSModel 00199 }; 00200 00201 inline XSTypeDefinition::TYPE_CATEGORY XSTypeDefinition::getTypeCategory() const 00202 { 00203 return fTypeCategory; 00204 } 00205 00206 inline short XSTypeDefinition::getFinal() const 00207 { 00208 return fFinal; 00209 } 00210 00211 00212 XERCES_CPP_NAMESPACE_END 00213 00214 #endif