# ATDecimalOrDerived.hpp

Go to the documentation of this file.

    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.11 2006/11/01 16:37:14 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(const XMLCh* typeURI, const XMLCh* typeName, const DynamicContext* context) const = 0;
    00043
    00045   virtual Numeric::Ptr add(const Numeric::Ptr &other, const DynamicContext* context) const = 0;
    00046
    00049   virtual Numeric::Ptr subtract(const Numeric::Ptr &other, const DynamicContext* context) const = 0;
    00050
    00052   virtual Numeric::Ptr multiply(const Numeric::Ptr &other, const DynamicContext* context) const = 0;
    00053
    00055   virtual Numeric::Ptr divide(const Numeric::Ptr &other, const DynamicContext* context) const = 0;
    00056
    00058   virtual Numeric::Ptr mod(const Numeric::Ptr &other, const DynamicContext* context) const = 0;
    00059
    00061   virtual Numeric::Ptr floor(const DynamicContext* context) const = 0;
    00062
    00064   virtual Numeric::Ptr ceiling(const DynamicContext* context) const = 0;
    00065
    00067   virtual Numeric::Ptr round(const DynamicContext* context) const = 0;
    00068
    00070   virtual Numeric::Ptr roundHalfToEven(const Numeric::Ptr &precision, const DynamicContext* context) const = 0;
    00071
    00073   virtual Numeric::Ptr invert(const DynamicContext* context) const = 0;
    00074
    00076   virtual Numeric::Ptr abs(const DynamicContext* context) const = 0;
    00077
    00079   virtual bool isZero() const = 0;
    00080
    00082   virtual bool isNegative() const = 0;
    00083
    00085   virtual bool isPositive() const = 0;
    00086
    00087   /* Is this floating point value not a number? */
    00088   virtual bool isNaN() const { return false; }
    00089
    00090   /* Is this floating point value infinite? */
    00091   virtual bool isInfinite() const { return false; }
    00092
    00094   virtual XMLInt32 treatAsCodepoint(const DynamicContext* context) const = 0;
    00095
    00096   virtual AnyAtomicType::AtomicObjectType getPrimitiveTypeIndex() const = 0;
    00097
    00098   virtual const MAPM &asMAPM() const = 0;
    00099
    00100   virtual State getState() const = 0;
    00101 };
    00102
    00103 #endif //  _ATDECIMALORDERIVED_HPP