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_PSVIATTRIBUTE_HPP) 00023 #define XERCESC_INCLUDE_GUARD_PSVIATTRIBUTE_HPP 00024 00025 #include <xercesc/framework/psvi/PSVIItem.hpp> 00026 #include <xercesc/framework/psvi/XSSimpleTypeDefinition.hpp> 00027 #include <xercesc/validators/datatype/DatatypeValidator.hpp> 00028 00029 XERCES_CPP_NAMESPACE_BEGIN 00030 00038 // forward declarations 00039 class XSAttributeDeclaration; 00040 00041 class XMLPARSER_EXPORT PSVIAttribute : public PSVIItem 00042 { 00043 public: 00044 00045 // Constructors and Destructor 00046 // ----------------------------------------------------------------------- 00049 00055 PSVIAttribute( MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); 00056 00058 00061 ~PSVIAttribute(); 00063 00064 //--------------------- 00068 00075 XSAttributeDeclaration *getAttributeDeclaration(); 00076 00082 XSTypeDefinition *getTypeDefinition(); 00083 00093 XSSimpleTypeDefinition *getMemberTypeDefinition(); 00094 00096 00097 //---------------------------------- 00101 00106 void reset( 00107 const XMLCh * const valContext 00108 , PSVIItem::VALIDITY_STATE state 00109 , PSVIItem::ASSESSMENT_TYPE assessmentType 00110 , XSSimpleTypeDefinition * validatingType 00111 , XSSimpleTypeDefinition * memberType 00112 , const XMLCh * const defaultValue 00113 , const bool isSpecified 00114 , XSAttributeDeclaration * attrDecl 00115 , DatatypeValidator * dv 00116 ); 00117 00123 void setValue(const XMLCh * const normalizedValue); 00124 00129 void updateValidity(VALIDITY_STATE newValue); 00130 00132 00133 private: 00134 00135 // ----------------------------------------------------------------------- 00136 // Unimplemented constructors and operators 00137 // ----------------------------------------------------------------------- 00138 PSVIAttribute(const PSVIAttribute&); 00139 PSVIAttribute & operator=(const PSVIAttribute &); 00140 00141 00142 // ----------------------------------------------------------------------- 00143 // data members 00144 // ----------------------------------------------------------------------- 00145 // fAttributeDecl 00146 // attribute declaration component that validated this attribute 00147 // fDV 00148 // implementation-specific datatype validator used to validate this attribute 00149 XSAttributeDeclaration * fAttributeDecl; 00150 DatatypeValidator * fDV; 00151 }; 00152 inline PSVIAttribute::~PSVIAttribute() 00153 { 00154 fMemoryManager->deallocate((void *)fCanonicalValue); 00155 } 00156 00157 inline XSAttributeDeclaration *PSVIAttribute::getAttributeDeclaration() 00158 { 00159 return fAttributeDecl; 00160 } 00161 00162 inline XSTypeDefinition* PSVIAttribute::getTypeDefinition() 00163 { 00164 return fType; 00165 } 00166 00167 inline XSSimpleTypeDefinition* PSVIAttribute::getMemberTypeDefinition() 00168 { 00169 return fMemberType; 00170 } 00171 00172 inline void PSVIAttribute::updateValidity(VALIDITY_STATE newValue) 00173 { 00174 fValidityState = newValue; 00175 } 00176 00177 XERCES_CPP_NAMESPACE_END 00178 00179 #endif