Qore Programming Language 0.8.8

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
QoreNullNode.h
Go to the documentation of this file.
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3 QoreNullNode.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_QORENULLNODE_H
25
26 #define _QORE_QORENULLNODE_H
27
28 #include <qore/AbstractQoreNode.h>
29
34
42 class QoreNullNode : public UniqueValueQoreNode {
43 private:
45 DLLLOCAL virtual bool getAsBoolImpl() const;
46
48 DLLLOCAL virtual int getAsIntImpl() const;
49
51 DLLLOCAL virtual int64 getAsBigIntImpl() const;
52
54 DLLLOCAL virtual double getAsFloatImpl() const;
55
56 protected:
58
60 using SimpleValueQoreNode::evalImpl;
61 DLLLOCAL AbstractQoreNode *evalImpl(class ExceptionSink *xsink) const;
62
63 public:
64 DLLEXPORT QoreNullNode();
65
66 DLLEXPORT virtual ~QoreNullNode();
67
69
75 DLLEXPORT virtual int getAsString(QoreString &str, int foff, class ExceptionSink *xsink) const;
76
78
85 DLLEXPORT virtual QoreString *getAsString(bool &del, int foff, class ExceptionSink *xsink) const;
86
88
92 DLLEXPORT virtual bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const;
93
95
99 DLLEXPORT virtual bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const;
100
102 DLLEXPORT virtual const char *getTypeName() const;
103
105 DLLLOCAL virtual AbstractQoreNode *parseInit(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo);
106
108 DLLLOCAL static const char *getStaticTypeName() {
109 return "NULL";
110 }
111
113 DLLLOCAL static qore_type_t getStaticTypeCode() {
114 return NT_NULL;
115 }
116 };
117
119 static inline bool is_null(const AbstractQoreNode *n)
120 {
121 // this is faster than a dynamic_cast<const QoreNullNode *> operation
122 return n && n->getType() == NT_NULL;
123 }
124
126 DLLEXPORT extern QoreNullNode Null;
127
129 static inline QoreNullNode *null()
130 {
131 return &Null;
132 }
133
134 #endif
QoreNullNode::is_equal_hard
virtual DLLEXPORT bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality without type conversions (hard compare)
QoreNullNode::is_equal_soft
virtual DLLEXPORT bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality with possible type conversion (soft compare)
QoreNullNode::getTypeName
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
QoreNullNode::getStaticTypeCode
static DLLLOCAL qore_type_t getStaticTypeCode()
returns the type code (useful in templates)
Definition: QoreNullNode.h:113
QoreNullNode::evalImpl
DLLLOCAL AbstractQoreNode * evalImpl(class ExceptionSink *xsink) const
should never be called for value types
Null
DLLEXPORT QoreNullNode Null
the global and unique NULL value in Qore
is_null
static bool is_null(const AbstractQoreNode *n)
use this function to test for NULL
Definition: QoreNullNode.h:119
QoreNullNode::getStaticTypeName
static DLLLOCAL const char * getStaticTypeName()
returns the type name (useful in templates)
Definition: QoreNullNode.h:108
AbstractQoreNode
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:47
null
static QoreNullNode * null()
returns a pointer to Null
Definition: QoreNullNode.h:129
NT_NULL
const qore_type_t NT_NULL
type value for QoreNullNode
Definition: node_types.h:40
qore_type_t
signed short qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode) ...
Definition: common.h:58
QoreString
Qore&#39;s string type supported by the QoreEncoding class.
Definition: QoreString.h:42
SimpleValueQoreNode::evalImpl
virtual DLLEXPORT AbstractQoreNode * evalImpl(ExceptionSink *xsink) const
should never be called for value types
QoreNullNode::parseInit
virtual DLLLOCAL AbstractQoreNode * parseInit(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo)
returns the type information
UniqueValueQoreNode
this class is for value types that will exists only once in the Qore library, reference counting is d...
Definition: AbstractQoreNode.h:461
QoreNullNode
Qore&#39;s SQL &quot;NULL&quot; parse tree/value type, not-referenced counted, not dynamically allocated.
Definition: QoreNullNode.h:42
ExceptionSink
container for holding Qore-language exception information and also for registering a &quot;thread_exit&quot; ca...
Definition: ExceptionSink.h:35
AbstractQoreNode::getType
DLLLOCAL qore_type_t getType() const
returns the data type
Definition: AbstractQoreNode.h:286
QoreNullNode::getAsString
virtual DLLEXPORT int getAsString(QoreString &str, int foff, class ExceptionSink *xsink) const
concatenate &quot;&lt;NULL&gt;&quot; to an existing QoreString