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  

XSSimpleTypeDefinition.hpp

Go to the documentation of this file.
00001 /*
00002  * The Apache Software License, Version 1.1
00003  *
00004  * Copyright (c) 2003 The Apache Software Foundation.  All rights
00005  * reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  *
00014  * 2. Redistributions in binary form must reproduce the above copyright
00015  *    notice, this list of conditions and the following disclaimer in
00016  *    the documentation and/or other materials provided with the
00017  *    distribution.
00018  *
00019  * 3. The end-user documentation included with the redistribution,
00020  *    if any, must include the following acknowledgment:
00021  *       "This product includes software developed by the
00022  *        Apache Software Foundation (http://www.apache.org/)."
00023  *    Alternately, this acknowledgment may appear in the software itself,
00024  *    if and wherever such third-party acknowledgments normally appear.
00025  *
00026  * 4. The names "Xerces" and "Apache Software Foundation" must
00027  *    not be used to endorse or promote products derived from this
00028  *    software without prior written permission. For written
00029  *    permission, please contact apache\@apache.org.
00030  *
00031  * 5. Products derived from this software may not be called "Apache",
00032  *    nor may "Apache" appear in their name, without prior written
00033  *    permission of the Apache Software Foundation.
00034  *
00035  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
00036  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00037  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00038  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
00039  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00040  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00041  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
00042  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00043  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00044  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00045  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00046  * SUCH DAMAGE.
00047  * ====================================================================
00048  *
00049  * This software consists of voluntary contributions made by many
00050  * individuals on behalf of the Apache Software Foundation, and was
00051  * originally based on software copyright (c) 1999, International
00052  * Business Machines, Inc., http://www.ibm.com .  For more information
00053  * on the Apache Software Foundation, please see
00054  * <http://www.apache.org/>.
00055  */
00056 
00057 /*
00058  * $Log: XSSimpleTypeDefinition.hpp,v $
00059  * Revision 1.10  2003/12/24 17:42:02  knoaman
00060  * Misc. PSVI updates
00061  *
00062  * Revision 1.9  2003/12/01 23:23:26  neilg
00063  * fix for bug 25118; thanks to Jeroen Witmond
00064  *
00065  * Revision 1.8  2003/11/25 18:08:31  knoaman
00066  * Misc. PSVI updates. Thanks to David Cargill.
00067  *
00068  * Revision 1.7  2003/11/24 15:45:36  knoaman
00069  * PSVI: finish construction of XSSimpleTypeDefinition
00070  *
00071  * Revision 1.6  2003/11/21 17:34:04  knoaman
00072  * PSVI update
00073  *
00074  * Revision 1.5  2003/11/14 22:47:53  neilg
00075  * fix bogus log message from previous commit...
00076  *
00077  * Revision 1.4  2003/11/14 22:33:30  neilg
00078  * Second phase of schema component model implementation.  
00079  * Implement XSModel, XSNamespaceItem, and the plumbing necessary
00080  * to connect them to the other components.
00081  * Thanks to David Cargill.
00082  *
00083  * Revision 1.3  2003/11/06 21:50:33  neilg
00084  * fix compilation errors under gcc 3.3.
00085  *
00086  * Revision 1.2  2003/11/06 15:30:04  neilg
00087  * 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.
00088  *
00089  * Revision 1.1  2003/09/16 14:33:36  neilg
00090  * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them
00091  *
00092  */
00093 
00094 #if !defined(XSSIMPLETYPEDEFINITION_HPP)
00095 #define XSSIMPLETYPEDEFINITION_HPP
00096 
00097 #include <xercesc/framework/psvi/XSTypeDefinition.hpp>
00098 
00099 XERCES_CPP_NAMESPACE_BEGIN
00100 
00109 // forward declarations
00110 class XSAnnotation;
00111 class XSFacet;
00112 class XSMultiValueFacet;
00113 class DatatypeValidator;
00114 
00115 class  XSSimpleTypeDefinition : public XSTypeDefinition
00116 {
00117 public:
00118 
00119     // Variety definitions
00120     enum VARIETY {
00124         VARIETY_ABSENT            = 0,
00128         VARIETY_ATOMIC            = 1,
00132         VARIETY_LIST              = 2,
00136         VARIETY_UNION             = 3
00137     };
00138 
00139     // Facets
00140     enum FACET {
00144         FACET_NONE                = 0,
00148         FACET_LENGTH              = 1,
00152         FACET_MINLENGTH           = 2,
00156         FACET_MAXLENGTH           = 4,
00160         FACET_PATTERN             = 8,
00164         FACET_WHITESPACE          = 16,
00168         FACET_MAXINCLUSIVE        = 32,
00172         FACET_MAXEXCLUSIVE        = 64,
00176         FACET_MINEXCLUSIVE        = 128,
00180         FACET_MININCLUSIVE        = 256,
00184         FACET_TOTALDIGITS         = 512,
00188         FACET_FRACTIONDIGITS      = 1024,
00192         FACET_ENUMERATION         = 2048
00193     };
00194 
00195     // possible order relations
00196     enum ORDERING {
00200         ORDERED_FALSE             = 0,
00205         ORDERED_PARTIAL           = 1,
00209         ORDERED_TOTAL             = 2
00210     };
00211 
00212     //  Constructors and Destructor
00213     // -----------------------------------------------------------------------
00216 
00229     XSSimpleTypeDefinition
00230     (
00231         DatatypeValidator* const            datatypeValidator
00232         , VARIETY                           stVariety
00233         , XSTypeDefinition* const           xsBaseType
00234         , XSSimpleTypeDefinition* const     primitiveOrItemType
00235         , XSSimpleTypeDefinitionList* const memberTypes
00236         , XSAnnotation*                     headAnnot
00237         , XSModel* const                    xsModel
00238         , MemoryManager* const              manager = XMLPlatformUtils::fgMemoryManager
00239     );
00240 
00242 
00245     ~XSSimpleTypeDefinition();
00247 
00248     //---------------------
00252 
00256     VARIETY getVariety() const;
00257 
00263     XSSimpleTypeDefinition *getPrimitiveType();
00264 
00270     XSSimpleTypeDefinition *getItemType();
00271 
00277     XSSimpleTypeDefinitionList *getMemberTypes() const;
00278 
00283     int getDefinedFacets() const;
00284 
00291     bool isDefinedFacet(FACET facetName);
00292 
00296     int getFixedFacets() const;
00297 
00304     bool isFixedFacet(FACET facetName);
00305 
00317     const XMLCh *getLexicalFacetValue(FACET facetName);
00318 
00322     StringList *getLexicalEnumeration();
00323 
00327     StringList *getLexicalPattern();
00328 
00332     ORDERING getOrdered() const;
00333 
00337     bool getFinite() const;
00338 
00342     bool getBounded() const;
00343 
00347     bool getNumeric() const;
00348 
00352     XSAnnotationList *getAnnotations();
00358     XSFacetList *getFacets();
00359     
00363     XSMultiValueFacetList *getMultiValueFacets();
00364     
00369     const XMLCh* getName();
00370 
00375     const XMLCh* getNamespace();
00376 
00382     XSNamespaceItem *getNamespaceItem();
00383 
00388     bool getAnonymous() const;
00389 
00394     XSTypeDefinition *getBaseType();
00395 
00403     bool derivedFromType(const XSTypeDefinition* const ancestorType);
00404 
00406 
00407     //----------------------------------
00411 
00412 
00414 
00415 private:
00416 
00417     // -----------------------------------------------------------------------
00418     //  Unimplemented constructors and operators
00419     // -----------------------------------------------------------------------
00420     XSSimpleTypeDefinition(const XSSimpleTypeDefinition&);
00421     XSSimpleTypeDefinition & operator=(const XSSimpleTypeDefinition &);
00422 
00426     void setFacetInfo
00427     (
00428         int                            definedFacets
00429         , int                          fixedFacets
00430         , XSFacetList* const           xsFacetList
00431         , XSMultiValueFacetList* const xsMultiValueFacetList
00432         , StringList* const            patternList
00433     );
00434     void setPrimitiveType(XSSimpleTypeDefinition*  const toSet);
00435 
00436     friend class XSObjectFactory;
00437 
00438 protected:
00439 
00440     // -----------------------------------------------------------------------
00441     //  data members
00442     // -----------------------------------------------------------------------
00443     int                         fDefinedFacets;
00444     int                         fFixedFacets;
00445     VARIETY                     fVariety;
00446     DatatypeValidator*          fDatatypeValidator;
00447     XSFacetList*                fXSFacetList;
00448     XSMultiValueFacetList*      fXSMultiValueFacetList;
00449     StringList*                 fPatternList;
00450     XSSimpleTypeDefinition*     fPrimitiveOrItemType;
00451     XSSimpleTypeDefinitionList* fMemberTypes;
00452     XSAnnotationList*           fXSAnnotationList;
00453 };
00454 
00455 inline XSSimpleTypeDefinition::VARIETY XSSimpleTypeDefinition::getVariety() const
00456 {
00457     return fVariety;
00458 }
00459 
00460 inline XSSimpleTypeDefinition* XSSimpleTypeDefinition::getPrimitiveType()
00461 {
00462     if (fVariety == VARIETY_ATOMIC)
00463         return fPrimitiveOrItemType;
00464 
00465     return 0;
00466 }
00467 
00468 inline XSSimpleTypeDefinition* XSSimpleTypeDefinition::getItemType()
00469 {
00470     if (fVariety == VARIETY_LIST)
00471         return fPrimitiveOrItemType;
00472 
00473     return 0;
00474 }
00475 
00476 inline XSSimpleTypeDefinitionList* XSSimpleTypeDefinition::getMemberTypes() const
00477 {
00478     return fMemberTypes;
00479 }
00480 
00481 inline int XSSimpleTypeDefinition::getDefinedFacets() const
00482 {
00483     return fDefinedFacets;
00484 }
00485 
00486 inline int XSSimpleTypeDefinition::getFixedFacets() const
00487 {
00488     return fFixedFacets;
00489 }
00490 
00491 inline StringList* XSSimpleTypeDefinition::getLexicalPattern()
00492 {
00493     return fPatternList;
00494 }
00495 
00496 inline XSFacetList* XSSimpleTypeDefinition::getFacets()
00497 {
00498     return fXSFacetList;
00499 }
00500 
00501 inline XSMultiValueFacetList* XSSimpleTypeDefinition::getMultiValueFacets()
00502 {
00503     return fXSMultiValueFacetList;
00504 }
00505 
00506 inline XSAnnotationList *XSSimpleTypeDefinition::getAnnotations()
00507 {
00508     return fXSAnnotationList;
00509 }
00510 
00511 inline void
00512 XSSimpleTypeDefinition::setPrimitiveType(XSSimpleTypeDefinition* const toSet)
00513 {
00514     fPrimitiveOrItemType = toSet;
00515 }
00516 
00517 XERCES_CPP_NAMESPACE_END
00518 
00519 #endif


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