Qore Programming Language  0.9.3.1
QoreNothingNode.h
Go to the documentation of this file.
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3  QoreNothingNode.h
4 
5  Qore Programming Language
6 
7  Copyright (C) 2003 - 2018 Qore Technologies, s.r.o.
8 
9  Permission is hereby granted, free of charge, to any person obtaining a
10  copy of this software and associated documentation files (the "Software"),
11  to deal in the Software without restriction, including without limitation
12  the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  and/or sell copies of the Software, and to permit persons to whom the
14  Software is furnished to do so, subject to the following conditions:
15 
16  The above copyright notice and this permission notice shall be included in
17  all copies or substantial portions of the Software.
18 
19  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25  DEALINGS IN THE SOFTWARE.
26 
27  Note that the Qore library is released under a choice of three open-source
28  licenses: MIT (as above), LGPL 2+, or GPL 2+; see README-LICENSE for more
29  information.
30 */
31 
32 #ifndef _QORE_QORENOTHINGNODE_H
33 
34 #define _QORE_QORENOTHINGNODE_H
35 
36 #include <qore/AbstractQoreNode.h>
37 
42 
52 protected:
54 
57  DLLLOCAL QoreValue evalImpl(bool& needs_deref, ExceptionSink* xsink) const;
58 
59 public:
60  DLLEXPORT QoreNothingNode();
61 
62  DLLEXPORT virtual ~QoreNothingNode();
63 
65 
71  DLLEXPORT virtual int getAsString(QoreString &str, int foff, class ExceptionSink *xsink) const;
72 
74 
81  DLLEXPORT virtual QoreString *getAsString(bool &del, int foff, class ExceptionSink *xsink) const;
82 
84 
88  DLLEXPORT virtual bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const;
89 
91 
95  DLLEXPORT virtual bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const;
96 
98  DLLEXPORT virtual const char *getTypeName() const;
99 
101  DLLLOCAL virtual void parseInit(QoreValue& val, LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo);
102 
104  DLLLOCAL static const char *getStaticTypeName() {
105  return "nothing";
106  }
107 
109  DLLLOCAL static qore_type_t getStaticTypeCode() {
110  return NT_NOTHING;
111  }
112 
113  static const qore_type_t TYPE = NT_NOTHING;
114 };
115 
117 DLLEXPORT extern QoreNothingNode Nothing;
118 
120 static inline QoreNothingNode *nothing() {
121  return &Nothing;
122 }
123 
124 #endif
static QoreNothingNode * nothing()
returns a pointer to Nothing
Definition: QoreNothingNode.h:120
static DLLLOCAL const char * getStaticTypeName()
returns the type name (useful in templates)
Definition: QoreNothingNode.h:104
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:54
const qore_type_t NT_NOTHING
type value for QoreNothingNode
Definition: node_types.h:42
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
DLLLOCAL QoreValue evalImpl(bool &needs_deref, ExceptionSink *xsink) const
should never be called for value types
Qore&#39;s string type supported by the QoreEncoding class.
Definition: QoreString.h:81
DLLEXPORT QoreNothingNode Nothing
the global and unique NOTHING object in Qore
static DLLLOCAL qore_type_t getStaticTypeCode()
returns the type code (useful in templates)
Definition: QoreNothingNode.h:109
this class is for value types that will exists only once in the Qore library, reference counting is d...
Definition: AbstractQoreNode.h:383
Qore&#39;s "NOTHING" parse tree/value type, not-referenced counted, not dynamically allocated.
Definition: QoreNothingNode.h:51
virtual DLLEXPORT int getAsString(QoreString &str, int foff, class ExceptionSink *xsink) const
concatenate "<NOTHING>" to an existing QoreString
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:262
virtual DLLLOCAL void parseInit(QoreValue &val, LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo)
returns the type information
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:46
virtual DLLEXPORT bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality without type conversions (hard compare)
virtual DLLEXPORT QoreValue evalImpl(bool &needs_deref, ExceptionSink *xsink) const
should never be called for value types
int16_t qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode) ...
Definition: common.h:70
virtual DLLEXPORT bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality with possible type conversion (soft compare)