Qore Programming Language - C/C++ Library  0.8.12.3
QoreListNode.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3  QoreListNode.h
4 
5  Qore Programming Language
6 
7  Copyright (C) 2003 - 2015 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_QORELISTNODE_H
33 
34 #define _QORE_QORELISTNODE_H
35 
36 #include <qore/AbstractQoreNode.h>
37 
38 #ifdef min
39 #undef min
40 #endif
41 #ifdef max
42 #undef max
43 #endif
44 
46 
48 
52 class QoreListNode : public AbstractQoreNode {
53  friend class StackList;
54  friend struct qore_list_private;
55 
56 private:
58  DLLLOCAL QoreListNode(const QoreListNode&);
59 
61  DLLLOCAL QoreListNode& operator=(const QoreListNode&);
62 
63 protected:
65 
67  struct qore_list_private *priv;
68 
69  DLLLOCAL void resize(qore_size_t num);
70  DLLLOCAL QoreListNode* splice_intern(qore_size_t offset, qore_size_t length, ExceptionSink* xsink, bool extract = false);
71  DLLLOCAL QoreListNode* splice_intern(qore_size_t offset, qore_size_t length, const AbstractQoreNode* l, ExceptionSink* xsink, bool extract = false);
72  DLLLOCAL qore_size_t check_offset(qore_offset_t offset);
73  DLLLOCAL void check_offset(qore_offset_t offset, qore_offset_t len, qore_size_t &n_offset, qore_size_t &n_len);
74 
76 
78  DLLLOCAL int qsort(const ResolvedCallReferenceNode* fr, qore_size_t left, qore_size_t right, bool ascending, ExceptionSink* xsink);
79 
81 
83  DLLLOCAL int mergesort(const ResolvedCallReferenceNode* fr, bool ascending, ExceptionSink* xsink);
84 
86  DLLLOCAL QoreListNode* eval_intern(ExceptionSink* xsink) const;
87 
89 
93  DLLEXPORT virtual ~QoreListNode();
94 
96 
102  DLLEXPORT virtual bool derefImpl(ExceptionSink* xsink);
103 
105 
109  DLLEXPORT virtual AbstractQoreNode* evalImpl(ExceptionSink* xsink) const;
110 
112 
115  DLLLOCAL virtual AbstractQoreNode* evalImpl(bool &needs_deref, ExceptionSink* xsink) const;
116 
118  DLLLOCAL virtual int64 bigIntEvalImpl(ExceptionSink* xsink) const;
119 
121  DLLLOCAL virtual int integerEvalImpl(ExceptionSink* xsink) const;
122 
124  DLLLOCAL virtual bool boolEvalImpl(ExceptionSink* xsink) const;
125 
127  DLLLOCAL virtual double floatEvalImpl(ExceptionSink* xsink) const;
128 
129 public:
130  DLLEXPORT QoreListNode();
131 
133 
135  DLLEXPORT virtual bool getAsBoolImpl() const;
136 
138 
144  DLLEXPORT int getAsString(QoreString &str, int foff, ExceptionSink* xsink) const;
145 
147 
154  DLLEXPORT QoreString *getAsString(bool &del, int foff, ExceptionSink* xsink) const;
155 
157  //DLLEXPORT virtual bool needs_eval() const;
158 
160  DLLEXPORT virtual AbstractQoreNode* realCopy() const;
161 
163 
167  DLLEXPORT virtual bool is_equal_soft(const AbstractQoreNode* v, ExceptionSink* xsink) const;
168 
170 
174  DLLEXPORT virtual bool is_equal_hard(const AbstractQoreNode* v, ExceptionSink* xsink) const;
175 
177  DLLEXPORT virtual const char *getTypeName() const;
178 
180  //DLLEXPORT virtual bool is_value() const;
181 
182  DLLLOCAL static const char *getStaticTypeName() {
183  return "list";
184  }
185 
187 
191  DLLEXPORT AbstractQoreNode* retrieve_entry(qore_size_t index);
192 
194 
198  DLLEXPORT const AbstractQoreNode* retrieve_entry(qore_size_t index) const;
199 
201 
205  DLLEXPORT AbstractQoreNode* get_referenced_entry(qore_size_t index) const;
206 
208 
211  DLLEXPORT int getEntryAsInt(qore_size_t index) const;
212 
216  DLLEXPORT AbstractQoreNode** get_entry_ptr(qore_size_t index);
217 
222 
224 
231  DLLEXPORT void set_entry(qore_size_t index, AbstractQoreNode* val, ExceptionSink* xsink);
232 
233  DLLEXPORT void push(AbstractQoreNode* val);
234  DLLEXPORT void insert(AbstractQoreNode* val);
235 
237 
239  DLLEXPORT AbstractQoreNode* pop();
240 
242 
245  DLLEXPORT AbstractQoreNode* shift();
246 
248  DLLEXPORT void merge(const QoreListNode* list);
249 
257  DLLEXPORT int delete_entry(qore_size_t index, ExceptionSink* xsink);
258 
265  DLLEXPORT void pop_entry(qore_size_t index, ExceptionSink* xsink);
266 
268 
274  DLLEXPORT QoreListNode* evalList(ExceptionSink* xsink) const;
275 
277 
284  DLLEXPORT QoreListNode* evalList(bool &needs_deref, ExceptionSink* xsink) const;
285 
287  DLLEXPORT QoreListNode* copy() const;
288 
290 
293  DLLEXPORT QoreListNode* copyListFrom(qore_size_t index) const;
294 
296 
299  DLLEXPORT QoreListNode* sort() const;
300 
302 
306  DLLEXPORT QoreListNode* sort(const ResolvedCallReferenceNode* fr, ExceptionSink* xsink) const;
307 
309 
312  DLLEXPORT QoreListNode* sortStable() const;
313 
315 
319  DLLEXPORT QoreListNode* sortStable(const ResolvedCallReferenceNode* fr, ExceptionSink* xsink) const;
320 
322 
325  DLLEXPORT QoreListNode* sortDescending() const;
326 
328 
332  DLLEXPORT QoreListNode* sortDescending(const ResolvedCallReferenceNode* fr, ExceptionSink* xsink) const;
333 
335 
338  DLLEXPORT QoreListNode* sortDescendingStable() const;
339 
341 
345  DLLEXPORT QoreListNode* sortDescendingStable(const ResolvedCallReferenceNode* fr, ExceptionSink* xsink) const;
346 
348 
351  DLLEXPORT AbstractQoreNode* min() const;
352 
354 
357  DLLEXPORT AbstractQoreNode* max() const;
358 
360 
364  DLLEXPORT AbstractQoreNode* min(const ResolvedCallReferenceNode* fr, ExceptionSink* xsink) const;
365 
367 
371  DLLEXPORT AbstractQoreNode* max(const ResolvedCallReferenceNode* fr, ExceptionSink* xsink) const;
372 
374 
378  DLLEXPORT void splice(qore_offset_t offset, ExceptionSink* xsink);
379 
381 
386  DLLEXPORT void splice(qore_offset_t offset, qore_offset_t length, ExceptionSink* xsink);
387 
389 
397  DLLEXPORT void splice(qore_offset_t offset, qore_offset_t length, const AbstractQoreNode* l, ExceptionSink* xsink);
398 
400 
405  DLLEXPORT QoreListNode* extract(qore_offset_t offset, ExceptionSink* xsink);
406 
408 
414  DLLEXPORT QoreListNode* extract(qore_offset_t offset, qore_offset_t length, ExceptionSink* xsink);
415 
417 
426  DLLEXPORT QoreListNode* extract(qore_offset_t offset, qore_offset_t length, const AbstractQoreNode* l, ExceptionSink* xsink);
427 
429 
431  DLLEXPORT qore_size_t size() const;
432 
434 
436  DLLEXPORT bool empty() const;
437 
439  DLLEXPORT QoreListNode* reverse() const;
440 
442  DLLEXPORT QoreListNode* listRefSelf() const;
443 
445  DLLEXPORT AbstractQoreNode* swap(qore_offset_t offset, AbstractQoreNode* val);
446 
448  DLLEXPORT AbstractQoreNode* takeExists(qore_offset_t offset);
449 
450  // needed only while parsing
452  DLLLOCAL QoreListNode(bool i);
453 
455  DLLLOCAL bool isFinalized() const;
456 
458  DLLLOCAL void setFinalized();
459 
461  DLLLOCAL bool isVariableList() const;
462 
464  DLLLOCAL void setVariableList();
465 
467  DLLLOCAL void clearNeedsEval();
468 
470  DLLLOCAL void setNeedsEval();
471 
473 
477  DLLLOCAL AbstractQoreNode* eval_entry(qore_size_t num, ExceptionSink* xsink) const;
478 
480  DLLLOCAL virtual AbstractQoreNode* parseInit(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo);
481 
483  DLLLOCAL QoreListNode* parseInitList(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo);
484 };
485 
486 #include <qore/ReferenceHolder.h>
487 
489 
493 
495 
515 protected:
516  QoreListNode* l;
517  qore_offset_t pos;
518 
520  DLLLOCAL void *operator new(size_t);
521 
522 public:
524 
527  DLLEXPORT ListIterator(QoreListNode* lst, qore_size_t n_pos = -1);
528 
530 
533  DLLEXPORT ListIterator(QoreListNode& lst, qore_size_t n_pos = -1);
534 
536 
541  DLLEXPORT bool next();
542 
544 
550  DLLEXPORT bool prev();
551 
553 
558  DLLEXPORT int set(qore_size_t n_pos);
559 
561  DLLEXPORT AbstractQoreNode* getValue() const;
562 
564  DLLEXPORT AbstractQoreNode** getValuePtr() const;
565 
567  DLLEXPORT AbstractQoreNode* getReferencedValue() const;
568 
570  DLLEXPORT AbstractQoreNode* takeValue();
571 
573  DLLEXPORT bool first() const;
574 
576  DLLEXPORT bool last() const;
577 
578  //DLLEXPORT void setValue(AbstractQoreNode* val, ExceptionSink* xsink) const;
579 
581  DLLLOCAL qore_size_t index() const { return pos; }
582 
584  DLLLOCAL qore_size_t max() const { return l->size(); }
585 
587  DLLLOCAL QoreListNode* getList() { return l; }
588 
590  DLLLOCAL bool empty() const {
591  return l->empty();
592  }
593 
595  DLLLOCAL bool valid() const {
596  return pos == -1 ? false : true;
597  }
598 };
599 
601 
621 protected:
622  const QoreListNode* l;
623  qore_offset_t pos;
624 
625 public:
627 
630  DLLEXPORT ConstListIterator(const QoreListNode* lst, qore_size_t n_pos = -1);
631 
633 
636  DLLEXPORT ConstListIterator(const QoreListNode& lst, qore_size_t n_pos = -1);
637 
639 
644  DLLEXPORT bool next();
645 
647 
653  DLLEXPORT bool prev();
654 
656 
661  DLLEXPORT int set(qore_size_t n_pos);
662 
664  DLLEXPORT const AbstractQoreNode* getValue() const;
665 
667  DLLEXPORT AbstractQoreNode* getReferencedValue() const;
668 
670  DLLEXPORT bool first() const;
671 
673  DLLEXPORT bool last() const;
674 
676  DLLLOCAL qore_size_t index() const { return pos; }
677 
679  DLLLOCAL qore_size_t max() const { return l->size(); }
680 
682  DLLLOCAL const QoreListNode* getList() const { return l; }
683 
685  DLLLOCAL bool empty() const {
686  return l->empty();
687  }
688 
690  DLLLOCAL bool valid() const {
691  return pos == -1 ? false : true;
692  }
693 
695  DLLEXPORT void reset();
696 };
697 
700 private:
701  QoreListNode* val;
702  ExceptionSink* xsink;
703  bool needs_deref;
704 
705  DLLLOCAL void discard_intern() {
706  if (needs_deref && val)
707  val->deref(xsink);
708  }
709 
710  DLLLOCAL void eval_intern(const QoreListNode* exp) {
711  if (exp)
712  val = exp->evalList(needs_deref, xsink);
713  else {
714  val = 0;
715  needs_deref = false;
716  }
717  }
718 
722  DLLLOCAL QoreListNodeEvalOptionalRefHolder& operator=(const QoreListNodeEvalOptionalRefHolder&);
724  DLLLOCAL void *operator new(size_t);
725 
726 public:
728  DLLLOCAL QoreListNodeEvalOptionalRefHolder(ExceptionSink* n_xsink) : xsink(n_xsink) {
729  needs_deref = false;
730  val = 0;
731  }
732 
734  DLLLOCAL QoreListNodeEvalOptionalRefHolder(const QoreListNode* exp, ExceptionSink* n_xsink) : xsink(n_xsink) {
735  eval_intern(exp);
736  }
737 
740  discard_intern();
741  }
742 
744  DLLLOCAL void discard() {
745  discard_intern();
746  needs_deref = false;
747  val = 0;
748  }
749 
751  DLLLOCAL void assignEval(const QoreListNode* exp) {
752  discard_intern();
753  eval_intern(exp);
754  }
755 
757  DLLLOCAL void assign(bool n_needs_deref, QoreListNode* n_val) {
758  discard_intern();
759  needs_deref = n_needs_deref;
760  val = n_val;
761  }
762 
764  DLLLOCAL bool needsDeref() const {
765  return needs_deref;
766  }
767 
769 
774  if (needs_deref)
775  needs_deref = false;
776  else if (val)
777  val->ref();
778  return val;
779  }
780 
782  DLLLOCAL void edit() {
783  if (!val) {
784  val = new QoreListNode;
785  needs_deref = true;
786  }
787  else if (!needs_deref || !val->is_unique()) {
788  val = val->copy();
789  needs_deref = true;
790  }
791  }
792 
794 
798  DLLLOCAL const QoreListNode* operator->() const { return val; }
799 
801  DLLLOCAL const QoreListNode* operator*() const { return val; }
802 
804  DLLLOCAL operator bool() const { return val != 0; }
805 };
806 
807 #endif
DLLEXPORT AbstractQoreNode * get_referenced_entry(qore_size_t index) const
returns the element at "index" (first element is index 0), the caller owns the reference ...
DLLEXPORT AbstractQoreNode * takeExists(qore_offset_t offset)
takes the value at the given position and replaces with NULL, only if the list position exists ...
DLLLOCAL void setNeedsEval()
this function is not exported in the qore library
DLLLOCAL bool isFinalized() const
this function is not exported in the qore library
DLLEXPORT QoreListNode * sortDescendingStable() const
returns a new list based on executing mergesort on the source list ("this") in descending order ...
DLLEXPORT void pop_entry(qore_size_t index, ExceptionSink *xsink)
DLLEXPORT bool first() const
returns true when the iterator is pointing to the first element in the list
DLLEXPORT ConstListIterator(const QoreListNode *lst, qore_size_t n_pos=-1)
initializes the iterator to the position given or, if omitted, just before the first element ...
DLLEXPORT void merge(const QoreListNode *list)
appends the elements of "list" to this list
DLLLOCAL qore_size_t max() const
returns the number of elements in the list
Definition: QoreListNode.h:679
DLLLOCAL void clearNeedsEval()
this function is not exported in the qore library
virtual DLLEXPORT bool getAsBoolImpl() const
returns false unless perl-boolean-evaluation is enabled, in which case it returns false only when emp...
DLLLOCAL const QoreListNode * getList() const
returns the list
Definition: QoreListNode.h:682
DLLEXPORT bool next()
moves the iterator to the next element, returns true if the iterator is pointing to an element of the...
DLLLOCAL bool valid() const
returns true if the iterator is pointing to a valid element
Definition: QoreListNode.h:690
DLLEXPORT int set(qore_size_t n_pos)
sets the iterator to a specific position in the list
DLLLOCAL bool isVariableList() const
this function is not exported in the qore library
DLLEXPORT ListIterator(QoreListNode *lst, qore_size_t n_pos=-1)
initializes the iterator to the position given or, if omitted, just before the first element ...
DLLLOCAL int mergesort(const ResolvedCallReferenceNode *fr, bool ascending, ExceptionSink *xsink)
mergesort sorts the list in-place (stable)
DLLLOCAL ~QoreListNodeEvalOptionalRefHolder()
clears the object (dereferences the old object if necessary)
Definition: QoreListNode.h:739
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:55
virtual DLLLOCAL AbstractQoreNode * parseInit(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo)
for initialization of lists in the parse tree at parse time (always returns "this") ...
size_t qore_size_t
used for sizes (same range as a pointer)
Definition: common.h:71
DLLEXPORT AbstractQoreNode * getReferencedValue() const
returns the current value with an incremented reference count
DLLLOCAL QoreListNodeEvalOptionalRefHolder(const QoreListNode *exp, ExceptionSink *n_xsink)
performs an optional evaluation of the list (sets the dereference flag)
Definition: QoreListNode.h:734
DLLEXPORT bool next()
moves the iterator to the next element, returns true if the iterator is pointing to an element of the...
For use on the stack only: iterates through a the elements of a QoreListNode.
Definition: QoreListNode.h:514
virtual DLLLOCAL double floatEvalImpl(ExceptionSink *xsink) const
always returns 0.0
DLLEXPORT AbstractQoreNode ** getExistingEntryPtr(qore_size_t index)
DLLEXPORT int getAsString(QoreString &str, int foff, ExceptionSink *xsink) const
concatenate the verbose string representation of the list (including all contained values) to an exis...
DLLLOCAL QoreListNodeEvalOptionalRefHolder(ExceptionSink *n_xsink)
initializes an empty object and saves the ExceptionSink object
Definition: QoreListNode.h:728
DLLEXPORT QoreListNode * listRefSelf() const
returns "this" with an incremented reference count
DLLEXPORT AbstractQoreNode * retrieve_entry(qore_size_t index)
returns the element at "index" (first element is index 0)
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:82
DLLEXPORT AbstractQoreNode * getValue() const
returns a pointer to the value of the list element
DLLEXPORT QoreListNode * copyListFrom(qore_size_t index) const
performs a deep copy of the list starting from element "offset" and returns the new list ...
DLLLOCAL const QoreListNode * operator->() const
returns a pointer to the QoreListNode object being managed
Definition: QoreListNode.h:798
DLLEXPORT QoreListNode * evalList(ExceptionSink *xsink) const
evaluates the list and returns a value (or 0)
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
DLLLOCAL void setFinalized()
this function is not exported in the qore library
DLLEXPORT bool last() const
returns true when the iterator is pointing to the last element in the list
virtual DLLEXPORT ~QoreListNode()
the destructor is protected so it cannot be called directly
DLLLOCAL void discard()
clears the object (dereferences the old object if necessary)
Definition: QoreListNode.h:744
DLLEXPORT bool prev()
moves the iterator to the previous element, returns true if the iterator is pointing to an element of...
DLLEXPORT const AbstractQoreNode * getValue() const
returns a pointer to the value of the list element
DLLLOCAL QoreListNode * getList()
returns the list
Definition: QoreListNode.h:587
DLLLOCAL AbstractQoreNode * eval_entry(qore_size_t num, ExceptionSink *xsink) const
this function is not exported in the qore library
DLLEXPORT AbstractQoreNode * min() const
returns the element having the lowest value (determined by calling OP_LOG_LT - the less-than "<" oper...
DLLEXPORT bool prev()
moves the iterator to the previous element, returns true if the iterator is pointing to an element of...
virtual DLLLOCAL int64 bigIntEvalImpl(ExceptionSink *xsink) const
always returns 0
DLLLOCAL void assignEval(const QoreListNode *exp)
assigns a new value by executing the given list and dereference flag to this object, dereferences the old object if necessary
Definition: QoreListNode.h:751
virtual DLLEXPORT bool is_equal_hard(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality ("deep compare" including all contained values) without type conversions (hard com...
DLLEXPORT AbstractQoreNode * swap(qore_offset_t offset, AbstractQoreNode *val)
swaps the value at the given position with the value given, caller owns any reference returned ...
DLLLOCAL bool needsDeref() const
returns true if the object contains a temporary (evaluated) value that needs a dereference ...
Definition: QoreListNode.h:764
virtual DLLLOCAL int integerEvalImpl(ExceptionSink *xsink) const
always returns 0
virtual DLLEXPORT bool is_equal_soft(const AbstractQoreNode *v, ExceptionSink *xsink) const
tests for equality ("deep compare" including all contained values) with possible type conversion (sof...
DLLLOCAL bool valid() const
returns true if the iterator is pointing to a valid element
Definition: QoreListNode.h:595
DLLLOCAL QoreListNode * eval_intern(ExceptionSink *xsink) const
does an unconditional evaluation of the list and returns the new list, 0 if there is a qore-language ...
DLLLOCAL QoreListNode * parseInitList(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo)
for initialization of lists in the parse tree at parse time (always returns "this") ...
DLLEXPORT AbstractQoreNode * pop()
returns the last element of the list, the length is decremented by one, caller owns the reference ...
DLLEXPORT AbstractQoreNode ** getValuePtr() const
returns a pointer to a pointer of the value of the list element, so it can be changed externally ...
virtual DLLLOCAL bool boolEvalImpl(ExceptionSink *xsink) const
always returns false
DLLEXPORT qore_size_t size() const
returns the number of elements in the list
DLLEXPORT void ref() const
increments the reference count
DLLLOCAL void setVariableList()
this function is not exported in the qore library
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:43
DLLEXPORT int getEntryAsInt(qore_size_t index) const
returns the value of element at "index" as an integer (first element is index 0)
DLLEXPORT void deref(ExceptionSink *xsink)
decrements the reference count and calls derefImpl() if there_can_be_only_one is false, otherwise does nothing
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:228
DLLEXPORT AbstractQoreNode * getReferencedValue() const
returns the current value with an incremented reference count
DLLEXPORT int delete_entry(qore_size_t index, ExceptionSink *xsink)
DLLEXPORT AbstractQoreNode * takeValue()
if the list is unique (has reference count = 1), returns the current value with the reference count t...
intptr_t qore_offset_t
used for offsets that could be negative
Definition: common.h:74
DLLLOCAL bool is_unique() const
returns true if the reference count is 1
Definition: QoreReferenceCounter.h:69
DLLEXPORT QoreListNode * sortStable() const
returns a new list based on executing mergesort on the source list ("this")
DLLEXPORT AbstractQoreNode * max() const
returns the element having the highest value (determined by calling OP_LOG_GT - the greater-than ">" ...
DLLEXPORT void splice(qore_offset_t offset, ExceptionSink *xsink)
truncates the list at position "offset" (first element is offset 0)
base class for resolved call references
Definition: CallReferenceNode.h:130
DLLEXPORT bool last() const
returns true when the iterator is pointing to the last element in the list
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
virtual DLLEXPORT AbstractQoreNode * evalImpl(ExceptionSink *xsink) const
evaluates the list and returns a value (or 0)
DLLLOCAL bool empty() const
returns true if the list is empty
Definition: QoreListNode.h:685
DLLEXPORT bool first() const
returns true when the iterator is pointing to the first element in the list
DLLLOCAL qore_size_t max() const
returns the number of elements in the list
Definition: QoreListNode.h:584
DLLEXPORT void reset()
resets the iterator to its initial state
DLLEXPORT void set_entry(qore_size_t index, AbstractQoreNode *val, ExceptionSink *xsink)
sets the value of a list element
DLLEXPORT QoreListNode * reverse() const
returns a list with the order of the elements reversed
DLLLOCAL const QoreListNode * operator*() const
returns a pointer to the QoreListNode object being managed
Definition: QoreListNode.h:801
DLLLOCAL void assign(bool n_needs_deref, QoreListNode *n_val)
assigns a new value and dereference flag to this object, dereferences the old object if necessary ...
Definition: QoreListNode.h:757
DLLEXPORT AbstractQoreNode ** get_entry_ptr(qore_size_t index)
static DLLLOCAL const char * getStaticTypeName()
returns true if the list does not contain any parse expressions, otherwise returns false ...
Definition: QoreListNode.h:182
DLLLOCAL void edit()
will create a unique list so the list can be edited
Definition: QoreListNode.h:782
DLLEXPORT QoreListNode * copy() const
performs a deep copy of the list and returns the new list
DLLLOCAL qore_size_t index() const
returns the current iterator position in the list or -1 if not pointing at a valid element ...
Definition: QoreListNode.h:676
virtual DLLEXPORT AbstractQoreNode * realCopy() const
returns true if the list contains parse expressions and therefore needs evaluation to return a value...
DLLEXPORT int set(qore_size_t n_pos)
sets the iterator to a specific position in the list
DLLLOCAL bool empty() const
returns true if the list is empty
Definition: QoreListNode.h:590
DLLLOCAL qore_size_t index() const
returns the current iterator position in the list or -1 if not pointing at a valid element ...
Definition: QoreListNode.h:581
DLLEXPORT QoreListNode * sort() const
returns a new list based on quicksorting the source list ("this")
For use on the stack only: manages result of the optional evaluation of a QoreListNode.
Definition: QoreListNode.h:699
DLLEXPORT AbstractQoreNode * shift()
returns the first element of the list, all other entries are moved down to fill up the first position...
DLLEXPORT bool empty() const
returns true if the list is empty
a templated class to manage a reference count of an object that can throw a Qore-language exception w...
Definition: ReferenceHolder.h:51
DLLLOCAL QoreListNode * getReferencedValue()
returns a referenced value - the caller will own the reference
Definition: QoreListNode.h:773
DLLEXPORT QoreListNode * extract(qore_offset_t offset, ExceptionSink *xsink)
truncates the list at position "offset" (first element is offset 0) and returns any elements removed ...
For use on the stack only: iterates through elements of a const QoreListNode.
Definition: QoreListNode.h:620
DLLEXPORT QoreListNode * sortDescending() const
returns a new list based on quicksorting the source list ("this") in descending order ...
struct qore_list_private * priv
this structure holds the private implementation for the type
Definition: QoreListNode.h:67
virtual DLLEXPORT bool derefImpl(ExceptionSink *xsink)
dereferences all elements of the list
DLLLOCAL int qsort(const ResolvedCallReferenceNode *fr, qore_size_t left, qore_size_t right, bool ascending, ExceptionSink *xsink)
qsort sorts the list in-place (unstable)