All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
QoreBigIntNode.h
/* -*- mode: c++; indent-tabs-mode: nil -*- */
/*
QoreBigIntNode.h
Qore Programming Language
Copyright (C) 2003 - 2015 David Nichols
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
Note that the Qore library is released under a choice of three open-source
licenses: MIT (as above), LGPL 2+, or GPL 2+; see README-LICENSE for more
information.
*/
#ifndef _QORE_BIGINTNODE_H
#define _QORE_BIGINTNODE_H
#include <qore/AbstractQoreNode.h>
class LocalVar;
class QoreBigIntNode : 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 ~QoreBigIntNode();
// protected constructor for subclasses only
DLLEXPORT QoreBigIntNode(qore_type_t t, int64 v);
public:
int64 val;
DLLEXPORT QoreBigIntNode();
DLLEXPORT QoreBigIntNode(int64 v);
DLLEXPORT virtual QoreString *getStringRepresentation(bool &del) const;
DLLEXPORT virtual void getStringRepresentation(QoreString &str) const;
DLLEXPORT virtual DateTime *getDateTimeRepresentation(bool &del) const;
DLLEXPORT virtual void getDateTimeRepresentation(DateTime &dt) const;
DLLEXPORT virtual int getAsString(QoreString &str, int foff, ExceptionSink *xsink) const;
DLLEXPORT virtual QoreString *getAsString(bool &del, int foff, ExceptionSink *xsink) const;
DLLEXPORT virtual 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;
DLLEXPORT virtual AbstractQoreNode *parseInit(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo);
DLLLOCAL static const char *getStaticTypeName() {
return "integer";
}
DLLLOCAL static qore_type_t getStaticTypeCode() {
return NT_INT;
}
static const qore_type_t TYPE = NT_INT;
DLLLOCAL static int64 getValue(AbstractQoreNode *v) {
return v->getAsBigInt();
}
};
#endif
QoreBigIntNode::is_equal_soft
virtual DLLEXPORT bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality with the possibility of type conversion (soft compare)
QoreBigIntNode::getAsString
virtual DLLEXPORT int getAsString(QoreString &str, int foff, ExceptionSink *xsink) const
concatenates the value of the integer to an existing QoreString
QoreBigIntNode::getDateTimeRepresentation
virtual DLLEXPORT DateTime * getDateTimeRepresentation(bool &del) const
returns the DateTime representation of this integer (interpreted as an offset in seconds from January...
QoreBigIntNode::getStaticTypeName
static DLLLOCAL const char * getStaticTypeName()
returns the type code (useful in templates)
Definition: QoreBigIntNode.h:142
QoreBigIntNode::getValue
static DLLLOCAL int64 getValue(AbstractQoreNode *v)
returns the integer value (useful in templates)
Definition: QoreBigIntNode.h:154
QoreBigIntNode::is_equal_hard
virtual DLLEXPORT bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality without the possibility of type conversion (hard compare)
DateTime
Holds absolute and relative date/time values in Qore with precision to the microsecond.
Definition: DateTime.h:93
AbstractQoreNode
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:55
QoreBigIntNode::parseInit
virtual DLLEXPORT AbstractQoreNode * parseInit(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo)
returns the type information
AbstractQoreNode::getAsBigInt
DLLEXPORT int64 getAsBigInt() const
returns the 64-bit integer value of the object
QoreString
Qore&#39;s string type supported by the QoreEncoding class.
Definition: QoreString.h:82
QoreBigIntNode::getTypeName
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
QoreBigIntNode::getStringRepresentation
virtual DLLEXPORT QoreString * getStringRepresentation(bool &del) const
returns a string representing the integer and sets del to true
QoreBigIntNode::getStaticTypeCode
static DLLLOCAL qore_type_t getStaticTypeCode()
returns the type code (useful in templates)
Definition: QoreBigIntNode.h:147
QoreBigIntNode::QoreBigIntNode
DLLEXPORT QoreBigIntNode()
creates a new integer with the value 0
ExceptionSink
container for holding Qore-language exception information and also for registering a &quot;thread_exit&quot; ca...
Definition: ExceptionSink.h:43
NT_INT
const qore_type_t NT_INT
type value for QoreBigIntNode
Definition: node_types.h:43
QoreBigIntNode::realCopy
virtual DLLEXPORT AbstractQoreNode * realCopy() const
returns a copy of the object; the caller owns the reference count
int64
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:228
qore_type_t
int16_t qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode) ...
Definition: common.h:68
QoreBigIntNode::val
int64 val
value of the integer
Definition: QoreBigIntNode.h:63
SimpleValueQoreNode
base class for simple value types
Definition: AbstractQoreNode.h:435
QoreBigIntNode
this class implements Qore&#39;s 64-bit integer data type, reference-counted, dynamically-allocated only ...
Definition: QoreBigIntNode.h:41