|
||||
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_XSCOMPLEXTYPEDEFINITION_HPP) 0023 #define XERCESC_INCLUDE_GUARD_XSCOMPLEXTYPEDEFINITION_HPP 0024 0025 #include <xercesc/framework/psvi/XSTypeDefinition.hpp> 0026 0027 XERCES_CPP_NAMESPACE_BEGIN 0028 0029 /** 0030 * This class represents a complexType definition 0031 * schema component. 0032 * This is *always* owned by the validator /parser object from which 0033 * it is obtained. 0034 * 0035 */ 0036 0037 // forward declarations 0038 class XSAnnotation; 0039 class XSAttributeUse; 0040 class XSSimpleTypeDefinition; 0041 class XSParticle; 0042 class XSWildcard; 0043 class ComplexTypeInfo; 0044 0045 class XMLPARSER_EXPORT XSComplexTypeDefinition : public XSTypeDefinition 0046 { 0047 public: 0048 0049 // Content Model Types 0050 enum CONTENT_TYPE { 0051 /** 0052 * Represents an empty content type. A content type with the distinguished 0053 * value empty validates elements with no character or element 0054 * information item children. 0055 */ 0056 CONTENTTYPE_EMPTY = 0, 0057 /** 0058 * Represents a simple content type. A content type which is a simple 0059 * validates elements with character-only children. 0060 */ 0061 CONTENTTYPE_SIMPLE = 1, 0062 /** 0063 * Represents an element-only content type. An element-only content type 0064 * validates elements with children that conform to the supplied content 0065 * model. 0066 */ 0067 CONTENTTYPE_ELEMENT = 2, 0068 /** 0069 * Represents a mixed content type. 0070 */ 0071 CONTENTTYPE_MIXED = 3 0072 }; 0073 0074 // Constructors and Destructor 0075 // ----------------------------------------------------------------------- 0076 /** @name Constructors */ 0077 //@{ 0078 0079 /** 0080 * The default constructor 0081 * 0082 * @param complexTypeInfo 0083 * @param xsWildcard 0084 * @param xsSimpleType 0085 * @param xsAttList 0086 * @param xsBaseType 0087 * @param xsParticle 0088 * @param headAnnot 0089 * @param xsModel 0090 * @param manager The configurable memory manager 0091 */ 0092 XSComplexTypeDefinition 0093 ( 0094 ComplexTypeInfo* const complexTypeInfo 0095 , XSWildcard* const xsWildcard 0096 , XSSimpleTypeDefinition* const xsSimpleType 0097 , XSAttributeUseList* const xsAttList 0098 , XSTypeDefinition* const xsBaseType 0099 , XSParticle* const xsParticle 0100 , XSAnnotation* const headAnnot 0101 , XSModel* const xsModel 0102 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 0103 ); 0104 0105 //@}; 0106 0107 /** @name Destructor */ 0108 //@{ 0109 ~XSComplexTypeDefinition(); 0110 //@} 0111 0112 //--------------------- 0113 /** @name XSComplexTypeDefinition methods */ 0114 0115 //@{ 0116 0117 /** 0118 * [derivation method]: either <code>DERIVATION_EXTENSION</code>, 0119 * <code>DERIVATION_RESTRICTION</code>, or <code>DERIVATION_NONE</code> 0120 * (see <code>XSObject</code>). 0121 */ 0122 XSConstants::DERIVATION_TYPE getDerivationMethod() const; 0123 0124 /** 0125 * [abstract]: a boolean. Complex types for which <code>abstract</code> is 0126 * true must not be used as the type definition for the validation of 0127 * element information items. 0128 */ 0129 bool getAbstract() const; 0130 0131 /** 0132 * A set of attribute uses. 0133 */ 0134 XSAttributeUseList *getAttributeUses(); 0135 0136 /** 0137 * Optional.An attribute wildcard. 0138 */ 0139 XSWildcard *getAttributeWildcard() const; 0140 0141 /** 0142 * [content type]: one of empty (<code>CONTENTTYPE_EMPTY</code>), a simple 0143 * type definition (<code>CONTENTTYPE_SIMPLE</code>), mixed ( 0144 * <code>CONTENTTYPE_MIXED</code>), or element-only ( 0145 * <code>CONTENTTYPE_ELEMENT</code>). 0146 */ 0147 CONTENT_TYPE getContentType() const; 0148 0149 /** 0150 * A simple type definition corresponding to simple content model, 0151 * otherwise <code>null</code> 0152 */ 0153 XSSimpleTypeDefinition *getSimpleType() const; 0154 0155 /** 0156 * A particle for mixed or element-only content model, otherwise 0157 * <code>null</code> 0158 */ 0159 XSParticle *getParticle() const; 0160 0161 /** 0162 * [prohibited substitutions]: a subset of {extension, restriction} 0163 * @param toTest Extension or restriction constants (see 0164 * <code>XSObject</code>). 0165 * @return True if toTest is a prohibited substitution, otherwise 0166 * false. 0167 */ 0168 bool isProhibitedSubstitution(XSConstants::DERIVATION_TYPE toTest); 0169 0170 /** 0171 * [prohibited substitutions]: A subset of {extension, restriction} or 0172 * <code>DERIVATION_NONE</code> represented as a bit flag (see 0173 * <code>XSObject</code>). 0174 */ 0175 short getProhibitedSubstitutions() const; 0176 0177 /** 0178 * A set of [annotations]. 0179 */ 0180 XSAnnotationList *getAnnotations(); 0181 0182 /** 0183 * The name of type <code>NCName</code> of this declaration as defined in 0184 * XML Namespaces. 0185 */ 0186 const XMLCh* getName() const; 0187 0188 /** 0189 * The [target namespace] of this object, or <code>null</code> if it is 0190 * unspecified. 0191 */ 0192 const XMLCh* getNamespace() const; 0193 0194 /** 0195 * A namespace schema information item corresponding to the target 0196 * namespace of the component, if it's globally declared; or null 0197 * otherwise. 0198 */ 0199 XSNamespaceItem *getNamespaceItem(); 0200 0201 /** 0202 * A boolean that specifies if the type definition is 0203 * anonymous. Convenience attribute. 0204 */ 0205 bool getAnonymous() const; 0206 0207 /** 0208 * {base type definition}: either a simple type definition or a complex 0209 * type definition. 0210 */ 0211 XSTypeDefinition *getBaseType(); 0212 0213 /** 0214 * Convenience method: check if this type is derived from the given 0215 * <code>ancestorType</code>. 0216 * @param ancestorType An ancestor type definition. 0217 * @return Return true if this type is derived from 0218 * <code>ancestorType</code>. 0219 */ 0220 bool derivedFromType(const XSTypeDefinition* const ancestorType); 0221 0222 //@} 0223 0224 //---------------------------------- 0225 /** methods needed by implementation */ 0226 0227 //@{ 0228 0229 0230 //@} 0231 0232 private: 0233 0234 /** 0235 * Set the base type 0236 */ 0237 void setBaseType(XSTypeDefinition* const xsBaseType); 0238 friend class XSObjectFactory; 0239 0240 // ----------------------------------------------------------------------- 0241 // Unimplemented constructors and operators 0242 // ----------------------------------------------------------------------- 0243 XSComplexTypeDefinition(const XSComplexTypeDefinition&); 0244 XSComplexTypeDefinition & operator=(const XSComplexTypeDefinition &); 0245 0246 protected: 0247 0248 // ----------------------------------------------------------------------- 0249 // data members 0250 // ----------------------------------------------------------------------- 0251 ComplexTypeInfo* fComplexTypeInfo; 0252 XSWildcard* fXSWildcard; 0253 XSAttributeUseList* fXSAttributeUseList; 0254 XSSimpleTypeDefinition* fXSSimpleTypeDefinition; 0255 XSAnnotationList* fXSAnnotationList; 0256 XSParticle* fParticle; 0257 short fProhibitedSubstitution; 0258 }; 0259 0260 0261 inline XSAttributeUseList* XSComplexTypeDefinition::getAttributeUses() 0262 { 0263 return fXSAttributeUseList; 0264 } 0265 0266 inline XSWildcard* XSComplexTypeDefinition::getAttributeWildcard() const 0267 { 0268 return fXSWildcard; 0269 } 0270 0271 inline XSSimpleTypeDefinition* XSComplexTypeDefinition::getSimpleType() const 0272 { 0273 return fXSSimpleTypeDefinition; 0274 } 0275 0276 inline short XSComplexTypeDefinition::getProhibitedSubstitutions() const 0277 { 0278 return fProhibitedSubstitution; 0279 } 0280 0281 inline XSParticle *XSComplexTypeDefinition::getParticle() const 0282 { 0283 return fParticle; 0284 } 0285 0286 inline void 0287 XSComplexTypeDefinition::setBaseType(XSTypeDefinition* const xsBaseType) 0288 { 0289 fBaseType = xsBaseType; 0290 } 0291 0292 XERCES_CPP_NAMESPACE_END 0293 0294 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |