Qore Programming Language - C/C++ Library  0.8.13.5
 All Classes Namespaces 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 (C) 2003 - 2017 Qore Technologies, s.r.o.
8 
9  Permission is hereby granted, free of charge, to any person obtaining a
10  copy of this software and associated documentation files (the "Software"),
11  to deal in the Software without restriction, including without limitation
12  the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  and/or sell copies of the Software, and to permit persons to whom the
14  Software is furnished to do so, subject to the following conditions:
15 
16  The above copyright notice and this permission notice shall be included in
17  all copies or substantial portions of the Software.
18 
19  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25  DEALINGS IN THE SOFTWARE.
26 
27  Note that the Qore library is released under a choice of three open-source
28  licenses: MIT (as above), LGPL 2+, or GPL 2+; see README-LICENSE for more
29  information.
30 */
31 
32 #ifndef _QORE_QOREFLOATNODE_H
33 
34 #define _QORE_QOREFLOATNODE_H
35 
36 class LocalVar;
37 
40 private:
42  DLLLOCAL virtual bool getAsBoolImpl() const;
43 
45  DLLLOCAL virtual int getAsIntImpl() const;
46 
48  DLLLOCAL virtual int64 getAsBigIntImpl() const;
49 
51  DLLLOCAL virtual double getAsFloatImpl() const;
52 
53 protected:
55 
58  DLLEXPORT virtual ~QoreFloatNode();
59 
60 public:
62  double f;
63 
65 
68  DLLEXPORT QoreFloatNode(double n_f);
69 
71  DLLEXPORT QoreFloatNode();
72 
74 
79  DLLEXPORT virtual QoreString *getStringRepresentation(bool &del) const;
80 
82 
85  DLLEXPORT virtual void getStringRepresentation(QoreString &str) const;
86 
88 
94  DLLEXPORT virtual class DateTime *getDateTimeRepresentation(bool &del) const;
95 
97 
101  DLLEXPORT virtual void getDateTimeRepresentation(DateTime &dt) const;
102 
104 
110  DLLEXPORT virtual int getAsString(QoreString &str, int foff, class ExceptionSink *xsink) const;
111 
113 
119  DLLEXPORT virtual QoreString *getAsString(bool &del, int foff, class ExceptionSink *xsink) const;
120 
122 
125  DLLEXPORT virtual class AbstractQoreNode *realCopy() const;
126 
128 
133  DLLEXPORT virtual bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const;
134 
136 
141  DLLEXPORT virtual bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const;
142 
144 
147  DLLEXPORT virtual const char *getTypeName() const;
148 
150  DLLLOCAL virtual AbstractQoreNode *parseInit(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo);
151 
153 
156  DLLLOCAL static const char *getStaticTypeName() {
157  return "float";
158  }
159 
161  DLLLOCAL static qore_type_t getStaticTypeCode() {
162  return NT_FLOAT;
163  }
164 
165  static const qore_type_t TYPE = NT_FLOAT;
166 
168  DLLLOCAL static double getValue(AbstractQoreNode *v) {
169  return v->getAsFloat();
170  }
171 };
172 
173 #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:168
Qore's floating-point value type, dynamically-allocated only, reference counted.
Definition: QoreFloatNode.h:39
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
double f
the value of the type
Definition: QoreFloatNode.h:62
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:93
static DLLLOCAL qore_type_t getStaticTypeCode()
returns the type code (useful in templates)
Definition: QoreFloatNode.h:161
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:54
virtual DLLEXPORT bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality without type conversions (hard compare)
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:82
static DLLLOCAL const char * getStaticTypeName()
returns the type name (useful in templates)
Definition: QoreFloatNode.h:156
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:47
const qore_type_t NT_FLOAT
type value for QoreFloatNode
Definition: node_types.h:44
long long int64
64bit integer type, cannot use int64_t here since it breaks the API on some 64-bit systems due to equ...
Definition: common.h:241
int16_t qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode) ...
Definition: common.h:71
base class for simple value types
Definition: AbstractQoreNode.h:434
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