Qore Programming Language  0.8.9
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
QoreBigIntNode.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3  QoreBigIntNode.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_BIGINTNODE_H
25 
26 #define _QORE_BIGINTNODE_H
27 
28 #include <qore/AbstractQoreNode.h>
29 
30 class LocalVar;
31 
34 private:
36  DLLLOCAL virtual bool getAsBoolImpl() const;
37 
39  DLLLOCAL virtual int getAsIntImpl() const;
40 
42  DLLLOCAL virtual int64 getAsBigIntImpl() const;
43 
45  DLLLOCAL virtual double getAsFloatImpl() const;
46 
47 protected:
48  DLLEXPORT virtual ~QoreBigIntNode();
49 
50  // protected constructor for subclasses only
51  DLLEXPORT QoreBigIntNode(qore_type_t t, int64 v);
52 
53 public:
55  int64 val;
56 
58  DLLEXPORT QoreBigIntNode();
59 
61 
64  DLLEXPORT QoreBigIntNode(int64 v);
65 
67 
71  DLLEXPORT virtual QoreString *getStringRepresentation(bool &del) const;
72 
74 
77  DLLEXPORT virtual void getStringRepresentation(QoreString &str) const;
78 
80 
84  DLLEXPORT virtual DateTime *getDateTimeRepresentation(bool &del) const;
85 
87 
90  DLLEXPORT virtual void getDateTimeRepresentation(DateTime &dt) const;
91 
93 
99  DLLEXPORT virtual int getAsString(QoreString &str, int foff, ExceptionSink *xsink) const;
100 
102 
109  DLLEXPORT virtual QoreString *getAsString(bool &del, int foff, ExceptionSink *xsink) const;
110 
111  DLLEXPORT virtual AbstractQoreNode *realCopy() const;
112 
114 
118  DLLEXPORT virtual bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const;
119 
121 
125  DLLEXPORT virtual bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const;
126 
128  DLLEXPORT virtual const char *getTypeName() const;
129 
131  DLLEXPORT virtual AbstractQoreNode *parseInit(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo);
132 
134  DLLLOCAL static const char *getStaticTypeName() {
135  return "integer";
136  }
137 
139  DLLLOCAL static qore_type_t getStaticTypeCode() {
140  return NT_INT;
141  }
142 
144  DLLLOCAL static int64 getValue(AbstractQoreNode *v) {
145  return v->getAsBigInt();
146  }
147 };
148 
149 #endif
virtual DLLEXPORT bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality with the possibility of type conversion (soft compare)
virtual DLLEXPORT int getAsString(QoreString &str, int foff, ExceptionSink *xsink) const
concatenates the value of the integer to an existing QoreString
virtual DLLEXPORT DateTime * getDateTimeRepresentation(bool &del) const
returns the DateTime representation of this integer (interpreted as an offset in seconds from January...
static DLLLOCAL const char * getStaticTypeName()
returns the type code (useful in templates)
Definition: QoreBigIntNode.h:134
static DLLLOCAL int64 getValue(AbstractQoreNode *v)
returns the integer value (useful in templates)
Definition: QoreBigIntNode.h:144
virtual DLLEXPORT bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality without the possibility of type conversion (hard compare)
Holds absolute and relative date/time values in Qore with precision to the microsecond.
Definition: DateTime.h:85
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:47
virtual DLLEXPORT AbstractQoreNode * parseInit(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo)
returns the type information
DLLEXPORT int64 getAsBigInt() const
returns the 64-bit integer value of the object
signed short qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode) ...
Definition: common.h:59
Qore&#39;s string type supported by the QoreEncoding class.
Definition: QoreString.h:42
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
virtual DLLEXPORT QoreString * getStringRepresentation(bool &del) const
returns a string representing the integer and sets del to true
static DLLLOCAL qore_type_t getStaticTypeCode()
returns the type code (useful in templates)
Definition: QoreBigIntNode.h:139
DLLEXPORT QoreBigIntNode()
creates a new integer with the value 0
container for holding Qore-language exception information and also for registering a &quot;thread_exit&quot; ca...
Definition: ExceptionSink.h:35
const qore_type_t NT_INT
type value for QoreBigIntNode
Definition: node_types.h:35
virtual DLLEXPORT AbstractQoreNode * realCopy() const
returns a copy of the object; the caller owns the reference count
int64 val
value of the integer
Definition: QoreBigIntNode.h:55
base class for simple value types
Definition: AbstractQoreNode.h:417
this class implements Qore&#39;s 64-bit integer data type, reference-counted, dynamically-allocated only ...
Definition: QoreBigIntNode.h:33