00001 /* 00002 * Copyright (c) 2001-2006 00003 * DecisionSoft Limited. All rights reserved. 00004 * Copyright (c) 2004-2006 00005 * Progress Software Corporation. All rights reserved. 00006 * Copyright (c) 2004-2006 00007 * Oracle. All rights reserved. 00008 * 00009 * See the file LICENSE for redistribution information. 00010 * 00011 * $Id: ATDecimalOrDerived.hpp,v 1.12 2007/02/07 12:13:10 jpcs Exp $ 00012 */ 00013 00014 #ifndef _ATDECIMALORDERIVED_HPP 00015 #define _ATDECIMALORDERIVED_HPP 00016 00017 #include <xercesc/util/XercesDefs.hpp> 00018 #include <xqilla/framework/XQillaExport.hpp> 00019 #include <xqilla/items/Numeric.hpp> 00020 00021 class DynamicContext; 00022 class MAPM; 00023 class XQILLA_API ATDecimalOrDerived : public Numeric 00024 { 00025 public: 00026 typedef RefCountPointer<const ATDecimalOrDerived> Ptr; 00027 00028 /* Get the name of the primitive type (basic type) of this type 00029 * (ie "decimal" for xs:decimal) */ 00030 virtual const XMLCh* getPrimitiveTypeName() const = 0; 00031 00032 /* Get the namespace URI for this type */ 00033 virtual const XMLCh* getTypeURI() const = 0; 00034 00035 /* Get the name of this type (ie "integer" for xs:integer) */ 00036 virtual const XMLCh* getTypeName() const = 0; 00037 00038 /* returns the XMLCh* (canonical) representation of this type */ 00039 virtual const XMLCh* asString(const DynamicContext* context) const = 0; 00040 00041 /* Promote this to the given type, if possible */ 00042 virtual Numeric::Ptr promoteTypeIfApplicable(AnyAtomicType::AtomicObjectType typeIndex, 00043 const DynamicContext* context) const = 0; 00044 00046 virtual Numeric::Ptr add(const Numeric::Ptr &other, const DynamicContext* context) const = 0; 00047 00050 virtual Numeric::Ptr subtract(const Numeric::Ptr &other, const DynamicContext* context) const = 0; 00051 00053 virtual Numeric::Ptr multiply(const Numeric::Ptr &other, const DynamicContext* context) const = 0; 00054 00056 virtual Numeric::Ptr divide(const Numeric::Ptr &other, const DynamicContext* context) const = 0; 00057 00059 virtual Numeric::Ptr mod(const Numeric::Ptr &other, const DynamicContext* context) const = 0; 00060 00062 virtual Numeric::Ptr floor(const DynamicContext* context) const = 0; 00063 00065 virtual Numeric::Ptr ceiling(const DynamicContext* context) const = 0; 00066 00068 virtual Numeric::Ptr round(const DynamicContext* context) const = 0; 00069 00071 virtual Numeric::Ptr roundHalfToEven(const Numeric::Ptr &precision, const DynamicContext* context) const = 0; 00072 00074 virtual Numeric::Ptr invert(const DynamicContext* context) const = 0; 00075 00077 virtual Numeric::Ptr abs(const DynamicContext* context) const = 0; 00078 00080 virtual bool isZero() const = 0; 00081 00083 virtual bool isNegative() const = 0; 00084 00086 virtual bool isPositive() const = 0; 00087 00088 /* Is this floating point value not a number? */ 00089 virtual bool isNaN() const { return false; } 00090 00091 /* Is this floating point value infinite? */ 00092 virtual bool isInfinite() const { return false; } 00093 00095 virtual XMLInt32 treatAsCodepoint(const DynamicContext* context) const = 0; 00096 00097 virtual AnyAtomicType::AtomicObjectType getPrimitiveTypeIndex() const = 0; 00098 00099 virtual const MAPM &asMAPM() const = 0; 00100 00101 virtual State getState() const = 0; 00102 }; 00103 00104 #endif // _ATDECIMALORDERIVED_HPP