http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Readme
Release Info

Installation
Download
Build

FAQs
Samples
API Docs

DOM C++ Binding
Programming
Migration Guide

Feedback
Bug-Reporting
PDF Document

CVS Repository
Mail Archive

API Docs for SAX and DOM
 

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

PSVIItem.hpp

Go to the documentation of this file.
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: PSVIItem.hpp,v $
00019  * Revision 1.10  2004/09/13 21:22:42  peiyongz
00020  * new method: getActualValue()
00021  *
00022  * Revision 1.9  2004/09/08 13:56:07  peiyongz
00023  * Apache License Version 2.0
00024  *
00025  * Revision 1.8  2003/11/28 21:18:31  knoaman
00026  * Make use of canonical representation in PSVIElement
00027  *
00028  * Revision 1.7  2003/11/27 17:58:59  neilg
00029  * fix compilation error
00030  *
00031  * Revision 1.6  2003/11/27 16:44:59  neilg
00032  * implement isSpecified; thanks to Pete Lloyd
00033  *
00034  * Revision 1.5  2003/11/27 06:10:32  neilg
00035  * PSVIAttribute implementation
00036  *
00037  * Revision 1.4  2003/11/25 16:14:28  neilg
00038  * move inlines into PSVIItem.hpp
00039  *
00040  * Revision 1.3  2003/11/21 22:34:45  neilg
00041  * More schema component model implementation, thanks to David Cargill.
00042  * In particular, this cleans up and completes the XSModel, XSNamespaceItem,
00043  * XSAttributeDeclaration and XSAttributeGroup implementations.
00044  *
00045  * Revision 1.2  2003/11/06 15:30:04  neilg
00046  * 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.
00047  *
00048  * Revision 1.1  2003/09/16 14:33:36  neilg
00049  * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them
00050  *
00051  */
00052 
00053 #if !defined(PSVIITEM_HPP)
00054 #define PSVIITEM_HPP
00055 
00056 #include <xercesc/util/PlatformUtils.hpp>
00057 
00058 XERCES_CPP_NAMESPACE_BEGIN
00059 
00067 // forward declarations
00068 class XSTypeDefinition; 
00069 class XSSimpleTypeDefinition;
00070 class XSValue;
00071 
00072 class  PSVIItem : public XMemory
00073 {
00074 public:
00075 
00076     enum VALIDITY_STATE {
00081         VALIDITY_NOTKNOWN               = 0,
00082     
00087         VALIDITY_INVALID               = 1,
00088     
00093         VALIDITY_VALID                 = 2
00094     };
00095 
00096     enum ASSESSMENT_TYPE {
00100         VALIDATION_NONE                = 0,
00101     
00105         VALIDATION_PARTIAL             = 1,
00106     
00109         VALIDATION_FULL                = 2
00110     };
00111 
00112     //  Constructors and Destructor
00113     // -----------------------------------------------------------------------
00116 
00122     PSVIItem(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00123 
00125 
00128     virtual ~PSVIItem();
00130 
00131     //---------------------
00135 
00145     const XMLCh *getValidationContext();
00146 
00154     VALIDITY_STATE getValidity() const;
00155 
00162     ASSESSMENT_TYPE getValidationAttempted() const;
00163 
00170     /***
00171     const XMLCh ** getErrorCodes();
00172     ****/
00173     
00180     const XMLCh *getSchemaNormalizedValue();
00181 
00187     virtual XSTypeDefinition *getTypeDefinition() = 0;
00188     
00198     virtual XSSimpleTypeDefinition *getMemberTypeDefinition() = 0;
00199     
00206     const XMLCh *getSchemaDefault();
00207 
00213     bool getIsSchemaSpecified() const;
00214 
00222     const XMLCh *getCanonicalRepresentation() const;
00223 
00225 
00233     virtual XSValue *getActualValue() const;
00234 
00235     //----------------------------------
00239 
00240     void setValidationAttempted(PSVIItem::ASSESSMENT_TYPE attemptType);
00241     void setValidity(PSVIItem::VALIDITY_STATE validity);
00242 
00249     void reset(
00250             const XMLCh* const validationContext
00251             , const XMLCh* const normalizedValue
00252             , const VALIDITY_STATE validityState
00253             , const ASSESSMENT_TYPE assessmentType
00254         );
00256 private:
00257 
00258     // -----------------------------------------------------------------------
00259     //  Unimplemented constructors and operators
00260     // -----------------------------------------------------------------------
00261     PSVIItem(const PSVIItem&);
00262     PSVIItem & operator=(const PSVIItem &);
00263 
00264 
00265 protected:
00266     // -----------------------------------------------------------------------
00267     //  data members
00268     // -----------------------------------------------------------------------
00269     // fMemoryManager:
00270     //  used for any memory allocations
00271     // fValidationContext
00272     //  corresponds to the schema [validation context] property
00273     // fNormalizedValue
00274     //  The schema normalized value (when present)
00275     // fDefaultValue
00276     //  default value specified in the schema, if any
00277     // fCanonicalValue
00278     //  canonicalized version of normalizedValue
00279     // fValidityState
00280     //  Whether this item is valid or not
00281     // fAssessmentType
00282     //  The kind of assessment that produced the given validity outcome
00283     // fIsSpecified
00284     //  Whether this item exists because a default was specified in the schema
00285     // fType
00286     //  type responsible for validating this item
00287     // fMemberType
00288     //  If fType is a union type, the member type that validated this item
00289     MemoryManager* const        fMemoryManager;
00290     const XMLCh*                fValidationContext;
00291     const XMLCh*                fNormalizedValue;
00292     const XMLCh*                fDefaultValue;
00293     XMLCh*                      fCanonicalValue;
00294     VALIDITY_STATE              fValidityState;
00295     ASSESSMENT_TYPE             fAssessmentType;
00296     bool                        fIsSpecified;
00297     XSTypeDefinition *          fType;
00298     XSSimpleTypeDefinition*     fMemberType;
00299 };
00300 
00301 inline PSVIItem::~PSVIItem() {}
00302 
00303 inline const XMLCh *PSVIItem::getValidationContext() 
00304 {
00305     return fValidationContext;
00306 }
00307 
00308 inline const XMLCh* PSVIItem::getSchemaNormalizedValue() 
00309 {
00310     return fNormalizedValue;
00311 }
00312 
00313 inline const XMLCh* PSVIItem::getSchemaDefault() 
00314 {
00315     return fDefaultValue;
00316 }
00317 
00318 inline const XMLCh* PSVIItem::getCanonicalRepresentation() const
00319 {
00320     return fCanonicalValue;
00321 }
00322 
00323 inline PSVIItem::VALIDITY_STATE PSVIItem::getValidity() const
00324 {
00325     return fValidityState;
00326 }
00327 
00328 inline bool PSVIItem::getIsSchemaSpecified() const
00329 {
00330     return fIsSpecified;
00331 }
00332 
00333 inline PSVIItem::ASSESSMENT_TYPE PSVIItem::getValidationAttempted() const
00334 {
00335     return fAssessmentType;
00336 }
00337 
00338 XERCES_CPP_NAMESPACE_END
00339 
00340 #endif


Copyright © 1994-2004 The Apache Software Foundation. All Rights Reserved.