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 * $Id: PSVIAttribute.hpp 191054 2005-06-17 02:56:35Z jberry $ 00019 */ 00020 00021 #if !defined(PSVIATTRIBUTE_HPP) 00022 #define PSVIATTRIBUTE_HPP 00023 00024 #include <xercesc/framework/psvi/PSVIItem.hpp> 00025 #include <xercesc/framework/psvi/XSSimpleTypeDefinition.hpp> 00026 #include <xercesc/validators/datatype/DatatypeValidator.hpp> 00027 00028 XERCES_CPP_NAMESPACE_BEGIN 00029 00037 // forward declarations 00038 class XSAttributeDeclaration; 00039 00040 class PSVIAttribute : public PSVIItem 00041 { 00042 public: 00043 00044 // Constructors and Destructor 00045 // ----------------------------------------------------------------------- 00048 00054 PSVIAttribute( MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); 00055 00057 00060 ~PSVIAttribute(); 00062 00063 //--------------------- 00067 00074 XSAttributeDeclaration *getAttributeDeclaration(); 00075 00081 XSTypeDefinition *getTypeDefinition(); 00082 00092 XSSimpleTypeDefinition *getMemberTypeDefinition(); 00093 00095 00096 //---------------------------------- 00100 00105 void reset( 00106 const XMLCh * const valContext 00107 , PSVIItem::VALIDITY_STATE state 00108 , PSVIItem::ASSESSMENT_TYPE assessmentType 00109 , XSSimpleTypeDefinition * validatingType 00110 , XSSimpleTypeDefinition * memberType 00111 , const XMLCh * const defaultValue 00112 , const bool isSpecified 00113 , XSAttributeDeclaration * attrDecl 00114 , DatatypeValidator * dv 00115 ); 00116 00122 void setValue(const XMLCh * const normalizedValue); 00123 00128 void updateValidity(VALIDITY_STATE newValue); 00129 00131 00132 private: 00133 00134 // ----------------------------------------------------------------------- 00135 // Unimplemented constructors and operators 00136 // ----------------------------------------------------------------------- 00137 PSVIAttribute(const PSVIAttribute&); 00138 PSVIAttribute & operator=(const PSVIAttribute &); 00139 00140 00141 // ----------------------------------------------------------------------- 00142 // data members 00143 // ----------------------------------------------------------------------- 00144 // fAttributeDecl 00145 // attribute declaration component that validated this attribute 00146 // fDV 00147 // implementation-specific datatype validator used to validate this attribute 00148 XSAttributeDeclaration * fAttributeDecl; 00149 DatatypeValidator * fDV; 00150 }; 00151 inline PSVIAttribute::~PSVIAttribute() 00152 { 00153 fMemoryManager->deallocate((void *)fCanonicalValue); 00154 } 00155 00156 inline XSAttributeDeclaration *PSVIAttribute::getAttributeDeclaration() 00157 { 00158 return fAttributeDecl; 00159 } 00160 00161 inline XSTypeDefinition* PSVIAttribute::getTypeDefinition() 00162 { 00163 return fType; 00164 } 00165 00166 inline XSSimpleTypeDefinition* PSVIAttribute::getMemberTypeDefinition() 00167 { 00168 return fMemberType; 00169 } 00170 00171 inline void PSVIAttribute::updateValidity(VALIDITY_STATE newValue) 00172 { 00173 fValidityState = newValue; 00174 } 00175 00176 XERCES_CPP_NAMESPACE_END 00177 00178 #endif