Qore Programming Language  1.7.0
ReferenceNode.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3  ReferenceNode.h
4 
5  Qore Programming Language
6 
7  Copyright (C) 2003 - 2022 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_REFERENCENODE_H
33 
34 #define _QORE_REFERENCENODE_H
35 
36 #include <qore/AbstractQoreNode.h>
37 
39 
46  friend class RuntimeReferenceHelper;
47  friend class lvalue_ref;
48 
49 private:
51  class lvalue_ref* priv;
52 
53 protected:
55  DLLEXPORT virtual QoreValue evalImpl(bool& needs_deref, ExceptionSink* xsink) const;
56 
58  DLLEXPORT QoreValue doEval(ExceptionSink* xsink) const;
59 
61  DLLEXPORT virtual ~ReferenceNode();
62 
63 public:
65  DLLLOCAL ReferenceNode(QoreValue exp, const QoreTypeInfo* typeInfo, QoreObject* self, const void* lvalue_id, const qore_class_private* cls);
66 
68 
70  DLLLOCAL ReferenceNode(const ReferenceNode& old);
71 
73  DLLEXPORT ReferenceNode* refRefSelf() const;
74 
76 
78  DLLEXPORT const QoreTypeInfo* getTypeInfo() const;
79 
81 
83  DLLEXPORT const QoreTypeInfo* getLValueTypeInfo() const;
84 
86 
92  DLLEXPORT virtual int getAsString(QoreString& str, int foff, ExceptionSink* xsink) const;
93 
95 
101  DLLEXPORT virtual QoreString* getAsString(bool& del, int foff, ExceptionSink* xsink) const;
102 
104  DLLEXPORT virtual AbstractQoreNode* realCopy() const;
105 
107  DLLEXPORT virtual bool is_equal_soft(const AbstractQoreNode* v, ExceptionSink* xsink) const;
108 
110  DLLEXPORT virtual bool is_equal_hard(const AbstractQoreNode* v, ExceptionSink* xsink) const;
111 
113  DLLEXPORT virtual const char* getTypeName() const;
114 
116  DLLEXPORT virtual bool derefImpl(ExceptionSink* xsink);
117 };
118 
119 #endif
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:57
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
the implementation of Qore's object data type, reference counted, dynamically-allocated only
Definition: QoreObject.h:60
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:93
parse type: reference to a lvalue expression
Definition: ReferenceNode.h:45
virtual DLLEXPORT int getAsString(QoreString &str, int foff, ExceptionSink *xsink) const
concatenate the verbose string representation of the value to an existing QoreString
virtual DLLEXPORT QoreValue evalImpl(bool &needs_deref, ExceptionSink *xsink) const
returns the value of the reference
DLLEXPORT QoreValue doEval(ExceptionSink *xsink) const
returns the value of the reference
DLLEXPORT ReferenceNode * refRefSelf() const
returns a reference to itself
DLLEXPORT const QoreTypeInfo * getLValueTypeInfo() const
returns the type information for the lvalue referenced
virtual DLLEXPORT bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const
compares the values
virtual DLLEXPORT AbstractQoreNode * realCopy() const
returns a copy of the object
DLLEXPORT const QoreTypeInfo * getTypeInfo() const
returns the type information for this object
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
virtual DLLEXPORT ~ReferenceNode()
frees all memory and destroys the object
DLLLOCAL ReferenceNode(QoreValue exp, const QoreTypeInfo *typeInfo, QoreObject *self, const void *lvalue_id, const qore_class_private *cls)
creates the ReferenceNode object - internal function, not exported, not part of the Qore API
virtual DLLEXPORT bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const
compares the values
virtual DLLEXPORT bool derefImpl(ExceptionSink *xsink)
called when the object is deleted
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:275