Xerces-C++: XSSimpleTypeDefinition.hpp Source File

- Main Page
- Classes
- Files
- Related Pages

# XSSimpleTypeDefinition.hpp

Go to the documentation of this file.

    00001 /*
    00002  * Licensed to the Apache Software Foundation (ASF) under one or more
    00003  * contributor license agreements.  See the NOTICE file distributed with
    00004  * this work for additional information regarding copyright ownership.
    00005  * The ASF licenses this file to You under the Apache License, Version 2.0
    00006  * (the "License"); you may not use this file except in compliance with
    00007  * the License.  You may obtain a copy of the License at
    00008  *
    00009  *      http://www.apache.org/licenses/LICENSE-2.0
    00010  *
    00011  * Unless required by applicable law or agreed to in writing, software
    00012  * distributed under the License is distributed on an "AS IS" BASIS,
    00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00014  * See the License for the specific language governing permissions and
    00015  * limitations under the License.
    00016  */
    00017
    00018 /*
    00019  * $Id: XSSimpleTypeDefinition.hpp 527149 2007-04-10 14:56:39Z amassari $
    00020  */
    00021
    00022 #if !defined(XERCESC_INCLUDE_GUARD_XSSIMPLETYPEDEFINITION_HPP)
    00023 #define XERCESC_INCLUDE_GUARD_XSSIMPLETYPEDEFINITION_HPP
    00024
    00025 #include <xercesc/framework/psvi/XSTypeDefinition.hpp>
    00026
    00027 XERCES_CPP_NAMESPACE_BEGIN
    00028
    00037 // forward declarations
    00038 class XSAnnotation;
    00039 class XSFacet;
    00040 class XSMultiValueFacet;
    00041 class DatatypeValidator;
    00042
    00043 class XMLPARSER_EXPORT XSSimpleTypeDefinition : public XSTypeDefinition
    00044 {
    00045 public:
    00046
    00047     // Variety definitions
    00048     enum VARIETY {
    00052         VARIETY_ABSENT            = 0,
    00056         VARIETY_ATOMIC            = 1,
    00060         VARIETY_LIST              = 2,
    00064         VARIETY_UNION             = 3
    00065     };
    00066
    00067     // Facets
    00068     enum FACET {
    00072         FACET_NONE                = 0,
    00076         FACET_LENGTH              = 1,
    00080         FACET_MINLENGTH           = 2,
    00084         FACET_MAXLENGTH           = 4,
    00088         FACET_PATTERN             = 8,
    00092         FACET_WHITESPACE          = 16,
    00096         FACET_MAXINCLUSIVE        = 32,
    00100         FACET_MAXEXCLUSIVE        = 64,
    00104         FACET_MINEXCLUSIVE        = 128,
    00108         FACET_MININCLUSIVE        = 256,
    00112         FACET_TOTALDIGITS         = 512,
    00116         FACET_FRACTIONDIGITS      = 1024,
    00120         FACET_ENUMERATION         = 2048
    00121     };
    00122
    00123     // possible order relations
    00124     enum ORDERING {
    00128         ORDERED_FALSE             = 0,
    00133         ORDERED_PARTIAL           = 1,
    00137         ORDERED_TOTAL             = 2
    00138     };
    00139
    00140     //  Constructors and Destructor
    00141     // -----------------------------------------------------------------------
    00144
    00157     XSSimpleTypeDefinition
    00158     (
    00159         DatatypeValidator* const            datatypeValidator
    00160         , VARIETY                           stVariety
    00161         , XSTypeDefinition* const           xsBaseType
    00162         , XSSimpleTypeDefinition* const     primitiveOrItemType
    00163         , XSSimpleTypeDefinitionList* const memberTypes
    00164         , XSAnnotation*                     headAnnot
    00165         , XSModel* const                    xsModel
    00166         , MemoryManager* const              manager = XMLPlatformUtils::fgMemoryManager
    00167     );
    00168
    00170
    00173     ~XSSimpleTypeDefinition();
    00175
    00176     //---------------------
    00180
    00184     VARIETY getVariety() const;
    00185
    00191     XSSimpleTypeDefinition *getPrimitiveType();
    00192
    00198     XSSimpleTypeDefinition *getItemType();
    00199
    00205     XSSimpleTypeDefinitionList *getMemberTypes() const;
    00206
    00211     int getDefinedFacets() const;
    00212
    00219     bool isDefinedFacet(FACET facetName);
    00220
    00224     int getFixedFacets() const;
    00225
    00232     bool isFixedFacet(FACET facetName);
    00233
    00245     const XMLCh *getLexicalFacetValue(FACET facetName);
    00246
    00250     StringList *getLexicalEnumeration();
    00251
    00255     StringList *getLexicalPattern();
    00256
    00260     ORDERING getOrdered() const;
    00261
    00265     bool getFinite() const;
    00266
    00270     bool getBounded() const;
    00271
    00275     bool getNumeric() const;
    00276
    00280     XSAnnotationList *getAnnotations();
    00286     XSFacetList *getFacets();
    00287
    00291     XSMultiValueFacetList *getMultiValueFacets();
    00292
    00297     const XMLCh* getName() const;
    00298
    00303     const XMLCh* getNamespace();
    00304
    00310     XSNamespaceItem *getNamespaceItem();
    00311
    00316     bool getAnonymous() const;
    00317
    00322     XSTypeDefinition *getBaseType();
    00323
    00331     bool derivedFromType(const XSTypeDefinition* const ancestorType);
    00332
    00336     inline DatatypeValidator* getDatatypeValidator() const;
    00337
    00339
    00340     //----------------------------------
    00344
    00345
    00347
    00348 private:
    00349
    00350     // -----------------------------------------------------------------------
    00351     //  Unimplemented constructors and operators
    00352     // -----------------------------------------------------------------------
    00353     XSSimpleTypeDefinition(const XSSimpleTypeDefinition&);
    00354     XSSimpleTypeDefinition & operator=(const XSSimpleTypeDefinition &);
    00355
    00359     void setFacetInfo
    00360     (
    00361         int                            definedFacets
    00362         , int                          fixedFacets
    00363         , XSFacetList* const           xsFacetList
    00364         , XSMultiValueFacetList* const xsMultiValueFacetList
    00365         , StringList* const            patternList
    00366     );
    00367     void setPrimitiveType(XSSimpleTypeDefinition*  const toSet);
    00368
    00369     friend class XSObjectFactory;
    00370
    00371 protected:
    00372
    00373     // -----------------------------------------------------------------------
    00374     //  data members
    00375     // -----------------------------------------------------------------------
    00376     int                         fDefinedFacets;
    00377     int                         fFixedFacets;
    00378     VARIETY                     fVariety;
    00379     DatatypeValidator*          fDatatypeValidator;
    00380     XSFacetList*                fXSFacetList;
    00381     XSMultiValueFacetList*      fXSMultiValueFacetList;
    00382     StringList*                 fPatternList;
    00383     XSSimpleTypeDefinition*     fPrimitiveOrItemType;
    00384     XSSimpleTypeDefinitionList* fMemberTypes;
    00385     XSAnnotationList*           fXSAnnotationList;
    00386 };
    00387
    00388 inline XSSimpleTypeDefinition::VARIETY XSSimpleTypeDefinition::getVariety() const
    00389 {
    00390     return fVariety;
    00391 }
    00392
    00393 inline XSSimpleTypeDefinition* XSSimpleTypeDefinition::getPrimitiveType()
    00394 {
    00395     if (fVariety == VARIETY_ATOMIC)
    00396         return fPrimitiveOrItemType;
    00397
    00398     return 0;
    00399 }
    00400
    00401 inline XSSimpleTypeDefinition* XSSimpleTypeDefinition::getItemType()
    00402 {
    00403     if (fVariety == VARIETY_LIST)
    00404         return fPrimitiveOrItemType;
    00405
    00406     return 0;
    00407 }
    00408
    00409 inline XSSimpleTypeDefinitionList* XSSimpleTypeDefinition::getMemberTypes() const
    00410 {
    00411     return fMemberTypes;
    00412 }
    00413
    00414 inline int XSSimpleTypeDefinition::getDefinedFacets() const
    00415 {
    00416     return fDefinedFacets;
    00417 }
    00418
    00419 inline int XSSimpleTypeDefinition::getFixedFacets() const
    00420 {
    00421     return fFixedFacets;
    00422 }
    00423
    00424 inline StringList* XSSimpleTypeDefinition::getLexicalPattern()
    00425 {
    00426     return fPatternList;
    00427 }
    00428
    00429 inline XSFacetList* XSSimpleTypeDefinition::getFacets()
    00430 {
    00431     return fXSFacetList;
    00432 }
    00433
    00434 inline XSMultiValueFacetList* XSSimpleTypeDefinition::getMultiValueFacets()
    00435 {
    00436     return fXSMultiValueFacetList;
    00437 }
    00438
    00439 inline XSAnnotationList *XSSimpleTypeDefinition::getAnnotations()
    00440 {
    00441     return fXSAnnotationList;
    00442 }
    00443
    00444 inline void
    00445 XSSimpleTypeDefinition::setPrimitiveType(XSSimpleTypeDefinition* const toSet)
    00446 {
    00447     fPrimitiveOrItemType = toSet;
    00448 }
    00449
    00450 inline DatatypeValidator*
    00451 XSSimpleTypeDefinition::getDatatypeValidator() const
    00452 {
    00453     return fDatatypeValidator;
    00454 }
    00455
    00456 XERCES_CPP_NAMESPACE_END
    00457
    00458 #endif