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