| 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.9  2003/12/01 23:23:26  neilg
    00060  * fix for bug 25118; thanks to Jeroen Witmond
    00061  *
    00062  * Revision 1.8  2003/11/25 18:08:31  knoaman
    00063  * Misc. PSVI updates. Thanks to David Cargill.
    00064  *
    00065  * Revision 1.7  2003/11/24 15:45:36  knoaman
    00066  * PSVI: finish construction of XSSimpleTypeDefinition
    00067  *
    00068  * Revision 1.6  2003/11/21 17:34:04  knoaman
    00069  * PSVI update
    00070  *
    00071  * Revision 1.5  2003/11/14 22:47:53  neilg
    00072  * fix bogus log message from previous commit...
    00073  *
    00074  * Revision 1.4  2003/11/14 22:33:30  neilg
    00075  * Second phase of schema component model implementation.
    00076  * Implement XSModel, XSNamespaceItem, and the plumbing necessary
    00077  * to connect them to the other components.
    00078  * Thanks to David Cargill.
    00079  *
    00080  * Revision 1.3  2003/11/06 21:50:33  neilg
    00081  * fix compilation errors under gcc 3.3.
    00082  *
    00083  * Revision 1.2  2003/11/06 15:30:04  neilg
    00084  * 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.
    00085  *
    00086  * Revision 1.1  2003/09/16 14:33:36  neilg
    00087  * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them
    00088  *
    00089  */
    00090
    00091 #if !defined(XSSIMPLETYPEDEFINITION_HPP)
    00092 #define XSSIMPLETYPEDEFINITION_HPP
    00093
    00094 #include <xercesc/framework/psvi/XSTypeDefinition.hpp>
    00095
    00096 XERCES_CPP_NAMESPACE_BEGIN
    00097
    00106 // forward declarations
    00107 class XSAnnotation;
    00108 class XSFacet;
    00109 class XSMultiValueFacet;
    00110 class DatatypeValidator;
    00111
    00112 class  XSSimpleTypeDefinition : public XSTypeDefinition
    00113 {
    00114 public:
    00115
    00116     // Variety definitions
    00117     enum VARIETY {
    00121         VARIETY_ABSENT            = 0,
    00125         VARIETY_ATOMIC            = 1,
    00129         VARIETY_LIST              = 2,
    00133         VARIETY_UNION             = 3
    00134     };
    00135
    00136     // Facets
    00137     enum FACET {
    00141         FACET_NONE                = 0,
    00145         FACET_LENGTH              = 1,
    00149         FACET_MINLENGTH           = 2,
    00153         FACET_MAXLENGTH           = 4,
    00157         FACET_PATTERN             = 8,
    00161         FACET_WHITESPACE          = 16,
    00165         FACET_MAXINCLUSIVE        = 32,
    00169         FACET_MAXEXCLUSIVE        = 64,
    00173         FACET_MINEXCLUSIVE        = 128,
    00177         FACET_MININCLUSIVE        = 256,
    00181         FACET_TOTALDIGITS         = 512,
    00185         FACET_FRACTIONDIGITS      = 1024,
    00189         FACET_ENUMERATION         = 2048
    00190     };
    00191
    00192     // possible order relations
    00193     enum ORDERING {
    00197         ORDERED_FALSE             = 0,
    00202         ORDERED_PARTIAL           = 1,
    00206         ORDERED_TOTAL             = 2
    00207     };
    00208
    00209     //  Constructors and Destructor
    00210     // -----------------------------------------------------------------------
    00213
    00226     XSSimpleTypeDefinition
    00227     (
    00228         DatatypeValidator* const            datatypeValidator
    00229         , VARIETY                           stVariety
    00230         , XSTypeDefinition* const           xsBaseType
    00231         , XSSimpleTypeDefinition* const     primitiveOrItemType
    00232         , XSSimpleTypeDefinitionList* const memberTypes
    00233         , XSAnnotation*                     headAnnot
    00234         , XSModel* const                    xsModel
    00235         , MemoryManager* const              manager = XMLPlatformUtils::fgMemoryManager
    00236     );
    00237
    00239
    00242     ~XSSimpleTypeDefinition();
    00244
    00245     //---------------------
    00249
    00253     VARIETY getVariety() const;
    00254
    00260     XSSimpleTypeDefinition *getPrimitiveType();
    00261
    00267     XSSimpleTypeDefinition *getItemType();
    00268
    00274     XSSimpleTypeDefinitionList *getMemberTypes() const;
    00275
    00280     int getDefinedFacets() const;
    00281
    00288     bool isDefinedFacet(FACET facetName);
    00289
    00293     int getFixedFacets() const;
    00294
    00301     bool isFixedFacet(FACET facetName);
    00302
    00314     const XMLCh *getLexicalFacetValue(FACET facetName);
    00315
    00319     StringList *getLexicalEnumeration();
    00320
    00324     StringList *getLexicalPattern();
    00325
    00329     ORDERING getOrdered() const;
    00330
    00334     bool getFinite() const;
    00335
    00339     bool getBounded() const;
    00340
    00344     bool getNumeric() const;
    00345
    00349     XSAnnotationList *getAnnotations();
    00355     XSFacetList *getFacets();
    00356
    00360     XSMultiValueFacetList *getMultiValueFacets();
    00361
    00366     const XMLCh* getName();
    00367
    00372     const XMLCh* getNamespace();
    00373
    00379     XSNamespaceItem *getNamespaceItem();
    00380
    00385     bool getAnonymous() const;
    00386
    00391     XSTypeDefinition *getBaseType();
    00392
    00400     bool derivedFromType(const XSTypeDefinition* const ancestorType);
    00401
    00403
    00404     //----------------------------------
    00408
    00409
    00411
    00412 private:
    00413
    00414     // -----------------------------------------------------------------------
    00415     //  Unimplemented constructors and operators
    00416     // -----------------------------------------------------------------------
    00417     XSSimpleTypeDefinition(const XSSimpleTypeDefinition&);
    00418     XSSimpleTypeDefinition & operator=(const XSSimpleTypeDefinition &);
    00419
    00423     void setFacetInfo
    00424     (
    00425         int                            definedFacets
    00426         , int                          fixedFacets
    00427         , XSFacetList* const           xsFacetList
    00428         , XSMultiValueFacetList* const xsMultiValueFacetList
    00429         , StringList* const            patternList
    00430     );
    00431
    00432     friend class XSObjectFactory;
    00433
    00434 protected:
    00435
    00436     // -----------------------------------------------------------------------
    00437     //  data members
    00438     // -----------------------------------------------------------------------
    00439     int                         fDefinedFacets;
    00440     int                         fFixedFacets;
    00441     VARIETY                     fVariety;
    00442     DatatypeValidator*          fDatatypeValidator;
    00443     XSFacetList*                fXSFacetList;
    00444     XSMultiValueFacetList*      fXSMultiValueFacetList;
    00445     StringList*                 fPatternList;
    00446     XSSimpleTypeDefinition*     fPrimitiveOrItemType;
    00447     XSSimpleTypeDefinitionList* fMemberTypes;
    00448     XSAnnotationList*           fXSAnnotationList;
    00449 };
    00450
    00451 inline XSSimpleTypeDefinition::VARIETY XSSimpleTypeDefinition::getVariety() const
    00452 {
    00453     return fVariety;
    00454 }
    00455
    00456 inline XSSimpleTypeDefinition* XSSimpleTypeDefinition::getPrimitiveType()
    00457 {
    00458     if (fVariety == VARIETY_ATOMIC)
    00459         return fPrimitiveOrItemType;
    00460
    00461     return 0;
    00462 }
    00463
    00464 inline XSSimpleTypeDefinition* XSSimpleTypeDefinition::getItemType()
    00465 {
    00466     if (fVariety == VARIETY_LIST)
    00467         return fPrimitiveOrItemType;
    00468
    00469     return 0;
    00470 }
    00471
    00472 inline XSSimpleTypeDefinitionList* XSSimpleTypeDefinition::getMemberTypes() const
    00473 {
    00474     return fMemberTypes;
    00475 }
    00476
    00477 inline int XSSimpleTypeDefinition::getDefinedFacets() const
    00478 {
    00479     return fDefinedFacets;
    00480 }
    00481
    00482 inline int XSSimpleTypeDefinition::getFixedFacets() const
    00483 {
    00484     return fFixedFacets;
    00485 }
    00486
    00487 inline StringList* XSSimpleTypeDefinition::getLexicalPattern()
    00488 {
    00489     return fPatternList;
    00490 }
    00491
    00492 inline XSFacetList* XSSimpleTypeDefinition::getFacets()
    00493 {
    00494     return fXSFacetList;
    00495 }
    00496
    00497 inline XSMultiValueFacetList* XSSimpleTypeDefinition::getMultiValueFacets()
    00498 {
    00499     return fXSMultiValueFacetList;
    00500 }
    00501
    00502 inline XSAnnotationList *XSSimpleTypeDefinition::getAnnotations()
    00503 {
    00504     return fXSAnnotationList;
    00505 }
    00506
    00507 XERCES_CPP_NAMESPACE_END
    00508
    00509 #endif

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