32 #ifndef _QORE_QOREVALUELIST_H
34 #define _QORE_QOREVALUELIST_H
36 #include <qore/AbstractQoreNode.h>
46 friend struct qore_value_list_private;
47 friend class QoreValueListEvalOptionalRefHolder;
54 DLLLOCAL QoreValueList& operator=(
const QoreValueList&);
60 struct qore_value_list_private*
priv;
195 DLLEXPORT
void push(QoreValue val);
196 DLLEXPORT
void insert(QoreValue val);
201 DLLEXPORT QoreValue
pop();
207 DLLEXPORT QoreValue
shift();
210 DLLEXPORT
void merge(
const QoreValueList* list);
232 DLLEXPORT QoreValueList*
copy()
const;
238 DLLEXPORT QoreValueList*
copyListFrom(
size_t index)
const;
348 DLLEXPORT QoreValueList*
splice(ptrdiff_t offset, ptrdiff_t length,
const QoreValue l,
ExceptionSink* xsink);
377 DLLEXPORT QoreValueList*
extract(ptrdiff_t offset, ptrdiff_t length,
const QoreValue l,
ExceptionSink* xsink);
392 DLLEXPORT
size_t size()
const;
397 DLLEXPORT
bool empty()
const;
400 DLLEXPORT QoreValueList*
reverse()
const;
406 DLLEXPORT QoreValue
swap(ptrdiff_t offset, QoreValue val);
409 DLLEXPORT QoreValue
takeExists(ptrdiff_t offset);
412 #include <qore/ReferenceHolder.h>
446 DLLLOCAL
void *
operator new(size_t);
467 DLLEXPORT
bool next();
476 DLLEXPORT
bool prev();
484 DLLEXPORT
int set(
size_t n_pos);
487 DLLEXPORT QoreValue
getValue()
const;
496 DLLEXPORT
bool first()
const;
499 DLLEXPORT
bool last()
const;
504 DLLLOCAL
size_t index()
const {
return pos; }
507 DLLLOCAL
size_t max()
const {
return l->
size(); }
519 return pos == -1 ?
false :
true;
567 DLLEXPORT
bool next();
576 DLLEXPORT
bool prev();
584 DLLEXPORT
int set(
size_t n_pos);
587 DLLEXPORT
const QoreValue
getValue()
const;
593 DLLEXPORT
bool first()
const;
596 DLLEXPORT
bool last()
const;
599 DLLLOCAL
size_t index()
const {
return pos; }
602 DLLLOCAL
size_t max()
const {
return l->
size(); }
614 return pos == -1 ?
false :
true;
618 DLLEXPORT
void reset();
DLLEXPORT bool first() const
returns true when the iterator is pointing to the first element in the list
DLLEXPORT bool prev()
moves the iterator to the previous element, returns true if the iterator is pointing to an element of...
DLLEXPORT QoreValue swap(ptrdiff_t offset, QoreValue val)
swaps the value at the given position with the value given, caller owns any reference returned ...
DLLEXPORT ValueListIterator(QoreValueList *lst, size_t n_pos=-1)
initializes the iterator to the position given or, if omitted, just before the first element ...
For use on the stack only: iterates through a the elements of a QoreValueList.
Definition: QoreValueList.h:440
DLLEXPORT bool first() const
returns true when the iterator is pointing to the first element in the list
DLLEXPORT QoreValueList * evalList(ExceptionSink *xsink) const
evaluates the list and returns a value (or 0)
DLLLOCAL QoreValueList * getList()
returns the list
Definition: QoreValueList.h:510
DLLEXPORT const QoreValue getValue() const
returns a pointer to the value of the list element
DLLEXPORT int set(size_t n_pos)
sets the iterator to a specific position in the list
DLLEXPORT int set(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: QoreValueList.h:608
DLLEXPORT QoreValue takeExists(ptrdiff_t offset)
takes the value at the given position and replaces with NULL, only if the list position exists ...
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreValueList.h:45
DLLLOCAL size_t index() const
returns the current iterator position in the list or -1 if not pointing at a valid element ...
Definition: QoreValueList.h:504
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:55
DLLLOCAL bool valid() const
returns true if the iterator is pointing to a valid element
Definition: QoreValueList.h:518
DLLEXPORT QoreValue getValue() const
returns a pointer to the value of the list element
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...
DLLEXPORT QoreValueList * splice(ptrdiff_t offset, ExceptionSink *xsink)
truncates the list at position "offset" (first element is offset 0)
virtual DLLEXPORT AbstractQoreNode * realCopy() const
returns true if the list contains parse expressions and therefore needs evaluation to return a value...
DLLEXPORT ConstValueListIterator(const QoreValueList *lst, size_t n_pos=-1)
initializes the iterator to the position given or, if omitted, just before the first element ...
DLLEXPORT bool last() const
returns true when the iterator is pointing to the last element in the list
DLLLOCAL const QoreValueList * getList() const
returns the list
Definition: QoreValueList.h:605
virtual DLLLOCAL bool boolEvalImpl(ExceptionSink *xsink) const
always returns false
virtual DLLLOCAL int64 bigIntEvalImpl(ExceptionSink *xsink) const
always returns 0
DLLEXPORT QoreValue * getExistingEntryPtr(size_t index)
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:82
DLLEXPORT QoreValue shift()
returns the first element of the list, all other entries are moved down to fill up the first position...
virtual DLLEXPORT bool getAsBoolImpl() const
returns false unless perl-boolean-evaluation is enabled, in which case it returns false only when emp...
struct qore_value_list_private * priv
this structure holds the private implementation for the type
Definition: QoreValueList.h:60
DLLEXPORT bool prev()
moves the iterator to the previous element, returns true if the iterator is pointing to an element of...
DLLEXPORT QoreValueList * sortDescending(ExceptionSink *xsink) const
returns a new list based on quicksorting the source list ("this") in descending order ...
DLLEXPORT QoreValueList * copyListFrom(size_t index) const
performs a deep copy of the list starting from element "offset" and returns the new list ...
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
DLLEXPORT QoreValue getReferencedEntry(size_t index) const
returns the element at "index" (first element is index 0), the caller owns the reference ...
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 QoreValueList * sort(ExceptionSink *xsink) const
returns a new list based on quicksorting the source list ("this")
DLLLOCAL bool empty() const
returns true if the list is empty
Definition: QoreValueList.h:513
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...
DLLEXPORT bool empty() const
returns true if the list is empty
static DLLLOCAL const char * getStaticTypeName()
returns true if the list does not contain any parse expressions, otherwise returns false ...
Definition: QoreValueList.h:160
DLLLOCAL size_t index() const
returns the current iterator position in the list or -1 if not pointing at a valid element ...
Definition: QoreValueList.h:599
DLLEXPORT QoreValue minValue(ExceptionSink *xsink) const
returns the element having the lowest value (determined by calling OP_LOG_LT - the less-than "<" oper...
DLLEXPORT QoreValue maxValue(ExceptionSink *xsink) const
returns the element having the highest value (determined by calling OP_LOG_GT - the greater-than ">" ...
DLLEXPORT QoreValueList * listRefSelf() const
returns "this" with an incremented reference count
DLLLOCAL QoreListNode * getOldList() const
returns a QoreListNode object corresponding to the current list
virtual DLLLOCAL double floatEvalImpl(ExceptionSink *xsink) const
always returns 0.0
For use on the stack only: iterates through elements of a const QoreValueList.
Definition: QoreValueList.h:543
DLLEXPORT QoreValueList * reverse() const
returns a list with the order of the elements reversed
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:43
DLLEXPORT QoreValueList * copy() const
performs a deep copy of the list and returns the new list
DLLLOCAL bool valid() const
returns true if the iterator is pointing to a valid element
Definition: QoreValueList.h:613
virtual DLLEXPORT const char * getTypeName() const
returns the type name as a c string
DLLEXPORT void merge(const QoreValueList *list)
appends the elements of "list" to this list
virtual DLLEXPORT ~QoreValueList()
the destructor is protected so it cannot be called directly
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 QoreValueList * extract(ptrdiff_t offset, ExceptionSink *xsink)
truncates the list at position "offset" (first element is offset 0) and returns any elements removed ...
DLLEXPORT QoreValue getReferencedValue() const
returns the current value with an incremented reference count
DLLEXPORT size_t size() const
returns the number of elements in the list
virtual DLLEXPORT AbstractQoreNode * evalImpl(ExceptionSink *xsink) const
evaluates the list and returns a value (or 0)
base class for resolved call references
Definition: CallReferenceNode.h:130
DLLEXPORT QoreValue * getValueReference() const
returns a pointer to a pointer of the value of the list element, so it can be changed externally ...
DLLEXPORT QoreValue retrieveEntry(size_t index)
returns the element at "index" (first element is index 0)
DLLEXPORT void reset()
resets the iterator to its initial state
virtual DLLEXPORT bool derefImpl(ExceptionSink *xsink)
dereferences all elements of the list
DLLEXPORT bool last() const
returns true when the iterator is pointing to the last element in the list
DLLEXPORT QoreValueList * sortDescendingStable(ExceptionSink *xsink) const
returns a new list based on executing mergesort on the source list ("this") in descending order ...
DLLEXPORT QoreValue & getEntryReference(size_t index)
DLLLOCAL size_t max() const
returns the number of elements in the list
Definition: QoreValueList.h:507
DLLEXPORT QoreValue getReferencedValue() const
returns the current value with an incremented reference count
DLLEXPORT bool next()
moves the iterator to the next element, returns true if the iterator is pointing to an element of the...
DLLLOCAL size_t max() const
returns the number of elements in the list
Definition: QoreValueList.h:602
DLLEXPORT bool next()
moves the iterator to the next element, returns true if the iterator is pointing to an element of the...
DLLEXPORT QoreValueList()
creates an empty list
virtual DLLLOCAL int integerEvalImpl(ExceptionSink *xsink) const
always returns 0
a templated class to manage a reference count of an object that can throw a Qore-language exception w...
Definition: ReferenceHolder.h:51
DLLEXPORT QoreValue pop()
returns the last element of the list, the length is decremented by one, caller owns the reference ...
DLLEXPORT QoreValueList * sortStable(ExceptionSink *xsink) const
returns a new list based on executing mergesort on the source list ("this")