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: ATDecimalOrDerived.hpp 475 2008-01-08 18:47:44Z jpcs $ 00020 */ 00021 00022 #ifndef _ATDECIMALORDERIVED_HPP 00023 #define _ATDECIMALORDERIVED_HPP 00024 00025 #include <xercesc/util/XercesDefs.hpp> 00026 #include <xqilla/framework/XQillaExport.hpp> 00027 #include <xqilla/items/Numeric.hpp> 00028 00029 class DynamicContext; 00030 class MAPM; 00031 class XQILLA_API ATDecimalOrDerived : public Numeric 00032 { 00033 public: 00034 typedef RefCountPointer<const ATDecimalOrDerived> Ptr; 00035 00036 /* Get the name of the primitive type (basic type) of this type 00037 * (ie "decimal" for xs:decimal) */ 00038 virtual const XMLCh* getPrimitiveTypeName() const = 0; 00039 00040 /* Get the namespace URI for this type */ 00041 virtual const XMLCh* getTypeURI() const = 0; 00042 00043 /* Get the name of this type (ie "integer" for xs:integer) */ 00044 virtual const XMLCh* getTypeName() const = 0; 00045 00046 /* returns the XMLCh* (canonical) representation of this type */ 00047 virtual const XMLCh* asString(const DynamicContext* context) const = 0; 00048 00049 /* Promote this to the given type, if possible */ 00050 virtual Numeric::Ptr promoteTypeIfApplicable(AnyAtomicType::AtomicObjectType typeIndex, 00051 const DynamicContext* context) const = 0; 00052 00054 virtual Numeric::Ptr add(const Numeric::Ptr &other, const DynamicContext* context) const = 0; 00055 00058 virtual Numeric::Ptr subtract(const Numeric::Ptr &other, const DynamicContext* context) const = 0; 00059 00061 virtual Numeric::Ptr multiply(const Numeric::Ptr &other, const DynamicContext* context) const = 0; 00062 00064 virtual Numeric::Ptr divide(const Numeric::Ptr &other, const DynamicContext* context) const = 0; 00065 00067 virtual Numeric::Ptr mod(const Numeric::Ptr &other, const DynamicContext* context) const = 0; 00068 00070 virtual Numeric::Ptr floor(const DynamicContext* context) const = 0; 00071 00073 virtual Numeric::Ptr ceiling(const DynamicContext* context) const = 0; 00074 00076 virtual Numeric::Ptr round(const DynamicContext* context) const = 0; 00077 00079 virtual Numeric::Ptr roundHalfToEven(const Numeric::Ptr &precision, const DynamicContext* context) const = 0; 00080 00082 virtual Numeric::Ptr invert(const DynamicContext* context) const = 0; 00083 00085 virtual Numeric::Ptr abs(const DynamicContext* context) const = 0; 00086 00088 virtual bool isZero() const = 0; 00089 00091 virtual bool isNegative() const = 0; 00092 00094 virtual bool isPositive() const = 0; 00095 00096 /* Is this floating point value not a number? */ 00097 virtual bool isNaN() const { return false; } 00098 00099 /* Is this floating point value infinite? */ 00100 virtual bool isInfinite() const { return false; } 00101 00103 virtual XMLInt32 treatAsCodepoint(const DynamicContext* context) const = 0; 00104 00105 virtual AnyAtomicType::AtomicObjectType getPrimitiveTypeIndex() const = 0; 00106 00107 virtual const MAPM &asMAPM() const = 0; 00108 00109 virtual State getState() const = 0; 00110 }; 00111 00112 #endif // _ATDECIMALORDERIVED_HPP