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: PSVIItem.hpp 191054 2005-06-17 02:56:35Z jberry $ 00019 */ 00020 00021 #if !defined(PSVIITEM_HPP) 00022 #define PSVIITEM_HPP 00023 00024 #include <xercesc/util/PlatformUtils.hpp> 00025 00026 XERCES_CPP_NAMESPACE_BEGIN 00027 00035 // forward declarations 00036 class XSTypeDefinition; 00037 class XSSimpleTypeDefinition; 00038 class XSValue; 00039 00040 class PSVIItem : public XMemory 00041 { 00042 public: 00043 00044 enum VALIDITY_STATE { 00049 VALIDITY_NOTKNOWN = 0, 00050 00055 VALIDITY_INVALID = 1, 00056 00061 VALIDITY_VALID = 2 00062 }; 00063 00064 enum ASSESSMENT_TYPE { 00068 VALIDATION_NONE = 0, 00069 00073 VALIDATION_PARTIAL = 1, 00074 00077 VALIDATION_FULL = 2 00078 }; 00079 00080 // Constructors and Destructor 00081 // ----------------------------------------------------------------------- 00084 00090 PSVIItem(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); 00091 00093 00096 virtual ~PSVIItem(); 00098 00099 //--------------------- 00103 00113 const XMLCh *getValidationContext(); 00114 00122 VALIDITY_STATE getValidity() const; 00123 00130 ASSESSMENT_TYPE getValidationAttempted() const; 00131 00138 /*** 00139 const XMLCh ** getErrorCodes(); 00140 ****/ 00141 00148 const XMLCh *getSchemaNormalizedValue(); 00149 00155 virtual XSTypeDefinition *getTypeDefinition() = 0; 00156 00166 virtual XSSimpleTypeDefinition *getMemberTypeDefinition() = 0; 00167 00174 const XMLCh *getSchemaDefault(); 00175 00181 bool getIsSchemaSpecified() const; 00182 00190 const XMLCh *getCanonicalRepresentation() const; 00191 00193 00201 virtual XSValue *getActualValue() const; 00202 00203 //---------------------------------- 00207 00208 void setValidationAttempted(PSVIItem::ASSESSMENT_TYPE attemptType); 00209 void setValidity(PSVIItem::VALIDITY_STATE validity); 00210 00217 void reset( 00218 const XMLCh* const validationContext 00219 , const XMLCh* const normalizedValue 00220 , const VALIDITY_STATE validityState 00221 , const ASSESSMENT_TYPE assessmentType 00222 ); 00224 private: 00225 00226 // ----------------------------------------------------------------------- 00227 // Unimplemented constructors and operators 00228 // ----------------------------------------------------------------------- 00229 PSVIItem(const PSVIItem&); 00230 PSVIItem & operator=(const PSVIItem &); 00231 00232 00233 protected: 00234 // ----------------------------------------------------------------------- 00235 // data members 00236 // ----------------------------------------------------------------------- 00237 // fMemoryManager: 00238 // used for any memory allocations 00239 // fValidationContext 00240 // corresponds to the schema [validation context] property 00241 // fNormalizedValue 00242 // The schema normalized value (when present) 00243 // fDefaultValue 00244 // default value specified in the schema, if any 00245 // fCanonicalValue 00246 // canonicalized version of normalizedValue 00247 // fValidityState 00248 // Whether this item is valid or not 00249 // fAssessmentType 00250 // The kind of assessment that produced the given validity outcome 00251 // fIsSpecified 00252 // Whether this item exists because a default was specified in the schema 00253 // fType 00254 // type responsible for validating this item 00255 // fMemberType 00256 // If fType is a union type, the member type that validated this item 00257 MemoryManager* const fMemoryManager; 00258 const XMLCh* fValidationContext; 00259 const XMLCh* fNormalizedValue; 00260 const XMLCh* fDefaultValue; 00261 XMLCh* fCanonicalValue; 00262 VALIDITY_STATE fValidityState; 00263 ASSESSMENT_TYPE fAssessmentType; 00264 bool fIsSpecified; 00265 XSTypeDefinition * fType; 00266 XSSimpleTypeDefinition* fMemberType; 00267 }; 00268 00269 inline PSVIItem::~PSVIItem() {} 00270 00271 inline const XMLCh *PSVIItem::getValidationContext() 00272 { 00273 return fValidationContext; 00274 } 00275 00276 inline const XMLCh* PSVIItem::getSchemaNormalizedValue() 00277 { 00278 return fNormalizedValue; 00279 } 00280 00281 inline const XMLCh* PSVIItem::getSchemaDefault() 00282 { 00283 return fDefaultValue; 00284 } 00285 00286 inline const XMLCh* PSVIItem::getCanonicalRepresentation() const 00287 { 00288 return fCanonicalValue; 00289 } 00290 00291 inline PSVIItem::VALIDITY_STATE PSVIItem::getValidity() const 00292 { 00293 return fValidityState; 00294 } 00295 00296 inline bool PSVIItem::getIsSchemaSpecified() const 00297 { 00298 return fIsSpecified; 00299 } 00300 00301 inline PSVIItem::ASSESSMENT_TYPE PSVIItem::getValidationAttempted() const 00302 { 00303 return fAssessmentType; 00304 } 00305 00306 XERCES_CPP_NAMESPACE_END 00307 00308 #endif