SourceForge.net Logo

StaticType.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001-2008
00003  *     DecisionSoft Limited. All rights reserved.
00004  * Copyright (c) 2004-2008
00005  *     Oracle. All rights reserved.
00006  *
00007  * Licensed under the Apache License, Version 2.0 (the "License");
00008  * you may not use this file except in compliance with the License.
00009  * You may obtain a copy of the License at
00010  *
00011  *     http://www.apache.org/licenses/LICENSE-2.0
00012  *
00013  * Unless required by applicable law or agreed to in writing, software
00014  * distributed under the License is distributed on an "AS IS" BASIS,
00015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016  * See the License for the specific language governing permissions and
00017  * limitations under the License.
00018  *
00019  * $Id: StaticType.hpp 475 2008-01-08 18:47:44Z jpcs $
00020  */
00021 
00022 #ifndef _STATICTYPE_HPP
00023 #define _STATICTYPE_HPP
00024 
00025 #include <xqilla/framework/XQillaExport.hpp>
00026 #include <xqilla/items/AnyAtomicType.hpp>
00027 
00031 class XQILLA_API StaticType {
00032 public:
00036   enum StaticTypeFlags {
00037     DOCUMENT_TYPE            = 0x00000001,
00038     ELEMENT_TYPE             = 0x00000002,
00039     ATTRIBUTE_TYPE           = 0x00000004,
00040     TEXT_TYPE                = 0x00000008,
00041     PI_TYPE                  = 0x00000010,
00042     COMMENT_TYPE             = 0x00000020,
00043     NAMESPACE_TYPE           = 0x00000040,
00044 
00045     ANY_SIMPLE_TYPE          = 0x00000080,
00046     ANY_URI_TYPE             = 0x00000100,
00047     BASE_64_BINARY_TYPE      = 0x00000200,
00048     BOOLEAN_TYPE             = 0x00000400,
00049     DATE_TYPE                = 0x00000800,
00050     DATE_TIME_TYPE           = 0x00001000,
00051     DAY_TIME_DURATION_TYPE   = 0x00002000,
00052     DECIMAL_TYPE             = 0x00004000,
00053     DOUBLE_TYPE              = 0x00008000,
00054     DURATION_TYPE            = 0x00010000,
00055     FLOAT_TYPE               = 0x00020000,
00056     G_DAY_TYPE               = 0x00040000,
00057     G_MONTH_TYPE             = 0x00080000,
00058     G_MONTH_DAY_TYPE         = 0x00100000,
00059     G_YEAR_TYPE              = 0x00200000,
00060     G_YEAR_MONTH_TYPE        = 0x00400000,
00061     HEX_BINARY_TYPE          = 0x00800000,
00062     NOTATION_TYPE            = 0x01000000,
00063     QNAME_TYPE               = 0x02000000,
00064     STRING_TYPE              = 0x04000000,
00065     TIME_TYPE                = 0x08000000,
00066     UNTYPED_ATOMIC_TYPE      = 0x10000000,
00067     YEAR_MONTH_DURATION_TYPE = 0x20000000,
00068 
00069     NODE_TYPE                = (DOCUMENT_TYPE | ELEMENT_TYPE | ATTRIBUTE_TYPE | TEXT_TYPE | PI_TYPE | COMMENT_TYPE |
00070                                 NAMESPACE_TYPE),
00071 
00072     NUMERIC_TYPE             = (DECIMAL_TYPE | FLOAT_TYPE | DOUBLE_TYPE),
00073 
00074     TIMEZONE_TYPE            = (DATE_TYPE | DATE_TIME_TYPE | G_DAY_TYPE | G_MONTH_TYPE | G_MONTH_DAY_TYPE |
00075                                 G_YEAR_TYPE | G_YEAR_MONTH_TYPE | TIME_TYPE),
00076 
00077     TYPED_ATOMIC_TYPE        = (NUMERIC_TYPE | TIMEZONE_TYPE | ANY_SIMPLE_TYPE | ANY_URI_TYPE | BASE_64_BINARY_TYPE |
00078                                 BOOLEAN_TYPE | DAY_TIME_DURATION_TYPE | DURATION_TYPE | HEX_BINARY_TYPE |
00079                                 NOTATION_TYPE | QNAME_TYPE | STRING_TYPE | YEAR_MONTH_DURATION_TYPE),
00080 
00081     ANY_ATOMIC_TYPE          = (TYPED_ATOMIC_TYPE | UNTYPED_ATOMIC_TYPE),
00082 
00083     ITEM_TYPE                = (NODE_TYPE | ANY_ATOMIC_TYPE),
00084 
00085     EMPTY_TYPE               = 0
00086   };
00087 
00088   StaticType() : flags(0) {}
00089   StaticType(unsigned int f) : flags(f) {}
00090 
00091   static unsigned int getFlagsFor(const XMLCh *uri, const XMLCh *name, const StaticContext *context,
00092                                   bool &isExact);
00093   static unsigned int getFlagsFor(AnyAtomicType::AtomicObjectType primitiveType);
00094 
00095   void typeUnion(const StaticType &st);
00096   void typeIntersect(const StaticType &st);
00097 
00098   bool containsType(unsigned int type) const;
00099   bool isType(unsigned int type) const;
00100 
00101   unsigned int flags;
00102 };
00103 
00104 #endif

Generated on Mon Apr 28 16:40:48 2008 for XQilla Simple API by  doxygen 1.5.1