Qore Programming Language  0.8.3
include/qore/QoreNullNode.h (4311)
Go to the documentation of this file.
00001 /* -*- mode: c++; indent-tabs-mode: nil -*- */
00002 /*
00003   QoreNullNode.h
00004   
00005   Qore Programming Language
00006 
00007   Copyright 2003 - 2011 David Nichols
00008 
00009   This library is free software; you can redistribute it and/or
00010   modify it under the terms of the GNU Lesser General Public
00011   License as published by the Free Software Foundation; either
00012   version 2.1 of the License, or (at your option) any later version.
00013 
00014   This library is distributed in the hope that it will be useful,
00015   but WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017   Lesser General Public License for more details.
00018 
00019   You should have received a copy of the GNU Lesser General Public
00020   License along with this library; if not, write to the Free Software
00021   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00022 */
00023 
00024 #ifndef _QORE_QORENULLNODE_H
00025 
00026 #define _QORE_QORENULLNODE_H
00027 
00028 #include <qore/AbstractQoreNode.h>
00029 
00034 
00035 
00042 class QoreNullNode : public UniqueValueQoreNode {
00043    protected:
00045 
00047       using SimpleValueQoreNode::evalImpl;
00048       DLLLOCAL AbstractQoreNode *evalImpl(class ExceptionSink *xsink) const;
00049 
00050    public:
00051       DLLEXPORT QoreNullNode();
00052 
00053       DLLEXPORT virtual ~QoreNullNode();
00054 
00056 
00062       DLLEXPORT virtual int getAsString(QoreString &str, int foff, class ExceptionSink *xsink) const;
00063 
00065 
00072       DLLEXPORT virtual QoreString *getAsString(bool &del, int foff, class ExceptionSink *xsink) const;
00073 
00075 
00079       DLLEXPORT virtual bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const;
00080 
00082 
00086       DLLEXPORT virtual bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const;
00087 
00089       DLLEXPORT virtual const char *getTypeName() const;
00090 
00092       DLLLOCAL virtual AbstractQoreNode *parseInit(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo);
00093 
00094       DLLLOCAL static const char *getStaticTypeName() {
00095          return "NULL";
00096       }
00097 };
00098 
00100 static inline bool is_null(const AbstractQoreNode *n)
00101 {
00102    // this is faster than a dynamic_cast<const QoreNullNode *> operation
00103    return n && n->getType() == NT_NULL;
00104 }
00105 
00107 DLLEXPORT extern QoreNullNode Null;
00108 
00110 static inline QoreNullNode *null()
00111 {
00112    return &Null;
00113 }
00114 
00115 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines