| API Docs for SAX and DOM |
| Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages # 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  * $Id: XSSimpleTypeDefinition.hpp 191054 2005-06-17 02:56:35Z jberry $
    00019  */
    00020
    00021 #if !defined(XSSIMPLETYPEDEFINITION_HPP)
    00022 #define XSSIMPLETYPEDEFINITION_HPP
    00023
    00024 #include <xercesc/framework/psvi/XSTypeDefinition.hpp>
    00025
    00026 XERCES_CPP_NAMESPACE_BEGIN
    00027
    00036 // forward declarations
    00037 class XSAnnotation;
    00038 class XSFacet;
    00039 class XSMultiValueFacet;
    00040 class DatatypeValidator;
    00041
    00042 class  XSSimpleTypeDefinition : public XSTypeDefinition
    00043 {
    00044 public:
    00045
    00046     // Variety definitions
    00047     enum VARIETY {
    00051         VARIETY_ABSENT            = 0,
    00055         VARIETY_ATOMIC            = 1,
    00059         VARIETY_LIST              = 2,
    00063         VARIETY_UNION             = 3
    00064     };
    00065
    00066     // Facets
    00067     enum FACET {
    00071         FACET_NONE                = 0,
    00075         FACET_LENGTH              = 1,
    00079         FACET_MINLENGTH           = 2,
    00083         FACET_MAXLENGTH           = 4,
    00087         FACET_PATTERN             = 8,
    00091         FACET_WHITESPACE          = 16,
    00095         FACET_MAXINCLUSIVE        = 32,
    00099         FACET_MAXEXCLUSIVE        = 64,
    00103         FACET_MINEXCLUSIVE        = 128,
    00107         FACET_MININCLUSIVE        = 256,
    00111         FACET_TOTALDIGITS         = 512,
    00115         FACET_FRACTIONDIGITS      = 1024,
    00119         FACET_ENUMERATION         = 2048
    00120     };
    00121
    00122     // possible order relations
    00123     enum ORDERING {
    00127         ORDERED_FALSE             = 0,
    00132         ORDERED_PARTIAL           = 1,
    00136         ORDERED_TOTAL             = 2
    00137     };
    00138
    00139     //  Constructors and Destructor
    00140     // -----------------------------------------------------------------------
    00143
    00156     XSSimpleTypeDefinition
    00157     (
    00158         DatatypeValidator* const            datatypeValidator
    00159         , VARIETY                           stVariety
    00160         , XSTypeDefinition* const           xsBaseType
    00161         , XSSimpleTypeDefinition* const     primitiveOrItemType
    00162         , XSSimpleTypeDefinitionList* const memberTypes
    00163         , XSAnnotation*                     headAnnot
    00164         , XSModel* const                    xsModel
    00165         , MemoryManager* const              manager = XMLPlatformUtils::fgMemoryManager
    00166     );
    00167
    00169
    00172     ~XSSimpleTypeDefinition();
    00174
    00175     //---------------------
    00179
    00183     VARIETY getVariety() const;
    00184
    00190     XSSimpleTypeDefinition *getPrimitiveType();
    00191
    00197     XSSimpleTypeDefinition *getItemType();
    00198
    00204     XSSimpleTypeDefinitionList *getMemberTypes() const;
    00205
    00210     int getDefinedFacets() const;
    00211
    00218     bool isDefinedFacet(FACET facetName);
    00219
    00223     int getFixedFacets() const;
    00224
    00231     bool isFixedFacet(FACET facetName);
    00232
    00244     const XMLCh *getLexicalFacetValue(FACET facetName);
    00245
    00249     StringList *getLexicalEnumeration();
    00250
    00254     StringList *getLexicalPattern();
    00255
    00259     ORDERING getOrdered() const;
    00260
    00264     bool getFinite() const;
    00265
    00269     bool getBounded() const;
    00270
    00274     bool getNumeric() const;
    00275
    00279     XSAnnotationList *getAnnotations();
    00285     XSFacetList *getFacets();
    00286
    00290     XSMultiValueFacetList *getMultiValueFacets();
    00291
    00296     const XMLCh* getName();
    00297
    00302     const XMLCh* getNamespace();
    00303
    00309     XSNamespaceItem *getNamespaceItem();
    00310
    00315     bool getAnonymous() const;
    00316
    00321     XSTypeDefinition *getBaseType();
    00322
    00330     bool derivedFromType(const XSTypeDefinition* const ancestorType);
    00331
    00335     inline DatatypeValidator* getDatatypeValidator() const;
    00336
    00338
    00339     //----------------------------------
    00343
    00344
    00346
    00347 private:
    00348
    00349     // -----------------------------------------------------------------------
    00350     //  Unimplemented constructors and operators
    00351     // -----------------------------------------------------------------------
    00352     XSSimpleTypeDefinition(const XSSimpleTypeDefinition&);
    00353     XSSimpleTypeDefinition & operator=(const XSSimpleTypeDefinition &);
    00354
    00358     void setFacetInfo
    00359     (
    00360         int                            definedFacets
    00361         , int                          fixedFacets
    00362         , XSFacetList* const           xsFacetList
    00363         , XSMultiValueFacetList* const xsMultiValueFacetList
    00364         , StringList* const            patternList
    00365     );
    00366     void setPrimitiveType(XSSimpleTypeDefinition*  const toSet);
    00367
    00368     friend class XSObjectFactory;
    00369
    00370 protected:
    00371
    00372     // -----------------------------------------------------------------------
    00373     //  data members
    00374     // -----------------------------------------------------------------------
    00375     int                         fDefinedFacets;
    00376     int                         fFixedFacets;
    00377     VARIETY                     fVariety;
    00378     DatatypeValidator*          fDatatypeValidator;
    00379     XSFacetList*                fXSFacetList;
    00380     XSMultiValueFacetList*      fXSMultiValueFacetList;
    00381     StringList*                 fPatternList;
    00382     XSSimpleTypeDefinition*     fPrimitiveOrItemType;
    00383     XSSimpleTypeDefinitionList* fMemberTypes;
    00384     XSAnnotationList*           fXSAnnotationList;
    00385 };
    00386
    00387 inline XSSimpleTypeDefinition::VARIETY XSSimpleTypeDefinition::getVariety() const
    00388 {
    00389     return fVariety;
    00390 }
    00391
    00392 inline XSSimpleTypeDefinition* XSSimpleTypeDefinition::getPrimitiveType()
    00393 {
    00394     if (fVariety == VARIETY_ATOMIC)
    00395         return fPrimitiveOrItemType;
    00396
    00397     return 0;
    00398 }
    00399
    00400 inline XSSimpleTypeDefinition* XSSimpleTypeDefinition::getItemType()
    00401 {
    00402     if (fVariety == VARIETY_LIST)
    00403         return fPrimitiveOrItemType;
    00404
    00405     return 0;
    00406 }
    00407
    00408 inline XSSimpleTypeDefinitionList* XSSimpleTypeDefinition::getMemberTypes() const
    00409 {
    00410     return fMemberTypes;
    00411 }
    00412
    00413 inline int XSSimpleTypeDefinition::getDefinedFacets() const
    00414 {
    00415     return fDefinedFacets;
    00416 }
    00417
    00418 inline int XSSimpleTypeDefinition::getFixedFacets() const
    00419 {
    00420     return fFixedFacets;
    00421 }
    00422
    00423 inline StringList* XSSimpleTypeDefinition::getLexicalPattern()
    00424 {
    00425     return fPatternList;
    00426 }
    00427
    00428 inline XSFacetList* XSSimpleTypeDefinition::getFacets()
    00429 {
    00430     return fXSFacetList;
    00431 }
    00432
    00433 inline XSMultiValueFacetList* XSSimpleTypeDefinition::getMultiValueFacets()
    00434 {
    00435     return fXSMultiValueFacetList;
    00436 }
    00437
    00438 inline XSAnnotationList *XSSimpleTypeDefinition::getAnnotations()
    00439 {
    00440     return fXSAnnotationList;
    00441 }
    00442
    00443 inline void
    00444 XSSimpleTypeDefinition::setPrimitiveType(XSSimpleTypeDefinition* const toSet)
    00445 {
    00446     fPrimitiveOrItemType = toSet;
    00447 }
    00448
    00449 inline DatatypeValidator*
    00450 XSSimpleTypeDefinition::getDatatypeValidator() const
    00451 {
    00452     return fDatatypeValidator;
    00453 }
    00454
    00455 XERCES_CPP_NAMESPACE_END
    00456
    00457 #endif

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