Qore Programming Language: include/qore/QoreListNode.h (6585) Source File

Qore Programming Language 0.8.11

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
QoreListNode.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3 QoreListNode.h
4
5 Qore Programming Language
6
7 Copyright 2003 - 2013 David Nichols
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License aqore_offset_t with this library; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24 #ifndef _QORE_QORELISTNODE_H
25
26 #define _QORE_QORELISTNODE_H
27
28 #include <qore/AbstractQoreNode.h>
29
30 #ifdef min
31 #undef min
32 #endif
33 #ifdef max
34 #undef max
35 #endif
36
37 class ResolvedCallReferenceNode;
38
40
44 class QoreListNode : public AbstractQoreNode {
45 friend class StackList;
46
47 private:
49 DLLLOCAL QoreListNode(const QoreListNode&);
50
52 DLLLOCAL QoreListNode& operator=(const QoreListNode&);
53
54 protected:
56
58 struct qore_list_private *priv;
59
60 DLLLOCAL void resize(qore_size_t num);
61 DLLLOCAL QoreListNode* splice_intern(qore_size_t offset, qore_size_t length, ExceptionSink* xsink, bool extract = false);
62 DLLLOCAL QoreListNode* splice_intern(qore_size_t offset, qore_size_t length, const AbstractQoreNode* l, ExceptionSink* xsink, bool extract = false);
63 DLLLOCAL qore_size_t check_offset(qore_offset_t offset);
64 DLLLOCAL void check_offset(qore_offset_t offset, qore_offset_t len, qore_size_t &n_offset, qore_size_t &n_len);
65
67
69 DLLLOCAL int qsort(const ResolvedCallReferenceNode* fr, qore_size_t left, qore_size_t right, bool ascending, ExceptionSink* xsink);
70
72
74 DLLLOCAL int mergesort(const ResolvedCallReferenceNode* fr, bool ascending, ExceptionSink* xsink);
75
77 DLLLOCAL QoreListNode* eval_intern(ExceptionSink* xsink) const;
78
80
84 DLLEXPORT virtual ~QoreListNode();
85
87
93 DLLEXPORT virtual bool derefImpl(ExceptionSink* xsink);
94
96
100 DLLEXPORT virtual AbstractQoreNode* evalImpl(ExceptionSink* xsink) const;
101
103
106 DLLLOCAL virtual AbstractQoreNode* evalImpl(bool &needs_deref, ExceptionSink* xsink) const;
107
109 DLLLOCAL virtual int64 bigIntEvalImpl(ExceptionSink* xsink) const;
110
112 DLLLOCAL virtual int integerEvalImpl(ExceptionSink* xsink) const;
113
115 DLLLOCAL virtual bool boolEvalImpl(ExceptionSink* xsink) const;
116
118 DLLLOCAL virtual double floatEvalImpl(ExceptionSink* xsink) const;
119
120 public:
121 DLLEXPORT QoreListNode();
122
124
126 DLLEXPORT virtual bool getAsBoolImpl() const;
127
129
135 DLLEXPORT int getAsString(QoreString &str, int foff, ExceptionSink* xsink) const;
136
138
145 DLLEXPORT QoreString *getAsString(bool &del, int foff, ExceptionSink* xsink) const;
146
148 //DLLEXPORT virtual bool needs_eval() const;
149
151 DLLEXPORT virtual AbstractQoreNode* realCopy() const;
152
154
158 DLLEXPORT virtual bool is_equal_soft(const AbstractQoreNode* v, ExceptionSink* xsink) const;
159
161
165 DLLEXPORT virtual bool is_equal_hard(const AbstractQoreNode* v, ExceptionSink* xsink) const;
166
168 DLLEXPORT virtual const char *getTypeName() const;
169
171 //DLLEXPORT virtual bool is_value() const;
172
173 DLLLOCAL static const char *getStaticTypeName() {
174 return "list";
175 }
176
178
182 DLLEXPORT AbstractQoreNode* retrieve_entry(qore_size_t index);
183
185
189 DLLEXPORT const AbstractQoreNode* retrieve_entry(qore_size_t index) const;
190
192
196 DLLEXPORT AbstractQoreNode* get_referenced_entry(qore_size_t index) const;
197
199
202 DLLEXPORT int getEntryAsInt(qore_size_t index) const;
203
207 DLLEXPORT AbstractQoreNode** get_entry_ptr(qore_size_t index);
208
212 DLLEXPORT AbstractQoreNode** getExistingEntryPtr(qore_size_t index);
213
215
222 DLLEXPORT void set_entry(qore_size_t index, AbstractQoreNode* val, ExceptionSink* xsink);
223
224 DLLEXPORT void push(AbstractQoreNode* val);
225 DLLEXPORT void insert(AbstractQoreNode* val);
226
228
230 DLLEXPORT AbstractQoreNode* pop();
231
233
236 DLLEXPORT AbstractQoreNode* shift();
237
239 DLLEXPORT void merge(const QoreListNode* list);
240
246 DLLEXPORT int delete_entry(qore_size_t index, ExceptionSink* xsink);
247
252 DLLEXPORT void pop_entry(qore_size_t index, ExceptionSink* xsink);
253
255
261 DLLEXPORT QoreListNode* evalList(ExceptionSink* xsink) const;
262
264
271 DLLEXPORT QoreListNode* evalList(bool &needs_deref, ExceptionSink* xsink) const;
272
274 DLLEXPORT QoreListNode* copy() const;
275
277
280 DLLEXPORT QoreListNode* copyListFrom(qore_size_t index) const;
281
283
286 DLLEXPORT QoreListNode* sort() const;
287
289
293 DLLEXPORT QoreListNode* sort(const ResolvedCallReferenceNode* fr, ExceptionSink* xsink) const;
294
296
299 DLLEXPORT QoreListNode* sortStable() const;
300
302
306 DLLEXPORT QoreListNode* sortStable(const ResolvedCallReferenceNode* fr, ExceptionSink* xsink) const;
307
309
312 DLLEXPORT QoreListNode* sortDescending() const;
313
315
319 DLLEXPORT QoreListNode* sortDescending(const ResolvedCallReferenceNode* fr, ExceptionSink* xsink) const;
320
322
325 DLLEXPORT QoreListNode* sortDescendingStable() const;
326
328
332 DLLEXPORT QoreListNode* sortDescendingStable(const ResolvedCallReferenceNode* fr, ExceptionSink* xsink) const;
333
335
338 DLLEXPORT AbstractQoreNode* min() const;
339
341
344 DLLEXPORT AbstractQoreNode* max() const;
345
347
351 DLLEXPORT AbstractQoreNode* min(const ResolvedCallReferenceNode* fr, ExceptionSink* xsink) const;
352
354
358 DLLEXPORT AbstractQoreNode* max(const ResolvedCallReferenceNode* fr, ExceptionSink* xsink) const;
359
361
365 DLLEXPORT void splice(qore_offset_t offset, ExceptionSink* xsink);
366
368
373 DLLEXPORT void splice(qore_offset_t offset, qore_offset_t length, ExceptionSink* xsink);
374
376
384 DLLEXPORT void splice(qore_offset_t offset, qore_offset_t length, const AbstractQoreNode* l, ExceptionSink* xsink);
385
387
392 DLLEXPORT QoreListNode* extract(qore_offset_t offset, ExceptionSink* xsink);
393
395
401 DLLEXPORT QoreListNode* extract(qore_offset_t offset, qore_offset_t length, ExceptionSink* xsink);
402
404
413 DLLEXPORT QoreListNode* extract(qore_offset_t offset, qore_offset_t length, const AbstractQoreNode* l, ExceptionSink* xsink);
414
416
418 DLLEXPORT qore_size_t size() const;
419
421
423 DLLEXPORT bool empty() const;
424
426 DLLEXPORT QoreListNode* reverse() const;
427
429 DLLEXPORT QoreListNode* listRefSelf() const;
430
432 DLLEXPORT AbstractQoreNode* swap(qore_offset_t offset, AbstractQoreNode* val);
433
435 DLLEXPORT AbstractQoreNode* takeExists(qore_offset_t offset);
436
437 // needed only while parsing
439 DLLLOCAL QoreListNode(bool i);
440
442 DLLLOCAL bool isFinalized() const;
443
445 DLLLOCAL void setFinalized();
446
448 DLLLOCAL bool isVariableList() const;
449
451 DLLLOCAL void setVariableList();
452
454 DLLLOCAL void clearNeedsEval();
455
457 DLLLOCAL void setNeedsEval();
458
460 DLLLOCAL void clear();
461
463
467 DLLLOCAL AbstractQoreNode* eval_entry(qore_size_t num, ExceptionSink* xsink) const;
468
470 DLLLOCAL virtual AbstractQoreNode* parseInit(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo);
471
473 DLLLOCAL QoreListNode* parseInitList(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo);
474 };
475
476 #include <qore/ReferenceHolder.h>
477
479
482 typedef ReferenceHolder<QoreListNode> QoreListNodeHolder;
483
485
504 class ListIterator {
505 protected:
506 QoreListNode* l;
507 qore_offset_t pos;
508
510 DLLLOCAL void *operator new(size_t);
511
512 public:
514
517 DLLEXPORT ListIterator(QoreListNode* lst, qore_size_t n_pos = -1);
518
520
523 DLLEXPORT ListIterator(QoreListNode& lst, qore_size_t n_pos = -1);
524
526
531 DLLEXPORT bool next();
532
534
540 DLLEXPORT bool prev();
541
543
548 DLLEXPORT int set(qore_size_t n_pos);
549
551 DLLEXPORT AbstractQoreNode* getValue() const;
552
554 DLLEXPORT AbstractQoreNode** getValuePtr() const;
555
557 DLLEXPORT AbstractQoreNode* getReferencedValue() const;
558
560 DLLEXPORT AbstractQoreNode* takeValue();
561
563 DLLEXPORT bool first() const;
564
566 DLLEXPORT bool last() const;
567
568 //DLLEXPORT void setValue(AbstractQoreNode* val, ExceptionSink* xsink) const;
569
571 DLLLOCAL qore_size_t index() const { return pos; }
572
574 DLLLOCAL qore_size_t max() const { return l->size(); }
575
577 DLLLOCAL QoreListNode* getList() { return l; }
578
580 DLLLOCAL bool empty() const {
581 return l->empty();
582 }
583
585 DLLLOCAL bool valid() const {
586 return pos == -1 ? false : true;
587 }
588 };
589
591
610 class ConstListIterator {
611 protected:
612 const QoreListNode* l;
613 qore_offset_t pos;
614
615 public:
617
620 DLLEXPORT ConstListIterator(const QoreListNode* lst, qore_size_t n_pos = -1);
621
623
626 DLLEXPORT ConstListIterator(const QoreListNode& lst, qore_size_t n_pos = -1);
627
629
634 DLLEXPORT bool next();
635
637
643 DLLEXPORT bool prev();
644
646
651 DLLEXPORT int set(qore_size_t n_pos);
652
654 DLLEXPORT const AbstractQoreNode* getValue() const;
655
657 DLLEXPORT AbstractQoreNode* getReferencedValue() const;
658
660 DLLEXPORT bool first() const;
661
663 DLLEXPORT bool last() const;
664
666 DLLLOCAL qore_size_t index() const { return pos; }
667
669 DLLLOCAL qore_size_t max() const { return l->size(); }
670
672 DLLLOCAL const QoreListNode* getList() const { return l; }
673
675 DLLLOCAL bool empty() const {
676 return l->empty();
677 }
678
680 DLLLOCAL bool valid() const {
681 return pos == -1 ? false : true;
682 }
683
685 DLLEXPORT void reset();
686 };
687
689 class QoreListNodeEvalOptionalRefHolder {
690 private:
691 QoreListNode* val;
692 ExceptionSink* xsink;
693 bool needs_deref;
694
695 DLLLOCAL void discard_intern() {
696 if (needs_deref && val)
697 val->deref(xsink);
698 }
699
700 DLLLOCAL void eval_intern(const QoreListNode* exp) {
701 if (exp)
702 val = exp->evalList(needs_deref, xsink);
703 else {
704 val = 0;
705 needs_deref = false;
706 }
707 }
708
710 DLLLOCAL QoreListNodeEvalOptionalRefHolder(const QoreListNodeEvalOptionalRefHolder&);
712 DLLLOCAL QoreListNodeEvalOptionalRefHolder& operator=(const QoreListNodeEvalOptionalRefHolder&);
714 DLLLOCAL void *operator new(size_t);
715
716 public:
718 DLLLOCAL QoreListNodeEvalOptionalRefHolder(ExceptionSink* n_xsink) : xsink(n_xsink) {
719 needs_deref = false;
720 val = 0;
721 }
722
724 DLLLOCAL QoreListNodeEvalOptionalRefHolder(const QoreListNode* exp, ExceptionSink* n_xsink) : xsink(n_xsink) {
725 eval_intern(exp);
726 }
727
729 DLLLOCAL ~QoreListNodeEvalOptionalRefHolder() {
730 discard_intern();
731 }
732
734 DLLLOCAL void discard() {
735 discard_intern();
736 needs_deref = false;
737 val = 0;
738 }
739
741 DLLLOCAL void assignEval(const QoreListNode* exp) {
742 discard_intern();
743 eval_intern(exp);
744 }
745
747 DLLLOCAL void assign(bool n_needs_deref, QoreListNode* n_val) {
748 discard_intern();
749 needs_deref = n_needs_deref;
750 val = n_val;
751 }
752
754 DLLLOCAL bool needsDeref() const {
755 return needs_deref;
756 }
757
759
763 DLLLOCAL QoreListNode* getReferencedValue() {
764 if (needs_deref)
765 needs_deref = false;
766 else if (val)
767 val->ref();
768 return val;
769 }
770
772 DLLLOCAL void edit() {
773 if (!val) {
774 val = new QoreListNode;
775 needs_deref = true;
776 }
777 else if (!needs_deref || !val->is_unique()) {
778 val = val->copy();
779 needs_deref = true;
780 }
781 }
782
784
788 DLLLOCAL const QoreListNode* operator->() const { return val; }
789
791 DLLLOCAL const QoreListNode* operator*() const { return val; }
792
794 DLLLOCAL operator bool() const { return val != 0; }
795 };
796
797 #endif
QoreListNode::get_referenced_entry
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 ...
QoreListNode::takeExists
DLLEXPORT AbstractQoreNode * takeExists(qore_offset_t offset)
takes the value at the given position and replaces with NULL, only if the list position exists ...
QoreListNode::setNeedsEval
DLLLOCAL void setNeedsEval()
this function is not exported in the qore library
QoreListNode::isFinalized
DLLLOCAL bool isFinalized() const
this function is not exported in the qore library
QoreListNode::sortDescendingStable
DLLEXPORT QoreListNode * sortDescendingStable() const
returns a new list based on executing mergesort on the source list ("this") in descending order ...
QoreListNode::pop_entry
DLLEXPORT void pop_entry(qore_size_t index, ExceptionSink *xsink)
ConstListIterator::first
DLLEXPORT bool first() const
returns true when the iterator is pointing to the first element in the list
ConstListIterator::ConstListIterator
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 ...
QoreListNode::merge
DLLEXPORT void merge(const QoreListNode *list)
appends the elements of "list" to this list
ConstListIterator::max
DLLLOCAL qore_size_t max() const
returns the number of elements in the list
Definition: QoreListNode.h:669
QoreListNode::clearNeedsEval
DLLLOCAL void clearNeedsEval()
this function is not exported in the qore library
QoreListNode::getAsBoolImpl
virtual DLLEXPORT bool getAsBoolImpl() const
returns false unless perl-boolean-evaluation is enabled, in which case it returns false only when emp...
ConstListIterator::getList
DLLLOCAL const QoreListNode * getList() const
returns the list
Definition: QoreListNode.h:672
ConstListIterator::next
DLLEXPORT bool next()
moves the iterator to the next element, returns true if the iterator is pointing to an element of the...
ConstListIterator::valid
DLLLOCAL bool valid() const
returns true if the iterator is pointing to a valid element
Definition: QoreListNode.h:680
ListIterator::set
DLLEXPORT int set(qore_size_t n_pos)
sets the iterator to a specific position in the list
QoreListNode::isVariableList
DLLLOCAL bool isVariableList() const
this function is not exported in the qore library
ListIterator::ListIterator
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 ...
QoreListNode::mergesort
DLLLOCAL int mergesort(const ResolvedCallReferenceNode *fr, bool ascending, ExceptionSink *xsink)
mergesort sorts the list in-place (stable)
QoreListNodeEvalOptionalRefHolder::~QoreListNodeEvalOptionalRefHolder
DLLLOCAL ~QoreListNodeEvalOptionalRefHolder()
clears the object (dereferences the old object if necessary)
Definition: QoreListNode.h:729
AbstractQoreNode
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:47
QoreListNode::parseInit
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") ...
qore_size_t
size_t qore_size_t
used for sizes (same range as a pointer)
Definition: common.h:62
ConstListIterator::getReferencedValue
DLLEXPORT AbstractQoreNode * getReferencedValue() const
returns the current value with an incremented reference count
qore_offset_t
long qore_offset_t
used for offsets that could be negative
Definition: common.h:65
QoreListNodeEvalOptionalRefHolder::QoreListNodeEvalOptionalRefHolder
DLLLOCAL QoreListNodeEvalOptionalRefHolder(const QoreListNode *exp, ExceptionSink *n_xsink)
performs an optional evaluation of the list (sets the dereference flag)
Definition: QoreListNode.h:724
QoreListNode::clear
DLLLOCAL void clear()
this function is not exported in the qore library
ListIterator::next
DLLEXPORT bool next()
moves the iterator to the next element, returns true if the iterator is pointing to an element of the...
ListIterator
For use on the stack only: iterates through a the elements of a QoreListNode.
Definition: QoreListNode.h:504
QoreListNode::floatEvalImpl
virtual DLLLOCAL double floatEvalImpl(ExceptionSink *xsink) const
always returns 0.0
QoreListNode::getExistingEntryPtr
DLLEXPORT AbstractQoreNode ** getExistingEntryPtr(qore_size_t index)
QoreListNode::getAsString
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...
QoreListNodeEvalOptionalRefHolder::QoreListNodeEvalOptionalRefHolder
DLLLOCAL QoreListNodeEvalOptionalRefHolder(ExceptionSink *n_xsink)
initializes an empty object and saves the ExceptionSink object
Definition: QoreListNode.h:718
QoreListNode::listRefSelf
DLLEXPORT QoreListNode * listRefSelf() const
returns "this" with an incremented reference count
QoreListNode::retrieve_entry
DLLEXPORT AbstractQoreNode * retrieve_entry(qore_size_t index)
returns the element at "index" (first element is index 0)
QoreString
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:42
ListIterator::getValue
DLLEXPORT AbstractQoreNode * getValue() const
returns a pointer to the value of the list element
QoreListNode::copyListFrom
DLLEXPORT QoreListNode * copyListFrom(qore_size_t index) const
performs a deep copy of the list starting from element "offset" and returns the new list ...
QoreListNodeEvalOptionalRefHolder::operator->
DLLLOCAL const QoreListNode * operator->() const
returns a pointer to the QoreListNode object being managed
Definition: QoreListNode.h:788
QoreListNode::evalList
DLLEXPORT QoreListNode * evalList(ExceptionSink *xsink) const
evaluates the list and returns a value (or 0)
QoreListNode
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:44
QoreListNode::setFinalized
DLLLOCAL void setFinalized()
this function is not exported in the qore library
ConstListIterator::last
DLLEXPORT bool last() const
returns true when the iterator is pointing to the last element in the list
QoreListNode::~QoreListNode
virtual DLLEXPORT ~QoreListNode()
the destructor is protected so it cannot be called directly
QoreListNodeEvalOptionalRefHolder::discard
DLLLOCAL void discard()
clears the object (dereferences the old object if necessary)
Definition: QoreListNode.h:734
ConstListIterator::prev
DLLEXPORT bool prev()
moves the iterator to the previous element, returns true if the iterator is pointing to an element of...
ConstListIterator::getValue
DLLEXPORT const AbstractQoreNode * getValue() const
returns a pointer to the value of the list element
ListIterator::getList
DLLLOCAL QoreListNode * getList()
returns the list
Definition: QoreListNode.h:577
QoreListNode::eval_entry
DLLLOCAL AbstractQoreNode * eval_entry(qore_size_t num, ExceptionSink *xsink) const
this function is not exported in the qore library
QoreListNode::min
DLLEXPORT AbstractQoreNode * min() const
returns the element having the lowest value (determined by calling OP_LOG_LT - the less-than "<" oper...
ListIterator::prev
DLLEXPORT bool prev()
moves the iterator to the previous element, returns true if the iterator is pointing to an element of...
QoreListNode::bigIntEvalImpl
virtual DLLLOCAL int64 bigIntEvalImpl(ExceptionSink *xsink) const
always returns 0
QoreListNodeEvalOptionalRefHolder::assignEval
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:741
QoreListNode::is_equal_hard
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...
QoreListNode::swap
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 ...
QoreListNodeEvalOptionalRefHolder::needsDeref
DLLLOCAL bool needsDeref() const
returns true if the object contains a temporary (evaluated) value that needs a dereference ...
Definition: QoreListNode.h:754
QoreListNode::integerEvalImpl
virtual DLLLOCAL int integerEvalImpl(ExceptionSink *xsink) const
always returns 0
QoreListNode::is_equal_soft
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...
ListIterator::valid
DLLLOCAL bool valid() const
returns true if the iterator is pointing to a valid element
Definition: QoreListNode.h:585
QoreListNode::eval_intern
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 ...
QoreListNode::parseInitList
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") ...
QoreListNode::pop
DLLEXPORT AbstractQoreNode * pop()
returns the last element of the list, the length is decremented by one, caller owns the reference ...
ListIterator::getValuePtr
DLLEXPORT AbstractQoreNode ** getValuePtr() const
returns a pointer to a pointer of the value of the list element, so it can be changed externally ...
QoreListNode::boolEvalImpl
virtual DLLLOCAL bool boolEvalImpl(ExceptionSink *xsink) const
always returns false
QoreListNode::size
DLLEXPORT qore_size_t size() const
returns the number of elements in the list
AbstractQoreNode::ref
DLLEXPORT void ref() const
increments the reference count
QoreListNode::setVariableList
DLLLOCAL void setVariableList()
this function is not exported in the qore library
ExceptionSink
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:35
QoreListNode::getEntryAsInt
DLLEXPORT int getEntryAsInt(qore_size_t index) const
returns the value of element at "index" as an integer (first element is index 0)
AbstractQoreNode::deref
DLLEXPORT void deref(ExceptionSink *xsink)
decrements the reference count and calls derefImpl() if there_can_be_only_one is false, otherwise does nothing
ListIterator::getReferencedValue
DLLEXPORT AbstractQoreNode * getReferencedValue() const
returns the current value with an incremented reference count
QoreListNode::delete_entry
DLLEXPORT int delete_entry(qore_size_t index, ExceptionSink *xsink)
ListIterator::takeValue
DLLEXPORT AbstractQoreNode * takeValue()
if the list is unique (has reference count = 1), returns the current value with the reference count t...
QoreReferenceCounter::is_unique
DLLLOCAL bool is_unique() const
returns true if the reference count is 1
Definition: QoreReferenceCounter.h:61
QoreListNode::sortStable
DLLEXPORT QoreListNode * sortStable() const
returns a new list based on executing mergesort on the source list ("this")
QoreListNode::max
DLLEXPORT AbstractQoreNode * max() const
returns the element having the highest value (determined by calling OP_LOG_GT - the greater-than ">" ...
QoreListNode::splice
DLLEXPORT void splice(qore_offset_t offset, ExceptionSink *xsink)
truncates the list at position "offset" (first element is offset 0)
ResolvedCallReferenceNode
base class for resolved call references
Definition: CallReferenceNode.h:120
ListIterator::last
DLLEXPORT bool last() const
returns true when the iterator is pointing to the last element in the list
QoreListNode::getTypeName
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
QoreListNode::evalImpl
virtual DLLEXPORT AbstractQoreNode * evalImpl(ExceptionSink *xsink) const
evaluates the list and returns a value (or 0)
ConstListIterator::empty
DLLLOCAL bool empty() const
returns true if the list is empty
Definition: QoreListNode.h:675
ListIterator::first
DLLEXPORT bool first() const
returns true when the iterator is pointing to the first element in the list
ListIterator::max
DLLLOCAL qore_size_t max() const
returns the number of elements in the list
Definition: QoreListNode.h:574
ConstListIterator::reset
DLLEXPORT void reset()
resets the iterator to its initial state
QoreListNode::set_entry
DLLEXPORT void set_entry(qore_size_t index, AbstractQoreNode *val, ExceptionSink *xsink)
sets the value of a list element
QoreListNode::reverse
DLLEXPORT QoreListNode * reverse() const
returns a list with the order of the elements reversed
QoreListNodeEvalOptionalRefHolder::operator*
DLLLOCAL const QoreListNode * operator*() const
returns a pointer to the QoreListNode object being managed
Definition: QoreListNode.h:791
QoreListNodeEvalOptionalRefHolder::assign
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:747
QoreListNode::get_entry_ptr
DLLEXPORT AbstractQoreNode ** get_entry_ptr(qore_size_t index)
QoreListNode::getStaticTypeName
static DLLLOCAL const char * getStaticTypeName()
returns true if the list does not contain any parse expressions, otherwise returns false ...
Definition: QoreListNode.h:173
QoreListNodeEvalOptionalRefHolder::edit
DLLLOCAL void edit()
will create a unique list so the list can be edited
Definition: QoreListNode.h:772
QoreListNode::copy
DLLEXPORT QoreListNode * copy() const
performs a deep copy of the list and returns the new list
ConstListIterator::index
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:666
QoreListNode::realCopy
virtual DLLEXPORT AbstractQoreNode * realCopy() const
returns true if the list contains parse expressions and therefore needs evaluation to return a value...
ConstListIterator::set
DLLEXPORT int set(qore_size_t n_pos)
sets the iterator to a specific position in the list
ListIterator::empty
DLLLOCAL bool empty() const
returns true if the list is empty
Definition: QoreListNode.h:580
ListIterator::index
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:571
QoreListNode::sort
DLLEXPORT QoreListNode * sort() const
returns a new list based on quicksorting the source list ("this")
QoreListNodeEvalOptionalRefHolder
For use on the stack only: manages result of the optional evaluation of a QoreListNode.
Definition: QoreListNode.h:689
QoreListNode::shift
DLLEXPORT AbstractQoreNode * shift()
returns the first element of the list, all other entries are moved down to fill up the first position...
QoreListNode::empty
DLLEXPORT bool empty() const
returns true if the list is empty
ReferenceHolder
a templated class to manage a reference count of an object that can throw a Qore-language exception w...
Definition: ReferenceHolder.h:43
QoreListNodeEvalOptionalRefHolder::getReferencedValue
DLLLOCAL QoreListNode * getReferencedValue()
returns a referenced value - the caller will own the reference
Definition: QoreListNode.h:763
QoreListNode::extract
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 ...
ConstListIterator
For use on the stack only: iterates through elements of a const QoreListNode.
Definition: QoreListNode.h:610
QoreListNode::sortDescending
DLLEXPORT QoreListNode * sortDescending() const
returns a new list based on quicksorting the source list ("this") in descending order ...
QoreListNode::priv
struct qore_list_private * priv
this structure holds the private implementation for the type
Definition: QoreListNode.h:58
QoreListNode::derefImpl
virtual DLLEXPORT bool derefImpl(ExceptionSink *xsink)
dereferences all elements of the list
QoreListNode::qsort
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)