24 #ifndef _QORE_QORENUMBERNODE_H
26 #define _QORE_QORENUMBERNODE_H
35 #define QORE_NF_DEFAULT 0
37 #define QORE_NF_SCIENTIFIC (1 << 0)
39 #define QORE_NF_RAW (1 << 1)
45 friend struct qore_number_private;
48 DLLLOCAL
virtual bool getAsBoolImpl()
const;
51 DLLLOCAL
virtual int getAsIntImpl()
const;
54 DLLLOCAL
virtual int64 getAsBigIntImpl()
const;
57 DLLLOCAL
virtual double getAsFloatImpl()
const;
61 struct qore_number_private*
priv;
199 DLLEXPORT
bool zero()
const;
202 DLLEXPORT
int sign()
const;
208 DLLEXPORT
int compare(int64 n)
const;
211 DLLEXPORT
int compare(
double n)
const;
223 DLLEXPORT
unsigned getPrec()
const;
virtual DLLEXPORT class DateTime * getDateTimeRepresentation(bool &del) const
returns the DateTime representation of this value and sets del to true
Qore's arbitrary-precision number value type, dynamically-allocated only, reference counted...
Definition: QoreNumberNode.h:44
DLLEXPORT void toString(QoreString &str, int fmt=QORE_NF_DEFAULT) const
concatenates the string value corresponding to the number to the string given
virtual DLLEXPORT QoreString * getStringRepresentation(bool &del) const
returns the number value converted to a string and sets del to true
static DLLEXPORT QoreNumberNode * toNumber(const AbstractQoreNode *v)
returns the representation of the value as a number if possible (otherwise returns 0)...
Holds absolute and relative date/time values in Qore with precision to the microsecond.
Definition: DateTime.h:85
DLLEXPORT unsigned getPrec() const
returns the precision of the number
DLLEXPORT QoreNumberNode * negate() const
returns the negative of the current object (this)
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:47
static DLLLOCAL const char * getStaticTypeName()
returns the type name (useful in templates)
Definition: QoreNumberNode.h:235
DLLEXPORT QoreNumberNode * doPlus(const QoreNumberNode &n) const
add the argument to this value and return the result
signed short qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode) ...
Definition: common.h:59
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:42
DLLEXPORT QoreNumberNode * doDivideBy(const QoreNumberNode &n, ExceptionSink *xsink) const
add the argument to this value and return the result
struct qore_number_private * priv
the private implementation of the type
Definition: QoreNumberNode.h:61
DLLEXPORT QoreNumberNode()
creates a new numbering-point value and assigns it to 0
virtual DLLLOCAL AbstractQoreNode * parseInit(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo)
returns the type information
static DLLLOCAL qore_type_t getStaticTypeCode()
returns the type code (useful in templates)
Definition: QoreNumberNode.h:240
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:35
virtual DLLEXPORT int getAsString(QoreString &str, int foff, class ExceptionSink *xsink) const
concatenate the string representation of the number value to an existing QoreString ...
DLLEXPORT QoreNumberNode * numberRefSelf() const
returns a pointer to this with the reference count incremented
DLLEXPORT QoreNumberNode * doMinus(const QoreNumberNode &n) const
add the argument to this value and return the result
virtual DLLEXPORT AbstractQoreNode * realCopy() const
returns a copy of the object; the caller owns the reference count
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
virtual DLLEXPORT ~QoreNumberNode()
the destructor is protected because it should not be called directly
base class for simple value types
Definition: AbstractQoreNode.h:417
const qore_type_t NT_NUMBER
type value for QoreNumberNode
Definition: node_types.h:45
DLLEXPORT QoreNumberNode * doMultiply(const QoreNumberNode &n) const
add the argument to this value and return the result
DLLEXPORT int sign() const
returns -1 if the number is negative, 0 if zero, or 1 if the number is positive
virtual DLLEXPORT bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality without type conversions (hard compare)
DLLEXPORT int compare(const QoreNumberNode &n) const
compares the argument to the current object, returns -1 if the current object is less than the argume...
DLLEXPORT bool zero() const
returns true if the number is zero
virtual DLLEXPORT bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality with possible type conversion (soft compare)