Qore Programming Language  0.8.11
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
QoreFloatNode.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3  QoreFloatNode.h
4 
5  Qore Programming Language
6 
7  Copyright 2003 - 2013 David Nichols
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23 
24 #ifndef _QORE_QOREFLOATNODE_H
25 
26 #define _QORE_QOREFLOATNODE_H
27 
28 class LocalVar;
29 class QoreTypeInfo;
30 
33 private:
35  DLLLOCAL virtual bool getAsBoolImpl() const;
36 
38  DLLLOCAL virtual int getAsIntImpl() const;
39 
41  DLLLOCAL virtual int64 getAsBigIntImpl() const;
42 
44  DLLLOCAL virtual double getAsFloatImpl() const;
45 
46 protected:
48 
51  DLLEXPORT virtual ~QoreFloatNode();
52 
53 public:
55  double f;
56 
58 
61  DLLEXPORT QoreFloatNode(double n_f);
62 
64  DLLEXPORT QoreFloatNode();
65 
67 
72  DLLEXPORT virtual QoreString *getStringRepresentation(bool &del) const;
73 
75 
78  DLLEXPORT virtual void getStringRepresentation(QoreString &str) const;
79 
81 
87  DLLEXPORT virtual class DateTime *getDateTimeRepresentation(bool &del) const;
88 
90 
94  DLLEXPORT virtual void getDateTimeRepresentation(DateTime &dt) const;
95 
97 
103  DLLEXPORT virtual int getAsString(QoreString &str, int foff, class ExceptionSink *xsink) const;
104 
106 
112  DLLEXPORT virtual QoreString *getAsString(bool &del, int foff, class ExceptionSink *xsink) const;
113 
115 
118  DLLEXPORT virtual class AbstractQoreNode *realCopy() const;
119 
121 
126  DLLEXPORT virtual bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const;
127 
129 
134  DLLEXPORT virtual bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const;
135 
137 
140  DLLEXPORT virtual const char *getTypeName() const;
141 
143  DLLLOCAL virtual AbstractQoreNode *parseInit(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo);
144 
146 
149  DLLLOCAL static const char *getStaticTypeName() {
150  return "float";
151  }
152 
154  DLLLOCAL static qore_type_t getStaticTypeCode() {
155  return NT_FLOAT;
156  }
157 
159  DLLLOCAL static double getValue(AbstractQoreNode *v) {
160  return v->getAsFloat();
161  }
162 };
163 
164 #endif
virtual DLLEXPORT class DateTime * getDateTimeRepresentation(bool &del) const
returns the DateTime representation of this value and sets del to true
virtual DLLEXPORT ~QoreFloatNode()
the destructor is protected because it should not be called directly
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 ...
DLLEXPORT QoreFloatNode()
creates a new floating-point value and assigns 0.0 to it
static DLLLOCAL double getValue(AbstractQoreNode *v)
returns the value of the argument (useful in templates)
Definition: QoreFloatNode.h:159
Qore's floating-point value type, dynamically-allocated only, reference counted.
Definition: QoreFloatNode.h:32
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
double f
the value of the type
Definition: QoreFloatNode.h:55
DLLEXPORT double getAsFloat() const
returns the float value of the object
Holds absolute and relative date/time values in Qore with precision to the microsecond.
Definition: DateTime.h:85
static DLLLOCAL qore_type_t getStaticTypeCode()
returns the type code (useful in templates)
Definition: QoreFloatNode.h:154
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:47
virtual DLLEXPORT bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality without type conversions (hard compare)
signed short qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode) ...
Definition: common.h:59
virtual DLLLOCAL AbstractQoreNode * parseInit(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo)
returns the type information
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:42
static DLLLOCAL const char * getStaticTypeName()
returns the type name (useful in templates)
Definition: QoreFloatNode.h:149
virtual DLLEXPORT class AbstractQoreNode * realCopy() const
returns a copy of the object; the caller owns the reference count
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:35
const qore_type_t NT_FLOAT
type value for QoreFloatNode
Definition: node_types.h:36
base class for simple value types
Definition: AbstractQoreNode.h:417
virtual DLLEXPORT bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality with possible type conversion (soft compare)
virtual DLLEXPORT QoreString * getStringRepresentation(bool &del) const
returns the floating-point value converted to a string and sets del to true