Qore Programming Language  0.8.7
 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