Qore Programming Language 1.19.5
Loading...
Searching...
No Matches
FunctionCallNode.h
1/* -*- mode: c++; indent-tabs-mode: nil -*- */
2/*
3 FunctionCallNode.h
4
5 Qore Programming Language
6
7 Copyright (C) 2003 - 2023 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_FUNCTIONCALLNODE_H
33
34#define _QORE_FUNCTIONCALLNODE_H
35
36#include <qore/Qore.h>
37#include "qore/intern/QoreParseListNode.h"
38#include "qore/intern/FunctionList.h"
39
40class FunctionCallBase {
41protected:
42 QoreParseListNode* parse_args = nullptr;
43 QoreListNode* args = nullptr;
44 const AbstractQoreFunctionVariant* variant = nullptr;
45
46public:
47 DLLLOCAL FunctionCallBase(QoreParseListNode* parse_args, QoreListNode* args = nullptr) : parse_args(parse_args), args(args) {
48 }
49
50 DLLLOCAL FunctionCallBase(const FunctionCallBase& old) :
51 parse_args(old.parse_args ? old.parse_args->listRefSelf() : nullptr),
52 args(old.args ? old.args->listRefSelf() : nullptr),
53 variant(old.variant) {
54 }
55
56 DLLLOCAL FunctionCallBase(const FunctionCallBase& old, QoreListNode* n_args) : args(n_args), variant(old.variant) {
57 }
58
59 DLLLOCAL ~FunctionCallBase() {
60 if (parse_args)
61 parse_args->deref();
62 if (args)
63 args->deref(nullptr);
64 }
65
66 DLLLOCAL const QoreParseListNode* getParseArgs() const { return parse_args; }
67
68 DLLLOCAL const QoreListNode* getArgs() const { return args; }
69
70 // ns can be nullptr if the function is a method
71 DLLLOCAL int parseArgsVariant(const QoreProgramLocation* loc, QoreParseContext& parse_context, QoreFunction* func,
72 qore_ns_private* ns);
73
74 DLLLOCAL const AbstractQoreFunctionVariant* getVariant() const {
75 return variant;
76 }
77};
78
79class AbstractFunctionCallNode : public ParseNode, public FunctionCallBase {
80protected:
81 // set to true if the arg list is a temporary list and can be destroyed when evaluating
82 // such as when the node was created during background operation execution
83 bool tmp_args = false;
84
85 DLLLOCAL virtual QoreValue evalImpl(bool& needs_deref, ExceptionSink* xsink) const = 0;
86
87 DLLLOCAL void doFlags(int64 flags) {
88 if (flags & QCF_RET_VALUE_ONLY) {
89 set_effect(false);
90 set_effect_as_root(false);
91 }
92 if (flags & QCF_CONSTANT) {
93 set_effect_as_root(false);
94 }
95 }
96
97public:
98 DLLLOCAL AbstractFunctionCallNode(const QoreProgramLocation* loc, qore_type_t t, QoreParseListNode* n_args,
99 bool needs_eval = true) : ParseNode(loc, t, needs_eval), FunctionCallBase(n_args) {
100 }
101
102 DLLLOCAL AbstractFunctionCallNode(const QoreProgramLocation* loc, qore_type_t t, QoreParseListNode* parse_args,
103 QoreListNode* args, bool needs_eval = true) : ParseNode(loc, t, needs_eval), FunctionCallBase(parse_args,
104 args) {
105 }
106
107 DLLLOCAL AbstractFunctionCallNode(const AbstractFunctionCallNode& old) : ParseNode(old), FunctionCallBase(old) {
108 }
109
110 DLLLOCAL AbstractFunctionCallNode(const AbstractFunctionCallNode& old, QoreListNode* n_args) : ParseNode(old),
111 FunctionCallBase(old, n_args), tmp_args(true) {
112 }
113
114 DLLLOCAL virtual ~AbstractFunctionCallNode() {
115 // there could be an object here in the case of a background expression
116 if (args) {
117 ExceptionSink xsink;
118 args->deref(&xsink);
119 args = nullptr;
120 }
121 }
122
123 // ns can be nullptr if the function is a method
124 DLLLOCAL int parseArgs(QoreParseContext& parse_context, QoreFunction* func, qore_ns_private* ns) {
125 int err = parseArgsVariant(loc, parse_context, func, ns);
126 // clear "effect" flag if possible, only if QCF_CONSTANT is set on the variant or function
127 if (variant) {
128 doFlags(variant->getFlags());
129 } else if (func) {
130 doFlags(func->parseGetUniqueFlags());
131 }
132 return err;
133 }
134
135 DLLLOCAL virtual const char* getName() const = 0;
136};
137
138class NewObjectCallNode : public AbstractQoreNode, public FunctionCallBase {
139public:
140 DLLLOCAL NewObjectCallNode(const QoreClass* qc, QoreListNode* args = nullptr);
141
142protected:
143 const QoreClass* qc;
144
146 DLLLOCAL virtual QoreValue evalImpl(bool& needs_deref, ExceptionSink* xsink) const;
147
148 DLLLOCAL int getAsString(QoreString& str, int foff, ExceptionSink* xsink) const {
149 str.sprintf("new object for class '%s'", qc->getName());
150 return 0;
151 }
152
153 DLLEXPORT virtual QoreString* getAsString(bool& del, int foff, ExceptionSink* xsink) const {
154 del = true;
155 return new QoreStringMaker("new object for class '%s'", qc->getName());
156 }
157
158 DLLEXPORT virtual const char* getTypeName() const {
159 return qc->getName();
160 }
161
162 DLLLOCAL virtual int parseInitImpl(QoreValue& val, QoreParseContext& parse_context) {
163 assert(false);
164 return 0;
165 }
166
167 DLLLOCAL virtual const QoreTypeInfo* getTypeInfo() const {
168 return qc->getTypeInfo();
169 }
170
171 DLLLOCAL virtual const char* getName() const {
172 return "new-object";
173 }
174
175 DLLLOCAL virtual AbstractQoreNode* realCopy() const {
176 return new NewObjectCallNode(qc, args ? args->listRefSelf() : nullptr);
177 }
178
179 DLLLOCAL virtual bool is_equal_soft(const AbstractQoreNode* v, ExceptionSink* xsink) const {
180 return this == v;
181 }
182
183 DLLLOCAL virtual bool is_equal_hard(const AbstractQoreNode* v, ExceptionSink* xsink) const {
184 return this == v;
185 }
186};
187
188class FunctionCallNode : public AbstractFunctionCallNode {
189public:
190 DLLLOCAL FunctionCallNode(const FunctionCallNode& old, QoreListNode* args) : AbstractFunctionCallNode(old, args),
191 fe(old.fe), pgm(old.pgm), finalized(old.finalized) {
192 }
193
194 DLLLOCAL FunctionCallNode(const QoreProgramLocation* loc, const FunctionEntry* f, QoreParseListNode* a)
195 : AbstractFunctionCallNode(loc, NT_FUNCTION_CALL, a), fe(f) {
196 }
197
198 DLLLOCAL FunctionCallNode(const QoreProgramLocation* loc, const FunctionEntry* f, QoreListNode* a,
199 QoreProgram* n_pgm) : AbstractFunctionCallNode(loc, NT_FUNCTION_CALL, nullptr, a), fe(f), pgm(n_pgm) {
200 }
201
202 // normal function call constructor
203 DLLLOCAL FunctionCallNode(const QoreProgramLocation* loc, char* name, QoreParseListNode* a)
204 : AbstractFunctionCallNode(loc, NT_FUNCTION_CALL, a), c_str(name) {
205 }
206
207 DLLLOCAL virtual ~FunctionCallNode() {
208 printd(5, "FunctionCallNode::~FunctionCallNode(): fe: %p c_str: %p (%s) args: %p\n", fe, c_str,
209 c_str ? c_str : "n/a", args);
210 if (c_str)
211 free(c_str);
212 }
213
214 DLLLOCAL virtual int getAsString(QoreString &str, int foff, ExceptionSink* xsink) const;
215 DLLLOCAL virtual QoreString* getAsString(bool& del, int foff, ExceptionSink* xsink) const;
216
217 // returns the type name as a c string
218 DLLLOCAL virtual const char* getTypeName() const {
219 return "function call";
220 }
221
222 DLLLOCAL QoreProgram* getProgram() const {
223 return const_cast<QoreProgram*>(pgm);
224 }
225
226 DLLLOCAL int parseInitCall(QoreValue& val, QoreParseContext& parse_context);
227
228 DLLLOCAL int parseInitFinalizedCall(QoreValue& val, QoreParseContext& parse_context);
229
230 DLLLOCAL virtual const char* getName() const {
231 return fe ? fe->getName() : c_str;
232 }
233
234 DLLLOCAL const QoreFunction* getFunction() const {
235 return fe ? fe->getFunction() : nullptr;
236 }
237
238 // FIXME: delete when unresolved function call node implemented properly
239 DLLLOCAL char* takeName() {
240 char* str = c_str;
241 c_str = 0;
242 return str;
243 }
244
245 // FIXME: delete when unresolved function call node implemented properly
246 DLLLOCAL QoreParseListNode* takeParseArgs() {
247 QoreParseListNode* rv = parse_args;
248 parse_args = nullptr;
249 return rv;
250 }
251
252 DLLLOCAL QoreListNode* takeArgs() {
253 QoreListNode* rv = args;
254 args = nullptr;
255 return rv;
256 }
257
258 DLLLOCAL AbstractQoreNode* makeReferenceNodeAndDeref() {
259 if (args) {
260 parse_error(*loc, "argument given to call reference");
261 return this;
262 }
263
264 assert(!fe);
265 AbstractQoreNode* rv = makeReferenceNodeAndDerefImpl();
266 deref();
267 return rv;
268 }
269
270 DLLLOCAL virtual AbstractQoreNode* makeReferenceNodeAndDerefImpl();
271
272 DLLLOCAL bool isFinalized() const {
273 return finalized;
274 }
275
276 DLLLOCAL void setFinalized() {
277 finalized = true;
278 }
279
280protected:
281 const FunctionEntry* fe = nullptr;
282 QoreProgram* pgm = nullptr;
283 char* c_str = nullptr;
284 // was this call enclosed in parentheses (in which case it will not be converted to a method call)
285 bool finalized = false;
286
287 using AbstractFunctionCallNode::evalImpl;
288 DLLLOCAL virtual QoreValue evalImpl(bool& needs_deref, ExceptionSink* xsink) const;
289
290 DLLLOCAL FunctionCallNode(const QoreProgramLocation* loc, char* name, QoreParseListNode* a, qore_type_t n_type)
291 : AbstractFunctionCallNode(loc, n_type, a), c_str(name), finalized(false) {
292 }
293
294 DLLLOCAL virtual int parseInitImpl(QoreValue& val, QoreParseContext& parse_context);
295
296 DLLLOCAL virtual const QoreTypeInfo* getTypeInfo() const {
297 return variant
298 ? variant->parseGetReturnTypeInfo()
299 : (fe ? fe->getFunction()->parseGetUniqueReturnTypeInfo() : nullptr);
300 }
301};
302
303class ProgramFunctionCallNode : public FunctionCallNode {
304public:
305 DLLLOCAL ProgramFunctionCallNode(const QoreProgramLocation* loc, char* name, QoreParseListNode* a)
306 : FunctionCallNode(loc, name, a, NT_PROGRAM_FUNC_CALL) {
307 }
308
309 DLLLOCAL virtual int parseInitImpl(QoreValue& val, QoreParseContext& parse_context) {
310 return parseInitCall(val, parse_context);
311 }
312
313 DLLLOCAL virtual AbstractQoreNode* makeReferenceNodeAndDerefImpl();
314};
315
316class AbstractMethodCallNode : public AbstractFunctionCallNode {
317protected:
318 // if a method pointer can be resolved at parse time, then the class
319 // is used to compare the runtime class; if they are equal, then no search
320 // is needed
321 const QoreClass* qc;
322 const QoreMethod* method;
323
324 DLLLOCAL virtual int parseInitImpl(QoreValue& val, QoreParseContext& parse_context) = 0;
325
326 DLLLOCAL virtual const QoreTypeInfo* getTypeInfo() const;
327
328public:
329 DLLLOCAL AbstractMethodCallNode(const QoreProgramLocation* loc, qore_type_t t, QoreParseListNode* n_args,
330 const QoreClass* n_qc = nullptr, const QoreMethod* m = nullptr)
331 : AbstractFunctionCallNode(loc, t, n_args), qc(n_qc), method(m) {
332 }
333
334 DLLLOCAL AbstractMethodCallNode(const AbstractMethodCallNode& old) : AbstractFunctionCallNode(old), qc(old.qc),
335 method(old.method) {
336 }
337
338 DLLLOCAL AbstractMethodCallNode(const AbstractMethodCallNode& old, QoreListNode* n_args)
339 : AbstractFunctionCallNode(old, n_args), qc(old.qc), method(old.method) {
340 }
341
342 DLLLOCAL QoreValue exec(QoreObject* o, const char* cstr, const qore_class_private* ctx, ExceptionSink* xsink) const;
343
344 DLLLOCAL const QoreClass* getClass() const {
345 return qc;
346 }
347
348 DLLLOCAL const QoreMethod* getMethod() const {
349 return method;
350 }
351};
352
353class MethodCallNode : public AbstractMethodCallNode {
354public:
355 DLLLOCAL MethodCallNode(const QoreProgramLocation* loc, char* name, QoreParseListNode* n_args)
356 : AbstractMethodCallNode(loc, NT_METHOD_CALL, n_args), c_str(name) {
357 //printd(0, "MethodCallNode::MethodCallNode() this=%p name='%s' args=%p (len=%d)\n", this, c_str, args,
358 // args ? args->size() : -1);
359 }
360
361 DLLLOCAL MethodCallNode(const MethodCallNode& old, QoreListNode* n_args)
362 : AbstractMethodCallNode(old, n_args), c_str(old.c_str ? strdup(old.c_str) : nullptr), pseudo(old.pseudo) {
363 }
364
365 DLLLOCAL virtual ~MethodCallNode() {
366 if (c_str)
367 free(c_str);
368 }
369
370 using AbstractMethodCallNode::exec;
371 DLLLOCAL QoreValue exec(QoreObject* o, ExceptionSink* xsink) const;
372
373 DLLLOCAL QoreValue execPseudo(const QoreValue n, ExceptionSink* xsink) const;
374
375 DLLLOCAL virtual const char* getName() const {
376 return c_str ? c_str : "copy";
377 }
378
379 DLLLOCAL const char* getRawName() const {
380 return c_str;
381 }
382
383 DLLLOCAL virtual int getAsString(QoreString &str, int foff, ExceptionSink* xsink) const {
384 str.sprintf("'%s' %smethod call (%p)", getName(), pseudo ? "pseudo " : "", this);
385 return 0;
386 }
387
388 DLLLOCAL virtual QoreString* getAsString(bool& del, int foff, ExceptionSink* xsink) const {
389 del = true;
390 QoreString* rv = new QoreString();
391 getAsString(*rv, foff, xsink);
392 return rv;
393 }
394
395 DLLLOCAL char* takeName() {
396 char* rv = c_str;
397 c_str = 0;
398 return rv;
399 }
400
401 // returns the type name as a c string
402 DLLLOCAL virtual const char* getTypeName() const {
403 return getStaticTypeName();
404 }
405
406 DLLLOCAL static const char* getStaticTypeName() {
407 return "method call";
408 }
409
410 DLLLOCAL void parseSetClassAndMethod(const QoreClass* n_qc, const QoreMethod* n_method) {
411 assert(!qc);
412 assert(!method);
413 qc = n_qc;
414 method = n_method;
415 assert(qc);
416 assert(method);
417 }
418
419 DLLLOCAL void setPseudo(const QoreTypeInfo* pti) {
420 assert(!pseudo && !pseudoTypeInfo);
421 pseudo = true;
422 pseudoTypeInfo = pti;
423 }
424
425 DLLLOCAL bool isPseudo() const {
426 return pseudo;
427 }
428
429 DLLLOCAL const QoreTypeInfo* getPseudoTypeInfo() const {
430 return pseudoTypeInfo;
431 }
432
433protected:
434 char* c_str;
435 const QoreTypeInfo* pseudoTypeInfo = nullptr;
436 bool pseudo = false;
437
438 using AbstractFunctionCallNode::evalImpl;
439 DLLLOCAL virtual QoreValue evalImpl(bool& needs_deref, ExceptionSink* xsink) const {
440 assert(false);
441 return QoreValue();
442 }
443
444 // note that the class and method are set in QoreDotEvalOperatorNode::parseInitImpl()
445 DLLLOCAL virtual int parseInitImpl(QoreValue& val, QoreParseContext& parse_context) {
446 parse_context.typeInfo = nullptr;
447 return parseArgs(parse_context, nullptr, nullptr);
448 }
449};
450
451class SelfFunctionCallNode : public AbstractMethodCallNode {
452public:
453 DLLLOCAL SelfFunctionCallNode(const QoreProgramLocation* loc, char* n, QoreParseListNode* n_args)
454 : AbstractMethodCallNode(loc, NT_SELF_CALL, n_args, parse_get_class()), ns(n), is_copy(false) {
455 }
456
457 DLLLOCAL SelfFunctionCallNode(const QoreProgramLocation* loc, char* n, QoreParseListNode* n_args,
458 const QoreMethod* m, const QoreClass* n_qc, const qore_class_private* class_ctx) :
459 AbstractMethodCallNode(loc, NT_SELF_CALL, n_args, n_qc, m), ns(n),
460 class_ctx(class_ctx), is_copy(false) {
461 }
462
463 DLLLOCAL SelfFunctionCallNode(const QoreProgramLocation* loc, char* n, QoreParseListNode* n_args,
464 const QoreClass* n_qc) : AbstractMethodCallNode(loc, NT_SELF_CALL, n_args, n_qc), ns(n), is_copy(false) {
465 }
466
467 DLLLOCAL SelfFunctionCallNode(const QoreProgramLocation* loc, NamedScope* n_ns, QoreParseListNode* n_args)
468 : AbstractMethodCallNode(loc, NT_SELF_CALL, n_args, parse_get_class()), ns(n_ns), is_copy(false) {
469 }
470
471 DLLLOCAL SelfFunctionCallNode(const SelfFunctionCallNode& old, QoreListNode* n_args)
472 : AbstractMethodCallNode(old, n_args), ns(old.ns), is_copy(old.is_copy) {
473 }
474
475 DLLLOCAL int parseInitCall(QoreValue& val, QoreParseContext& parse_context);
476
477 DLLLOCAL virtual ~SelfFunctionCallNode() {
478 }
479
480 DLLLOCAL virtual const char* getTypeName() const {
481 return "in-object method call";
482 }
483
484 DLLLOCAL virtual const char* getName() const {
485 return ns.ostr;
486 }
487
488 using AbstractFunctionCallNode::evalImpl;
489 DLLLOCAL virtual QoreValue evalImpl(bool& needs_deref, ExceptionSink* xsink) const;
490
491 DLLLOCAL virtual int getAsString(QoreString &str, int foff, ExceptionSink* xsink) const;
492 DLLLOCAL virtual QoreString* getAsString(bool& del, int foff, ExceptionSink* xsink) const;
493
494 DLLLOCAL AbstractQoreNode* makeReferenceNodeAndDeref();
495
496protected:
497 NamedScope ns;
498 const qore_class_private* class_ctx = nullptr;
499 bool is_copy;
500 bool is_abstract = false;
501
502 DLLLOCAL virtual int parseInitImpl(QoreValue& val, QoreParseContext& parse_context);
503};
504
506
508class SetSelfFunctionCallNode : public SelfFunctionCallNode {
509public:
510 DLLLOCAL SetSelfFunctionCallNode(const SelfFunctionCallNode& old, QoreListNode* n_args);
511
512 using AbstractFunctionCallNode::evalImpl;
513 DLLLOCAL virtual QoreValue evalImpl(bool& needs_deref, ExceptionSink* xsink) const;
514
515 using AbstractFunctionCallNode::deref;
516 DLLLOCAL virtual void deref(ExceptionSink* xsink) {
517 assert(self);
518 if (deref_self) {
519 self->deref(xsink);
520 }
521 }
522
523protected:
524 QoreObject* self;
525 const qore_class_private* cls;
526 mutable bool deref_self = true;
527};
528
529class StaticMethodCallNode : public AbstractFunctionCallNode {
530protected:
531 NamedScope* scope = nullptr;
532 const QoreMethod* method = nullptr;
533
534 using AbstractFunctionCallNode::evalImpl;
535 DLLLOCAL virtual QoreValue evalImpl(bool& needs_deref, ExceptionSink* xsink) const;
536
537 DLLLOCAL virtual int parseInitImpl(QoreValue& val, QoreParseContext& parse_context);
538
539 DLLLOCAL virtual const QoreTypeInfo* getTypeInfo() const;
540
541public:
542 DLLLOCAL StaticMethodCallNode(const QoreProgramLocation* loc, NamedScope* n_scope, QoreParseListNode* args) : AbstractFunctionCallNode(loc, NT_STATIC_METHOD_CALL, args), scope(n_scope) {
543 }
544
545 // used when copying (for background expressions with processed arguments)
546 DLLLOCAL StaticMethodCallNode(const StaticMethodCallNode& old, QoreListNode* args) : AbstractFunctionCallNode(old, args), method(old.method) {
547 }
548
549 DLLLOCAL StaticMethodCallNode(const QoreProgramLocation* loc, const QoreMethod* m, QoreParseListNode* args) : AbstractFunctionCallNode(loc, NT_STATIC_METHOD_CALL, args), method(m) {
550 }
551
552 DLLLOCAL virtual ~StaticMethodCallNode() {
553 delete scope;
554 }
555
556 DLLLOCAL const QoreMethod* getMethod() const {
557 return method;
558 }
559
560 DLLLOCAL virtual int getAsString(QoreString &str, int foff, ExceptionSink* xsink) const {
561 str.sprintf("static method call %s::%s() (%p)", method->getClass()->getName(), method->getName(), this);
562 return 0;
563 }
564
565 DLLLOCAL virtual QoreString* getAsString(bool& del, int foff, ExceptionSink* xsink) const {
566 del = true;
567 QoreString* rv = new QoreString();
568 getAsString(*rv, foff, xsink);
569 return rv;
570 }
571
572 DLLLOCAL virtual const char* getName() const {
573 return method->getName();
574 }
575
576 // returns the type name as a c string
577 DLLLOCAL virtual const char* getTypeName() const {
578 return getStaticTypeName();
579 }
580
581 DLLLOCAL AbstractQoreNode* makeReferenceNodeAndDeref();
582
583 DLLLOCAL static const char* getStaticTypeName() {
584 return "static method call";
585 }
586
587 DLLLOCAL NamedScope* takeScope() {
588 NamedScope* rv = scope;
589 scope = 0;
590 return rv;
591 }
592
593 DLLLOCAL QoreParseListNode* takeParseArgs() {
594 QoreParseListNode* rv = parse_args;
595 parse_args = nullptr;
596 return rv;
597 }
598};
599
600#endif
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:57
DLLLOCAL bool needs_eval() const
returns true if the object needs evaluation to return a value, false if not
Definition: AbstractQoreNode.h:145
virtual DLLEXPORT bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const =0
tests for equality ("deep compare" including all contained values for container types) without type c...
virtual DLLEXPORT int getAsString(QoreString &str, int foff, ExceptionSink *xsink) const =0
concatenate the verbose string representation of the value (including all contained values for contai...
virtual DLLEXPORT AbstractQoreNode * realCopy() const =0
returns a copy of the object; the caller owns the reference count
virtual DLLEXPORT QoreValue evalImpl(bool &needs_deref, ExceptionSink *xsink) const =0
optionally evaluates the argument
DLLEXPORT void deref(ExceptionSink *xsink)
decrements the reference count and calls derefImpl() if there_can_be_only_one is false,...
virtual DLLEXPORT const char * getTypeName() const =0
returns the type name as a c string
virtual DLLEXPORT bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const =0
tests for equality ("deep compare" including all contained values for container types) with possible ...
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:50
defines a Qore-language class
Definition: QoreClass.h:257
DLLEXPORT const QoreTypeInfo * getTypeInfo() const
returns the type information structure for this class
DLLEXPORT const char * getName() const
returns the class name
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
DLLEXPORT QoreListNode * listRefSelf() const
returns "this" with an incremented reference count
a method in a QoreClass
Definition: QoreClass.h:143
DLLEXPORT const char * getName() const
returns the method's name
DLLEXPORT const QoreClass * getClass() const
returns a pointer to the parent class
the implementation of Qore's object data type, reference counted, dynamically-allocated only
Definition: QoreObject.h:62
supports parsing and executing Qore-language code, reference counted, dynamically-allocated only
Definition: QoreProgram.h:128
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:93
DLLEXPORT int sprintf(const char *fmt,...)
this will concatentate a formatted string to the existing string according to the format string and t...
Used in arguments background expressions to ensure that the object context is set for the call.
Definition: FunctionCallNode.h:508
virtual DLLLOCAL QoreValue evalImpl(bool &needs_deref, ExceptionSink *xsink) const
optionally evaluates the argument
int16_t qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode)
Definition: common.h:70
long long int64
64bit integer type, cannot use int64_t here since it breaks the API on some 64-bit systems due to equ...
Definition: common.h:260
const qore_type_t NT_STATIC_METHOD_CALL
type value for StaticMethodCallNode (private class)
Definition: node_types.h:74
const qore_type_t NT_FUNCTION_CALL
type value for FunctionCallNode
Definition: node_types.h:59
const qore_type_t NT_SELF_CALL
type value for SelfFunctionCallNode (private class)
Definition: node_types.h:75
const qore_type_t NT_PROGRAM_FUNC_CALL
type value for ProgramFunctionCallNode (private class)
Definition: node_types.h:79
const qore_type_t NT_METHOD_CALL
type value for MethodCallNode (private class)
Definition: node_types.h:73
DLLEXPORT QoreProgram * getProgram()
returns the current QoreProgram
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:279