|
||||
File indexing completed on 2025-01-18 10:14:52
0001 /* 0002 * Licensed to the Apache Software Foundation (ASF) under one or more 0003 * contributor license agreements. See the NOTICE file distributed with 0004 * this work for additional information regarding copyright ownership. 0005 * The ASF licenses this file to You under the Apache License, Version 2.0 0006 * (the "License"); you may not use this file except in compliance with 0007 * the License. You may obtain a copy of the License at 0008 * 0009 * http://www.apache.org/licenses/LICENSE-2.0 0010 * 0011 * Unless required by applicable law or agreed to in writing, software 0012 * distributed under the License is distributed on an "AS IS" BASIS, 0013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0014 * See the License for the specific language governing permissions and 0015 * limitations under the License. 0016 */ 0017 0018 /* 0019 * $Id$ 0020 */ 0021 0022 #if !defined(XERCESC_INCLUDE_GUARD_XSTYPEDEFINITION_HPP) 0023 #define XERCESC_INCLUDE_GUARD_XSTYPEDEFINITION_HPP 0024 0025 #include <xercesc/framework/psvi/XSObject.hpp> 0026 0027 XERCES_CPP_NAMESPACE_BEGIN 0028 0029 // forward declarations 0030 class XSNamespaceItem; 0031 0032 /** 0033 * This class represents a complexType or simpleType definition. 0034 * This is *always* owned by the validator /parser object from which 0035 * it is obtained. 0036 * 0037 */ 0038 0039 class XMLPARSER_EXPORT XSTypeDefinition : public XSObject 0040 { 0041 public: 0042 0043 enum TYPE_CATEGORY { 0044 /** 0045 * This constant value signifies a complex type. 0046 */ 0047 COMPLEX_TYPE = 15, 0048 /** 0049 * This constant value signifies a simple type. 0050 */ 0051 SIMPLE_TYPE = 16 0052 }; 0053 0054 // Constructors and Destructor 0055 // ----------------------------------------------------------------------- 0056 /** @name Constructors */ 0057 //@{ 0058 0059 /** 0060 * The default constructor 0061 * 0062 * @param typeCategory 0063 * @param xsBaseType 0064 * @param xsModel 0065 * @param manager The configurable memory manager 0066 */ 0067 XSTypeDefinition 0068 ( 0069 TYPE_CATEGORY typeCategory 0070 , XSTypeDefinition* const xsBaseType 0071 , XSModel* const xsModel 0072 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 0073 ); 0074 0075 //@}; 0076 0077 /** @name Destructor */ 0078 //@{ 0079 virtual ~XSTypeDefinition(); 0080 //@} 0081 0082 //--------------------- 0083 /** @name overloaded XSObject methods */ 0084 //@{ 0085 0086 /** 0087 * The name of type <code>NCName</code> of this declaration as defined in 0088 * XML Namespaces. 0089 */ 0090 virtual const XMLCh* getName() const = 0; 0091 0092 /** 0093 * The [target namespace] of this object, or <code>null</code> if it is 0094 * unspecified. 0095 */ 0096 virtual const XMLCh* getNamespace() const = 0; 0097 0098 /** 0099 * A namespace schema information item corresponding to the target 0100 * namespace of the component, if it's globally declared; or null 0101 * otherwise. 0102 */ 0103 virtual XSNamespaceItem *getNamespaceItem() = 0; 0104 0105 //@} 0106 0107 //--------------------- 0108 /** @name XSTypeDefinition methods */ 0109 0110 //@{ 0111 0112 /** 0113 * Return whether this type definition is a simple type or complex type. 0114 */ 0115 TYPE_CATEGORY getTypeCategory() const; 0116 0117 /** 0118 * {base type definition}: either a simple type definition or a complex 0119 * type definition. 0120 */ 0121 virtual XSTypeDefinition *getBaseType() = 0; 0122 0123 /** 0124 * {final}. For complex type definition it is a subset of {extension, 0125 * restriction}. For simple type definition it is a subset of 0126 * {extension, list, restriction, union}. 0127 * @param toTest Extension, restriction, list, union constants 0128 * (defined in <code>XSObject</code>). 0129 * @return True if toTest is in the final set, otherwise false. 0130 */ 0131 bool isFinal(short toTest); 0132 0133 /** 0134 * For complex types the returned value is a bit combination of the subset 0135 * of {<code>DERIVATION_EXTENSION, DERIVATION_RESTRICTION</code>} 0136 * corresponding to <code>final</code> set of this type or 0137 * <code>DERIVATION_NONE</code>. For simple types the returned value is 0138 * a bit combination of the subset of { 0139 * <code>DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST</code> 0140 * } corresponding to <code>final</code> set of this type or 0141 * <code>DERIVATION_NONE</code>. 0142 */ 0143 short getFinal() const; 0144 0145 /** 0146 * A boolean that specifies if the type definition is 0147 * anonymous. Convenience attribute. 0148 */ 0149 virtual bool getAnonymous() const = 0; 0150 0151 /** 0152 * Convenience method: check if this type is derived from the given 0153 * <code>ancestorType</code>. 0154 * @param ancestorType An ancestor type definition. 0155 * @return Return true if this type is derived from 0156 * <code>ancestorType</code>. 0157 */ 0158 virtual bool derivedFromType(const XSTypeDefinition* const ancestorType) = 0; 0159 0160 /** 0161 * Convenience method: check if this type is derived from the given 0162 * ancestor type. 0163 * @param typeNamespace An ancestor type namespace. 0164 * @param name An ancestor type name. 0165 * @return Return true if this type is derived from 0166 * the ancestor defined by <code>typeNamespace</code> and <code>name</code>. 0167 */ 0168 bool derivedFrom(const XMLCh* typeNamespace, 0169 const XMLCh* name); 0170 0171 //@} 0172 0173 //---------------------------------- 0174 /** methods needed by implementation */ 0175 0176 //@{ 0177 0178 //@} 0179 private: 0180 0181 // ----------------------------------------------------------------------- 0182 // Unimplemented constructors and operators 0183 // ----------------------------------------------------------------------- 0184 XSTypeDefinition(const XSTypeDefinition&); 0185 XSTypeDefinition & operator=(const XSTypeDefinition &); 0186 0187 protected: 0188 0189 // ----------------------------------------------------------------------- 0190 // data members 0191 // ----------------------------------------------------------------------- 0192 // fTypeCategory 0193 // whether this is a simpleType or complexType 0194 // fFinal 0195 // the final properties which is set by the derived class. 0196 TYPE_CATEGORY fTypeCategory; 0197 short fFinal; 0198 XSTypeDefinition* fBaseType; // owned by XSModel 0199 }; 0200 0201 inline XSTypeDefinition::TYPE_CATEGORY XSTypeDefinition::getTypeCategory() const 0202 { 0203 return fTypeCategory; 0204 } 0205 0206 inline short XSTypeDefinition::getFinal() const 0207 { 0208 return fFinal; 0209 } 0210 0211 0212 XERCES_CPP_NAMESPACE_END 0213 0214 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |