GME  13
PSVIAttribute.cpp
Go to the documentation of this file.
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: PSVIAttribute.cpp 471747 2006-11-06 14:31:56Z amassari $
00020  */
00021 
00022 #include <xercesc/framework/psvi/PSVIAttribute.hpp>
00023 
00024 XERCES_CPP_NAMESPACE_BEGIN
00025 
00026 PSVIAttribute::PSVIAttribute( MemoryManager* const manager ):  
00027         PSVIItem(manager)
00028         , fAttributeDecl(0)
00029         , fDV(0)
00030 {
00031 }
00032 
00033 void PSVIAttribute::reset(
00034             const XMLCh * const         valContext
00035             , PSVIItem::VALIDITY_STATE  state
00036             , PSVIItem::ASSESSMENT_TYPE assessmentType
00037             , XSSimpleTypeDefinition *  validatingType
00038             , XSSimpleTypeDefinition *  memberType
00039             , const XMLCh * const       defaultValue
00040             , const bool                isSpecified
00041             , XSAttributeDeclaration *  attrDecl
00042             , DatatypeValidator *dv
00043         )
00044 {
00045     fValidationContext = valContext;
00046     fValidityState = state;
00047     fAssessmentType = assessmentType;
00048     fType = validatingType;
00049     fMemberType = memberType;
00050     fDefaultValue = defaultValue;
00051     fIsSpecified = isSpecified;
00052     fMemoryManager->deallocate((void *)fCanonicalValue);
00053     fCanonicalValue = 0;
00054     fNormalizedValue = 0;
00055     fAttributeDecl = attrDecl;
00056     fDV = dv;
00057 }
00058 
00059 void PSVIAttribute::setValue(const XMLCh * const       normalizedValue)
00060 { 
00061     if(normalizedValue)
00062     {
00063         fNormalizedValue = normalizedValue;
00064         if(fDV && fValidityState == PSVIItem::VALIDITY_VALID)
00065             fCanonicalValue = (XMLCh *)fDV->getCanonicalRepresentation(normalizedValue, fMemoryManager);
00066     }
00067 }
00068 
00069 XERCES_CPP_NAMESPACE_END
00070 
00071