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 * $Log: PSVIAttribute.hpp,v $ 00019 * Revision 1.7 2004/09/08 13:56:07 peiyongz 00020 * Apache License Version 2.0 00021 * 00022 * Revision 1.6 2003/12/30 05:58:56 neilg 00023 * allow schema normalized values to be associated with a PSVIAttribute after it is reset 00024 * 00025 * Revision 1.5 2003/11/28 20:20:54 neilg 00026 * make use of canonical representation in PSVIAttribute implementation 00027 * 00028 * Revision 1.4 2003/11/27 06:10:32 neilg 00029 * PSVIAttribute implementation 00030 * 00031 * Revision 1.3 2003/11/06 21:50:33 neilg 00032 * fix compilation errors under gcc 3.3. 00033 * 00034 * Revision 1.2 2003/11/06 15:30:04 neilg 00035 * first part of PSVI/schema component model implementation, thanks to David Cargill. This covers setting the PSVIHandler on parser objects, as well as implementing XSNotation, XSSimpleTypeDefinition, XSIDCDefinition, and most of XSWildcard, XSComplexTypeDefinition, XSElementDeclaration, XSAttributeDeclaration and XSAttributeUse. 00036 * 00037 * Revision 1.1 2003/09/16 14:33:36 neilg 00038 * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them 00039 * 00040 */ 00041 00042 #if !defined(PSVIATTRIBUTE_HPP) 00043 #define PSVIATTRIBUTE_HPP 00044 00045 #include <xercesc/framework/psvi/PSVIItem.hpp> 00046 #include <xercesc/framework/psvi/XSSimpleTypeDefinition.hpp> 00047 #include <xercesc/validators/datatype/DatatypeValidator.hpp> 00048 00049 XERCES_CPP_NAMESPACE_BEGIN 00050 00058 // forward declarations 00059 class XSAttributeDeclaration; 00060 00061 class PSVIAttribute : public PSVIItem 00062 { 00063 public: 00064 00065 // Constructors and Destructor 00066 // ----------------------------------------------------------------------- 00069 00075 PSVIAttribute( MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); 00076 00078 00081 ~PSVIAttribute(); 00083 00084 //--------------------- 00088 00095 XSAttributeDeclaration *getAttributeDeclaration(); 00096 00102 XSTypeDefinition *getTypeDefinition(); 00103 00113 XSSimpleTypeDefinition *getMemberTypeDefinition(); 00114 00116 00117 //---------------------------------- 00121 00126 void reset( 00127 const XMLCh * const valContext 00128 , PSVIItem::VALIDITY_STATE state 00129 , PSVIItem::ASSESSMENT_TYPE assessmentType 00130 , XSSimpleTypeDefinition * validatingType 00131 , XSSimpleTypeDefinition * memberType 00132 , const XMLCh * const defaultValue 00133 , const bool isSpecified 00134 , XSAttributeDeclaration * attrDecl 00135 , DatatypeValidator * dv 00136 ); 00137 00143 void setValue(const XMLCh * const normalizedValue); 00144 00149 void updateValidity(VALIDITY_STATE newValue); 00150 00152 00153 private: 00154 00155 // ----------------------------------------------------------------------- 00156 // Unimplemented constructors and operators 00157 // ----------------------------------------------------------------------- 00158 PSVIAttribute(const PSVIAttribute&); 00159 PSVIAttribute & operator=(const PSVIAttribute &); 00160 00161 00162 // ----------------------------------------------------------------------- 00163 // data members 00164 // ----------------------------------------------------------------------- 00165 // fAttributeDecl 00166 // attribute declaration component that validated this attribute 00167 // fDV 00168 // implementation-specific datatype validator used to validate this attribute 00169 XSAttributeDeclaration * fAttributeDecl; 00170 DatatypeValidator * fDV; 00171 }; 00172 inline PSVIAttribute::~PSVIAttribute() 00173 { 00174 fMemoryManager->deallocate((void *)fCanonicalValue); 00175 } 00176 00177 inline XSAttributeDeclaration *PSVIAttribute::getAttributeDeclaration() 00178 { 00179 return fAttributeDecl; 00180 } 00181 00182 inline XSTypeDefinition* PSVIAttribute::getTypeDefinition() 00183 { 00184 return fType; 00185 } 00186 00187 inline XSSimpleTypeDefinition* PSVIAttribute::getMemberTypeDefinition() 00188 { 00189 return fMemberType; 00190 } 00191 00192 inline void PSVIAttribute::updateValidity(VALIDITY_STATE newValue) 00193 { 00194 fValidityState = newValue; 00195 } 00196 00197 XERCES_CPP_NAMESPACE_END 00198 00199 #endif