| 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  * 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: XSSimpleTypeDefinition.hpp,v $
    00019  * Revision 1.12  2004/09/13 21:23:00  peiyongz
    00020  * getDatatypeValidator()
    00021  *
    00022  * Revision 1.11  2004/09/08 13:56:09  peiyongz
    00023  * Apache License Version 2.0
    00024  *
    00025  * Revision 1.10  2003/12/24 17:42:02  knoaman
    00026  * Misc. PSVI updates
    00027  *
    00028  * Revision 1.9  2003/12/01 23:23:26  neilg
    00029  * fix for bug 25118; thanks to Jeroen Witmond
    00030  *
    00031  * Revision 1.8  2003/11/25 18:08:31  knoaman
    00032  * Misc. PSVI updates. Thanks to David Cargill.
    00033  *
    00034  * Revision 1.7  2003/11/24 15:45:36  knoaman
    00035  * PSVI: finish construction of XSSimpleTypeDefinition
    00036  *
    00037  * Revision 1.6  2003/11/21 17:34:04  knoaman
    00038  * PSVI update
    00039  *
    00040  * Revision 1.5  2003/11/14 22:47:53  neilg
    00041  * fix bogus log message from previous commit...
    00042  *
    00043  * Revision 1.4  2003/11/14 22:33:30  neilg
    00044  * Second phase of schema component model implementation.
    00045  * Implement XSModel, XSNamespaceItem, and the plumbing necessary
    00046  * to connect them to the other components.
    00047  * Thanks to David Cargill.
    00048  *
    00049  * Revision 1.3  2003/11/06 21:50:33  neilg
    00050  * fix compilation errors under gcc 3.3.
    00051  *
    00052  * Revision 1.2  2003/11/06 15:30:04  neilg
    00053  * 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.
    00054  *
    00055  * Revision 1.1  2003/09/16 14:33:36  neilg
    00056  * PSVI/schema component model classes, with Makefile/configuration changes necessary to build them
    00057  *
    00058  */
    00059
    00060 #if !defined(XSSIMPLETYPEDEFINITION_HPP)
    00061 #define XSSIMPLETYPEDEFINITION_HPP
    00062
    00063 #include <xercesc/framework/psvi/XSTypeDefinition.hpp>
    00064
    00065 XERCES_CPP_NAMESPACE_BEGIN
    00066
    00075 // forward declarations
    00076 class XSAnnotation;
    00077 class XSFacet;
    00078 class XSMultiValueFacet;
    00079 class DatatypeValidator;
    00080
    00081 class  XSSimpleTypeDefinition : public XSTypeDefinition
    00082 {
    00083 public:
    00084
    00085     // Variety definitions
    00086     enum VARIETY {
    00090         VARIETY_ABSENT            = 0,
    00094         VARIETY_ATOMIC            = 1,
    00098         VARIETY_LIST              = 2,
    00102         VARIETY_UNION             = 3
    00103     };
    00104
    00105     // Facets
    00106     enum FACET {
    00110         FACET_NONE                = 0,
    00114         FACET_LENGTH              = 1,
    00118         FACET_MINLENGTH           = 2,
    00122         FACET_MAXLENGTH           = 4,
    00126         FACET_PATTERN             = 8,
    00130         FACET_WHITESPACE          = 16,
    00134         FACET_MAXINCLUSIVE        = 32,
    00138         FACET_MAXEXCLUSIVE        = 64,
    00142         FACET_MINEXCLUSIVE        = 128,
    00146         FACET_MININCLUSIVE        = 256,
    00150         FACET_TOTALDIGITS         = 512,
    00154         FACET_FRACTIONDIGITS      = 1024,
    00158         FACET_ENUMERATION         = 2048
    00159     };
    00160
    00161     // possible order relations
    00162     enum ORDERING {
    00166         ORDERED_FALSE             = 0,
    00171         ORDERED_PARTIAL           = 1,
    00175         ORDERED_TOTAL             = 2
    00176     };
    00177
    00178     //  Constructors and Destructor
    00179     // -----------------------------------------------------------------------
    00182
    00195     XSSimpleTypeDefinition
    00196     (
    00197         DatatypeValidator* const            datatypeValidator
    00198         , VARIETY                           stVariety
    00199         , XSTypeDefinition* const           xsBaseType
    00200         , XSSimpleTypeDefinition* const     primitiveOrItemType
    00201         , XSSimpleTypeDefinitionList* const memberTypes
    00202         , XSAnnotation*                     headAnnot
    00203         , XSModel* const                    xsModel
    00204         , MemoryManager* const              manager = XMLPlatformUtils::fgMemoryManager
    00205     );
    00206
    00208
    00211     ~XSSimpleTypeDefinition();
    00213
    00214     //---------------------
    00218
    00222     VARIETY getVariety() const;
    00223
    00229     XSSimpleTypeDefinition *getPrimitiveType();
    00230
    00236     XSSimpleTypeDefinition *getItemType();
    00237
    00243     XSSimpleTypeDefinitionList *getMemberTypes() const;
    00244
    00249     int getDefinedFacets() const;
    00250
    00257     bool isDefinedFacet(FACET facetName);
    00258
    00262     int getFixedFacets() const;
    00263
    00270     bool isFixedFacet(FACET facetName);
    00271
    00283     const XMLCh *getLexicalFacetValue(FACET facetName);
    00284
    00288     StringList *getLexicalEnumeration();
    00289
    00293     StringList *getLexicalPattern();
    00294
    00298     ORDERING getOrdered() const;
    00299
    00303     bool getFinite() const;
    00304
    00308     bool getBounded() const;
    00309
    00313     bool getNumeric() const;
    00314
    00318     XSAnnotationList *getAnnotations();
    00324     XSFacetList *getFacets();
    00325
    00329     XSMultiValueFacetList *getMultiValueFacets();
    00330
    00335     const XMLCh* getName();
    00336
    00341     const XMLCh* getNamespace();
    00342
    00348     XSNamespaceItem *getNamespaceItem();
    00349
    00354     bool getAnonymous() const;
    00355
    00360     XSTypeDefinition *getBaseType();
    00361
    00369     bool derivedFromType(const XSTypeDefinition* const ancestorType);
    00370
    00374     inline DatatypeValidator* getDatatypeValidator() const;
    00375
    00377
    00378     //----------------------------------
    00382
    00383
    00385
    00386 private:
    00387
    00388     // -----------------------------------------------------------------------
    00389     //  Unimplemented constructors and operators
    00390     // -----------------------------------------------------------------------
    00391     XSSimpleTypeDefinition(const XSSimpleTypeDefinition&);
    00392     XSSimpleTypeDefinition & operator=(const XSSimpleTypeDefinition &);
    00393
    00397     void setFacetInfo
    00398     (
    00399         int                            definedFacets
    00400         , int                          fixedFacets
    00401         , XSFacetList* const           xsFacetList
    00402         , XSMultiValueFacetList* const xsMultiValueFacetList
    00403         , StringList* const            patternList
    00404     );
    00405     void setPrimitiveType(XSSimpleTypeDefinition*  const toSet);
    00406
    00407     friend class XSObjectFactory;
    00408
    00409 protected:
    00410
    00411     // -----------------------------------------------------------------------
    00412     //  data members
    00413     // -----------------------------------------------------------------------
    00414     int                         fDefinedFacets;
    00415     int                         fFixedFacets;
    00416     VARIETY                     fVariety;
    00417     DatatypeValidator*          fDatatypeValidator;
    00418     XSFacetList*                fXSFacetList;
    00419     XSMultiValueFacetList*      fXSMultiValueFacetList;
    00420     StringList*                 fPatternList;
    00421     XSSimpleTypeDefinition*     fPrimitiveOrItemType;
    00422     XSSimpleTypeDefinitionList* fMemberTypes;
    00423     XSAnnotationList*           fXSAnnotationList;
    00424 };
    00425
    00426 inline XSSimpleTypeDefinition::VARIETY XSSimpleTypeDefinition::getVariety() const
    00427 {
    00428     return fVariety;
    00429 }
    00430
    00431 inline XSSimpleTypeDefinition* XSSimpleTypeDefinition::getPrimitiveType()
    00432 {
    00433     if (fVariety == VARIETY_ATOMIC)
    00434         return fPrimitiveOrItemType;
    00435
    00436     return 0;
    00437 }
    00438
    00439 inline XSSimpleTypeDefinition* XSSimpleTypeDefinition::getItemType()
    00440 {
    00441     if (fVariety == VARIETY_LIST)
    00442         return fPrimitiveOrItemType;
    00443
    00444     return 0;
    00445 }
    00446
    00447 inline XSSimpleTypeDefinitionList* XSSimpleTypeDefinition::getMemberTypes() const
    00448 {
    00449     return fMemberTypes;
    00450 }
    00451
    00452 inline int XSSimpleTypeDefinition::getDefinedFacets() const
    00453 {
    00454     return fDefinedFacets;
    00455 }
    00456
    00457 inline int XSSimpleTypeDefinition::getFixedFacets() const
    00458 {
    00459     return fFixedFacets;
    00460 }
    00461
    00462 inline StringList* XSSimpleTypeDefinition::getLexicalPattern()
    00463 {
    00464     return fPatternList;
    00465 }
    00466
    00467 inline XSFacetList* XSSimpleTypeDefinition::getFacets()
    00468 {
    00469     return fXSFacetList;
    00470 }
    00471
    00472 inline XSMultiValueFacetList* XSSimpleTypeDefinition::getMultiValueFacets()
    00473 {
    00474     return fXSMultiValueFacetList;
    00475 }
    00476
    00477 inline XSAnnotationList *XSSimpleTypeDefinition::getAnnotations()
    00478 {
    00479     return fXSAnnotationList;
    00480 }
    00481
    00482 inline void
    00483 XSSimpleTypeDefinition::setPrimitiveType(XSSimpleTypeDefinition* const toSet)
    00484 {
    00485     fPrimitiveOrItemType = toSet;
    00486 }
    00487
    00488 inline DatatypeValidator*
    00489 XSSimpleTypeDefinition::getDatatypeValidator() const
    00490 {
    00491     return fDatatypeValidator;
    00492 }
    00493
    00494 XERCES_CPP_NAMESPACE_END
    00495
    00496 #endif

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