PSVIItem.hpp

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: PSVIItem.hpp 568078 2007-08-21 11:43:25Z amassari $
00020  */
00021 
00022 #if !defined(PSVIITEM_HPP)
00023 #define PSVIITEM_HPP
00024 
00025 #include <xercesc/util/PlatformUtils.hpp>
00026 
00027 XERCES_CPP_NAMESPACE_BEGIN
00028 
00036 // forward declarations
00037 class XSTypeDefinition; 
00038 class XSSimpleTypeDefinition;
00039 class XSValue;
00040 
00041 class XMLPARSER_EXPORT PSVIItem : public XMemory
00042 {
00043 public:
00044 
00045     enum VALIDITY_STATE {
00050         VALIDITY_NOTKNOWN               = 0,
00051     
00056         VALIDITY_INVALID               = 1,
00057     
00062         VALIDITY_VALID                 = 2
00063     };
00064 
00065     enum ASSESSMENT_TYPE {
00069         VALIDATION_NONE                = 0,
00070     
00074         VALIDATION_PARTIAL             = 1,
00075     
00078         VALIDATION_FULL                = 2
00079     };
00080 
00081     //  Constructors and Destructor
00082     // -----------------------------------------------------------------------
00085 
00091     PSVIItem(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00092 
00094 
00097     virtual ~PSVIItem();
00099 
00100     //---------------------
00104 
00114     const XMLCh *getValidationContext();
00115 
00123     VALIDITY_STATE getValidity() const;
00124 
00131     ASSESSMENT_TYPE getValidationAttempted() const;
00132 
00139     /***
00140     const XMLCh ** getErrorCodes();
00141     ****/
00142     
00149     const XMLCh *getSchemaNormalizedValue();
00150 
00156     virtual XSTypeDefinition *getTypeDefinition() = 0;
00157     
00167     virtual XSSimpleTypeDefinition *getMemberTypeDefinition() = 0;
00168     
00175     const XMLCh *getSchemaDefault();
00176 
00182     bool getIsSchemaSpecified() const;
00183 
00191     const XMLCh *getCanonicalRepresentation() const;
00192 
00194 
00202     virtual XSValue *getActualValue() const;
00203 
00204     //----------------------------------
00208 
00209     void setValidationAttempted(PSVIItem::ASSESSMENT_TYPE attemptType);
00210     void setValidity(PSVIItem::VALIDITY_STATE validity);
00211 
00218     void reset(
00219             const XMLCh* const validationContext
00220             , const XMLCh* const normalizedValue
00221             , const VALIDITY_STATE validityState
00222             , const ASSESSMENT_TYPE assessmentType
00223         );
00225 private:
00226 
00227     // -----------------------------------------------------------------------
00228     //  Unimplemented constructors and operators
00229     // -----------------------------------------------------------------------
00230     PSVIItem(const PSVIItem&);
00231     PSVIItem & operator=(const PSVIItem &);
00232 
00233 
00234 protected:
00235     // -----------------------------------------------------------------------
00236     //  data members
00237     // -----------------------------------------------------------------------
00238     // fMemoryManager:
00239     //  used for any memory allocations
00240     // fValidationContext
00241     //  corresponds to the schema [validation context] property
00242     // fNormalizedValue
00243     //  The schema normalized value (when present)
00244     // fDefaultValue
00245     //  default value specified in the schema, if any
00246     // fCanonicalValue
00247     //  canonicalized version of normalizedValue
00248     // fValidityState
00249     //  Whether this item is valid or not
00250     // fAssessmentType
00251     //  The kind of assessment that produced the given validity outcome
00252     // fIsSpecified
00253     //  Whether this item exists because a default was specified in the schema
00254     // fType
00255     //  type responsible for validating this item
00256     // fMemberType
00257     //  If fType is a union type, the member type that validated this item
00258     MemoryManager* const        fMemoryManager;
00259     const XMLCh*                fValidationContext;
00260     const XMLCh*                fNormalizedValue;
00261     const XMLCh*                fDefaultValue;
00262     XMLCh*                      fCanonicalValue;
00263     VALIDITY_STATE              fValidityState;
00264     ASSESSMENT_TYPE             fAssessmentType;
00265     bool                        fIsSpecified;
00266     XSTypeDefinition *          fType;
00267     XSSimpleTypeDefinition*     fMemberType;
00268 };
00269 
00270 inline PSVIItem::~PSVIItem() {}
00271 
00272 inline const XMLCh *PSVIItem::getValidationContext() 
00273 {
00274     return fValidationContext;
00275 }
00276 
00277 inline const XMLCh* PSVIItem::getSchemaNormalizedValue() 
00278 {
00279     return fNormalizedValue;
00280 }
00281 
00282 inline const XMLCh* PSVIItem::getSchemaDefault() 
00283 {
00284     return fDefaultValue;
00285 }
00286 
00287 inline const XMLCh* PSVIItem::getCanonicalRepresentation() const
00288 {
00289     return fCanonicalValue;
00290 }
00291 
00292 inline PSVIItem::VALIDITY_STATE PSVIItem::getValidity() const
00293 {
00294     return fValidityState;
00295 }
00296 
00297 inline bool PSVIItem::getIsSchemaSpecified() const
00298 {
00299     return fIsSpecified;
00300 }
00301 
00302 inline PSVIItem::ASSESSMENT_TYPE PSVIItem::getValidationAttempted() const
00303 {
00304     return fAssessmentType;
00305 }
00306 
00307 XERCES_CPP_NAMESPACE_END
00308 
00309 #endif

Generated on Thu Feb 19 11:35:43 2009 for Xerces-C++ by  doxygen 1.5.4