Qore Programming Language  0.8.11.1
ReferenceNode.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3  ReferenceNode.h
4 
5  Qore Programming Language
6 
7  Copyright (C) 2003 - 2014 David Nichols
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  DLLLOCAL ReferenceNode(lvalue_ref* p);
54 
55 protected:
57  DLLEXPORT virtual AbstractQoreNode *evalImpl(ExceptionSink *xsink) const;
58 
60  DLLEXPORT virtual AbstractQoreNode *evalImpl(bool &needs_deref, ExceptionSink *xsink) const;
61 
63  DLLEXPORT virtual int64 bigIntEvalImpl(ExceptionSink *xsink) const;
64 
66  DLLEXPORT virtual int integerEvalImpl(ExceptionSink *xsink) const;
67 
69  DLLEXPORT virtual bool boolEvalImpl(ExceptionSink *xsink) const;
70 
72  DLLEXPORT virtual double floatEvalImpl(ExceptionSink *xsink) const;
73 
75  DLLEXPORT virtual ~ReferenceNode();
76 
77 public:
79  DLLLOCAL ReferenceNode(AbstractQoreNode* exp, QoreObject* self, const void* lvalue_id);
80 
82 
88  DLLEXPORT virtual int getAsString(QoreString& str, int foff, ExceptionSink* xsink) const;
89 
91 
97  DLLEXPORT virtual QoreString *getAsString(bool& del, int foff, ExceptionSink* xsink) const;
98 
100  DLLEXPORT virtual AbstractQoreNode *realCopy() const;
101 
103  DLLEXPORT virtual bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink* xsink) const;
104 
106  DLLEXPORT virtual bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink* xsink) const;
107 
109  DLLEXPORT virtual const char *getTypeName() const;
110 
111  DLLEXPORT virtual bool derefImpl(ExceptionSink* xsink);
112 };
113 
114 #endif
virtual DLLEXPORT int integerEvalImpl(ExceptionSink *xsink) const
returns the value of the reference as an int
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
virtual DLLEXPORT bool derefImpl(ExceptionSink *xsink)
decrements the reference count
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:55
virtual DLLEXPORT bool boolEvalImpl(ExceptionSink *xsink) const
returns the value of the reference as a bool
virtual DLLEXPORT bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const
compares the values
virtual DLLEXPORT double floatEvalImpl(ExceptionSink *xsink) const
returns the value of the reference as a double
virtual DLLEXPORT int getAsString(QoreString &str, int foff, ExceptionSink *xsink) const
concatenate the verbose string representation of the value to an existing QoreString ...
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:50
virtual DLLEXPORT ~ReferenceNode()
frees all memory and destroys the object
parse type: reference to a lvalue expression
Definition: ReferenceNode.h:45
the implementation of Qore's object data type, reference counted, dynamically-allocated only ...
Definition: QoreObject.h:64
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:43
virtual DLLEXPORT int64 bigIntEvalImpl(ExceptionSink *xsink) const
returns the value of the reference as an int64
virtual DLLEXPORT AbstractQoreNode * evalImpl(ExceptionSink *xsink) const
returns the value of the reference; caller owns any reference count returned for non-NULL return valu...
virtual DLLEXPORT bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const
compares the values
virtual DLLEXPORT AbstractQoreNode * realCopy() const
returns a copy of the object