All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
QoreFloatNode.h
/* -*- mode: c++; indent-tabs-mode: nil -*- */
/*
QoreFloatNode.h
Qore Programming Language
Copyright 2003 - 2013 David Nichols
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _QORE_QOREFLOATNODE_H
#define _QORE_QOREFLOATNODE_H
class LocalVar;
class QoreTypeInfo;
class QoreFloatNode : public SimpleValueQoreNode {
private:
DLLLOCAL virtual bool getAsBoolImpl() const;
DLLLOCAL virtual int getAsIntImpl() const;
DLLLOCAL virtual int64 getAsBigIntImpl() const;
DLLLOCAL virtual double getAsFloatImpl() const;
protected:
DLLEXPORT virtual ~QoreFloatNode();
public:
double f;
DLLEXPORT QoreFloatNode(double n_f);
DLLEXPORT QoreFloatNode();
DLLEXPORT virtual QoreString *getStringRepresentation(bool &del) const;
DLLEXPORT virtual void getStringRepresentation(QoreString &str) const;
DLLEXPORT virtual class DateTime *getDateTimeRepresentation(bool &del) const;
DLLEXPORT virtual void getDateTimeRepresentation(DateTime &dt) const;
DLLEXPORT virtual int getAsString(QoreString &str, int foff, class ExceptionSink *xsink) const;
DLLEXPORT virtual QoreString *getAsString(bool &del, int foff, class ExceptionSink *xsink) const;
DLLEXPORT virtual class AbstractQoreNode *realCopy() const;
DLLEXPORT virtual bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const;
DLLEXPORT virtual bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const;
DLLEXPORT virtual const char *getTypeName() const;
DLLLOCAL virtual AbstractQoreNode *parseInit(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo);
DLLLOCAL static const char *getStaticTypeName() {
return "float";
}
DLLLOCAL static qore_type_t getStaticTypeCode() {
return NT_FLOAT;
}
DLLLOCAL static double getValue(AbstractQoreNode *v) {
return v->getAsFloat();
}
};
#endif
QoreFloatNode::getDateTimeRepresentation
virtual DLLEXPORT class DateTime * getDateTimeRepresentation(bool &del) const
returns the DateTime representation of this value and sets del to true
QoreFloatNode::~QoreFloatNode
virtual DLLEXPORT ~QoreFloatNode()
the destructor is protected because it should not be called directly
QoreFloatNode::getAsString
virtual DLLEXPORT int getAsString(QoreString &str, int foff, class ExceptionSink *xsink) const
concatenate the string representation of the floating-point value to an existing QoreString ...
QoreFloatNode::QoreFloatNode
DLLEXPORT QoreFloatNode()
creates a new floating-point value and assigns 0.0 to it
QoreFloatNode::getValue
static DLLLOCAL double getValue(AbstractQoreNode *v)
returns the value of the argument (useful in templates)
Definition: QoreFloatNode.h:159
QoreFloatNode
Qore&#39;s floating-point value type, dynamically-allocated only, reference counted.
Definition: QoreFloatNode.h:32
QoreFloatNode::getTypeName
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
QoreFloatNode::f
double f
the value of the type
Definition: QoreFloatNode.h:55
AbstractQoreNode::getAsFloat
DLLEXPORT double getAsFloat() const
returns the float value of the object
DateTime
Holds absolute and relative date/time values in Qore with precision to the microsecond.
Definition: DateTime.h:85
QoreFloatNode::getStaticTypeCode
static DLLLOCAL qore_type_t getStaticTypeCode()
returns the type code (useful in templates)
Definition: QoreFloatNode.h:154
AbstractQoreNode
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:47
QoreFloatNode::is_equal_hard
virtual DLLEXPORT bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality without type conversions (hard compare)
qore_type_t
signed short qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode) ...
Definition: common.h:59
QoreFloatNode::parseInit
virtual DLLLOCAL AbstractQoreNode * parseInit(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo)
returns the type information
QoreString
Qore&#39;s string type supported by the QoreEncoding class.
Definition: QoreString.h:42
QoreFloatNode::getStaticTypeName
static DLLLOCAL const char * getStaticTypeName()
returns the type name (useful in templates)
Definition: QoreFloatNode.h:149
QoreFloatNode::realCopy
virtual DLLEXPORT class AbstractQoreNode * realCopy() const
returns a copy of the object; the caller owns the reference count
ExceptionSink
container for holding Qore-language exception information and also for registering a &quot;thread_exit&quot; ca...
Definition: ExceptionSink.h:35
NT_FLOAT
const qore_type_t NT_FLOAT
type value for QoreFloatNode
Definition: node_types.h:36
SimpleValueQoreNode
base class for simple value types
Definition: AbstractQoreNode.h:417
QoreFloatNode::is_equal_soft
virtual DLLEXPORT bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality with possible type conversion (soft compare)
QoreFloatNode::getStringRepresentation
virtual DLLEXPORT QoreString * getStringRepresentation(bool &del) const
returns the floating-point value converted to a string and sets del to true