QoreNothingNode.h
Go to the documentation of this file.
/* -*- mode: c++; indent-tabs-mode: nil -*- */
/*
QoreNothingNode.h
Qore Programming Language
Copyright (C) 2003 - 2021 Qore Technologies, s.r.o.
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_QORENOTHINGNODE_H
#define _QORE_QORENOTHINGNODE_H
#include <qore/AbstractQoreNode.h>
class QoreNothingNode : public UniqueValueQoreNode {
protected:
using SimpleValueQoreNode::evalImpl;
DLLLOCAL QoreValue evalImpl(bool& needs_deref, ExceptionSink* xsink) const;
public:
DLLEXPORT QoreNothingNode();
DLLEXPORT virtual ~QoreNothingNode();
DLLEXPORT virtual int getAsString(QoreString &str, int foff, class ExceptionSink *xsink) const;
DLLEXPORT virtual QoreString* getAsString(bool &del, int foff, class ExceptionSink *xsink) 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;
DLLLOCAL virtual int parseInit(QoreValue& val, QoreParseContext& parse_context);
DLLLOCAL static const char* getStaticTypeName() {
return "nothing";
}
DLLLOCAL static qore_type_t getStaticTypeCode() {
return NT_NOTHING;
}
static const qore_type_t TYPE = NT_NOTHING;
};
DLLEXPORT extern QoreNothingNode Nothing;
static inline QoreNothingNode *nothing() {
return &Nothing;
}
#endif
nothing
static QoreNothingNode * nothing()
returns a pointer to Nothing
Definition: QoreNothingNode.h:120
QoreNothingNode::getStaticTypeName
static DLLLOCAL const char * getStaticTypeName()
returns the type name (useful in templates)
Definition: QoreNothingNode.h:104
AbstractQoreNode
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:57
NT_NOTHING
const qore_type_t NT_NOTHING
type value for QoreNothingNode
Definition: node_types.h:42
QoreNothingNode::getTypeName
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
QoreNothingNode::evalImpl
DLLLOCAL QoreValue evalImpl(bool &needs_deref, ExceptionSink *xsink) const
should never be called for value types
QoreString
Qore&#39;s string type supported by the QoreEncoding class.
Definition: QoreString.h:81
Nothing
DLLEXPORT QoreNothingNode Nothing
the global and unique NOTHING object in Qore
QoreNothingNode::getStaticTypeCode
static DLLLOCAL qore_type_t getStaticTypeCode()
returns the type code (useful in templates)
Definition: QoreNothingNode.h:109
UniqueValueQoreNode
this class is for value types that will exists only once in the Qore library, reference counting is d...
Definition: AbstractQoreNode.h:389
QoreNothingNode
Qore&#39;s "NOTHING" parse tree/value type, not-referenced counted, not dynamically allocated.
Definition: QoreNothingNode.h:51
QoreNothingNode::getAsString
virtual DLLEXPORT int getAsString(QoreString &str, int foff, class ExceptionSink *xsink) const
concatenate "<NOTHING>" to an existing QoreString
QoreValue
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:267
ExceptionSink
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
QoreNothingNode::parseInit
virtual DLLLOCAL int parseInit(QoreValue &val, QoreParseContext &parse_context)
returns the type information
QoreNothingNode::is_equal_hard
virtual DLLEXPORT bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality without type conversions (hard compare)
SimpleValueQoreNode::evalImpl
virtual DLLEXPORT QoreValue evalImpl(bool &needs_deref, ExceptionSink *xsink) const
should never be called for value types
qore_type_t
int16_t qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode) ...
Definition: common.h:70
QoreNothingNode::is_equal_soft
virtual DLLEXPORT bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality with possible type conversion (soft compare)