SourceForge.net Logo
ATDecimalOrDerived.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001-2008
3  * DecisionSoft Limited. All rights reserved.
4  * Copyright (c) 2004-2008
5  * Oracle. All rights reserved.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  * $Id$
20  */
21 
22 #ifndef _ATDECIMALORDERIVED_HPP
23 #define _ATDECIMALORDERIVED_HPP
24 
25 #include <xercesc/util/XercesDefs.hpp>
26 #include <xqilla/framework/XQillaExport.hpp>
27 #include <xqilla/items/Numeric.hpp>
28 
29 class DynamicContext;
30 class MAPM;
31 class XQILLA_API ATDecimalOrDerived : public Numeric
32 {
33 public:
35 
36  /* Get the name of the primitive type (basic type) of this type
37  * (ie "decimal" for xs:decimal) */
38  virtual const XMLCh* getPrimitiveTypeName() const = 0;
39 
40  /* Get the namespace URI for this type */
41  virtual const XMLCh* getTypeURI() const = 0;
42 
43  /* Get the name of this type (ie "integer" for xs:integer) */
44  virtual const XMLCh* getTypeName() const = 0;
45 
46  /* returns the XMLCh* (canonical) representation of this type */
47  virtual const XMLCh* asString(const DynamicContext* context) const = 0;
48 
49  /* Promote this to the given type, if possible */
51  const DynamicContext* context) const = 0;
52 
54  virtual Numeric::Ptr add(const Numeric::Ptr &other, const DynamicContext* context) const = 0;
55 
58  virtual Numeric::Ptr subtract(const Numeric::Ptr &other, const DynamicContext* context) const = 0;
59 
61  virtual Numeric::Ptr multiply(const Numeric::Ptr &other, const DynamicContext* context) const = 0;
62 
64  virtual Numeric::Ptr divide(const Numeric::Ptr &other, const DynamicContext* context) const = 0;
65 
67  virtual Numeric::Ptr mod(const Numeric::Ptr &other, const DynamicContext* context) const = 0;
68 
70  virtual Numeric::Ptr floor(const DynamicContext* context) const = 0;
71 
73  virtual Numeric::Ptr ceiling(const DynamicContext* context) const = 0;
74 
76  virtual Numeric::Ptr round(const DynamicContext* context) const = 0;
77 
79  virtual Numeric::Ptr roundHalfToEven(const Numeric::Ptr &precision, const DynamicContext* context) const = 0;
80 
82  virtual Numeric::Ptr invert(const DynamicContext* context) const = 0;
83 
85  virtual Numeric::Ptr abs(const DynamicContext* context) const = 0;
86 
88  virtual bool isZero() const = 0;
89 
91  virtual bool isNegative() const = 0;
92 
94  virtual bool isPositive() const = 0;
95 
96  /* Is this floating point value not a number? */
97  virtual bool isNaN() const { return false; }
98 
99  /* Is this floating point value infinite? */
100  virtual bool isInfinite() const { return false; }
101 
103  virtual XMLInt32 treatAsCodepoint(const DynamicContext* context) const = 0;
104 
106 
107  virtual const MAPM &asMAPM() const = 0;
108 
109  virtual State getState() const = 0;
110 };
111 
112 #endif // _ATDECIMALORDERIVED_HPP
virtual Numeric::Ptr invert(const DynamicContext *context) const =0
Returns the Additive inverse of this Numeric.
virtual const XMLCh * getTypeName() const =0
virtual State getState() const =0
virtual Numeric::Ptr ceiling(const DynamicContext *context) const =0
Returns the ceiling of this Numeric.
virtual Numeric::Ptr add(const Numeric::Ptr &other, const DynamicContext *context) const =0
Returns a Numeric object which is the sum of this and other.
Super class of all the reference counted wrappers for Items.
Definition: ReferenceCounted.hpp:58
virtual bool isPositive() const =0
Is this Numeric positive?
virtual bool isInfinite() const
Definition: ATDecimalOrDerived.hpp:100
Definition: Numeric.hpp:33
virtual Numeric::Ptr round(const DynamicContext *context) const =0
Rounds this Numeric.
AtomicObjectType
Definition: AnyAtomicType.hpp:36
virtual Numeric::Ptr divide(const Numeric::Ptr &other, const DynamicContext *context) const =0
Returns a Numeric object which is the quotient of this and other.
virtual AnyAtomicType::AtomicObjectType getPrimitiveTypeIndex() const =0
virtual bool isZero() const =0
Does this Numeric have value 0?
virtual Numeric::Ptr subtract(const Numeric::Ptr &other, const DynamicContext *context) const =0
Returns a Numeric object which is the difference of this and other.
virtual const XMLCh * asString(const DynamicContext *context) const =0
virtual const XMLCh * getPrimitiveTypeName() const =0
virtual const XMLCh * getTypeURI() const =0
The execution time dynamic context interface.
Definition: DynamicContext.hpp:39
RefCountPointer< const ATDecimalOrDerived > Ptr
Definition: ATDecimalOrDerived.hpp:34
virtual Numeric::Ptr mod(const Numeric::Ptr &other, const DynamicContext *context) const =0
Returns the arithmetic product of its operands as a Numeric.
virtual bool isNegative() const =0
Is this Numeric negative?
virtual Numeric::Ptr roundHalfToEven(const Numeric::Ptr &precision, const DynamicContext *context) const =0
Rounds this Numeric to the given precision, and rounds a half to even.
virtual Numeric::Ptr floor(const DynamicContext *context) const =0
Returns the floor of this Numeric.
virtual Numeric::Ptr promoteTypeIfApplicable(AnyAtomicType::AtomicObjectType typeIndex, const DynamicContext *context) const =0
virtual bool isNaN() const
Definition: ATDecimalOrDerived.hpp:97
Definition: ATDecimalOrDerived.hpp:31
virtual Numeric::Ptr multiply(const Numeric::Ptr &other, const DynamicContext *context) const =0
Returns a Numeric object which is the product of this and other.
virtual const MAPM & asMAPM() const =0