|
Qore Programming Language
0.9.16
|
32 #ifndef _QORE_QORELISTNODE_H
34 #define _QORE_QORELISTNODE_H
36 #include <qore/AbstractQoreNode.h>
53 friend class StackList;
54 friend hashdecl qore_list_private;
67 hashdecl qore_list_private *
priv;
96 DLLEXPORT
QoreListNode(
const QoreTypeInfo* valueTypeInfo);
152 DLLEXPORT
QoreValue& getEntryReference(
size_t index);
393 DLLEXPORT
size_t size()
const;
398 DLLEXPORT
bool empty()
const;
433 DLLLOCAL
virtual void parseInit(
QoreValue& val, LocalVar *oflag,
int pflag,
int &lvids,
const QoreTypeInfo *&typeInfo);
436 #include <qore/ReferenceHolder.h>
470 DLLLOCAL
void *
operator new(size_t);
491 DLLEXPORT
bool next();
500 DLLEXPORT
bool prev();
508 DLLEXPORT
int set(
size_t n_pos);
519 DLLEXPORT
bool first()
const;
522 DLLEXPORT
bool last()
const;
525 DLLLOCAL
size_t index()
const {
return pos; }
528 DLLLOCAL
size_t max()
const {
return l->
size(); }
540 return pos == -1 ? false :
true;
588 DLLEXPORT
bool next();
597 DLLEXPORT
bool prev();
605 DLLEXPORT
int set(
size_t n_pos);
616 DLLEXPORT
bool first()
const;
619 DLLEXPORT
bool last()
const;
622 DLLLOCAL
size_t index()
const {
return pos; }
625 DLLLOCAL
size_t max()
const {
return l->
size(); }
637 return pos == -1 ? false :
true;
641 DLLEXPORT
void reset();
DLLEXPORT int set(size_t n_pos)
sets the iterator to a specific position in the list
DLLLOCAL bool valid() const
returns true if the iterator is pointing to a valid element
Definition: QoreListNode.h:636
virtual DLLEXPORT bool getAsBoolImpl() const
returns false unless perl-boolean-evaluation is enabled, in which case it returns false only when emp...
DLLEXPORT bool last() const
returns true when the iterator is pointing to the last element in the list
DLLEXPORT QoreValue getReferencedValue() const
returns the referenced value of the list element
DLLEXPORT bool next()
moves the iterator to the next element, returns true if the iterator is pointing to an element of the...
DLLEXPORT bool first() const
returns true when the iterator is pointing to the first element in the list
For use on the stack only: iterates through elements of a const QoreListNode.
Definition: QoreListNode.h:564
intptr_t qore_offset_t
used for offsets that could be negative
Definition: common.h:76
DLLLOCAL void setFinalized()
this function is not exported in the qore library
DLLEXPORT size_t size() const
returns the number of elements in the list
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:262
virtual DLLEXPORT AbstractQoreNode * realCopy() const
returns true if the list contains parse expressions and therefore needs evaluation to return a value,...
DLLEXPORT QoreListNode * splice(qore_offset_t offset)
truncates the list at position "offset" (first element is offset 0) and returns any elements removed ...
DLLEXPORT bool prev()
moves the iterator to the previous element, returns true if the iterator is pointing to an element of...
DLLEXPORT QoreValue getReferencedValue() const
returns the referenced value of the list element
hashdecl qore_list_private * priv
this structure holds the private implementation for the type
Definition: QoreListNode.h:67
DLLEXPORT void reset()
resets the iterator to its initial state
DLLEXPORT QoreListNode * copy() const
performs a deep copy of the list and returns the new list
DLLEXPORT QoreValue max(ExceptionSink *xsink) const
returns the element having the highest value (determined by calling OP_LOG_GT - the greater-than ">" ...
DLLEXPORT QoreListNode * 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: QoreListNode.h:631
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 QoreListNode * reverse() const
returns a list with the order of the elements reversed
virtual const DLLEXPORT char * getTypeName() const
returns the type name as a c string
DLLEXPORT QoreListNode * evalList(ExceptionSink *xsink) const
evaluates the list and returns a value (or 0)
DLLEXPORT QoreListNode * sortDescending(ExceptionSink *xsink) const
returns a new list based on quicksorting the source list ("this") in descending order
DLLEXPORT QoreListNode * copyListFrom(size_t index) const
performs a deep copy of the list starting from element "offset" and returns the new list
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 prev()
moves the iterator to the previous element, returns true if the iterator is pointing to an element of...
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
virtual DLLEXPORT ~QoreListNode()
the destructor is protected so it cannot be called directly
DLLEXPORT int merge(const QoreListNode *list, ExceptionSink *xsink)
appends the elements of "list" to this list
DLLEXPORT QoreListNode * sortStable(ExceptionSink *xsink) const
returns a new list based on executing mergesort on the source list ("this")
DLLEXPORT int insert(QoreValue val, ExceptionSink *xsink)
inserts a value in the first position of the list
const DLLLOCAL QoreListNode * getList() const
returns the list
Definition: QoreListNode.h:628
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:81
DLLEXPORT QoreValue getValue() const
returns a pointer to the value of the list element
DLLLOCAL bool isFinalized() const
this function is not exported in the qore library
DLLEXPORT int getEntryAsInt(size_t index) const
returns the value of element at "index" as an integer (first element is index 0)
DLLEXPORT int set(size_t n_pos)
sets the iterator to a specific position in the list
DLLEXPORT QoreListNode * extract(qore_offset_t offset)
truncates the list at position "offset" (first element is offset 0) and returns any elements removed ...
DLLEXPORT int push(QoreValue val, ExceptionSink *xsink)
adds a value to the list
const DLLEXPORT QoreTypeInfo * getValueTypeInfo() const
returns the value type declaration (if set)
DLLEXPORT QoreValue pop()
returns the last element of the list, the length is decremented by one, caller owns the reference
DLLEXPORT bool last() const
returns true when the iterator is pointing to the last element in the list
DLLEXPORT QoreValue min(ExceptionSink *xsink) const
returns the element having the lowest value (determined by calling OP_LOG_LT - the less-than "<" oper...
const DLLEXPORT QoreTypeInfo * getTypeInfo() const
returns the type info structure for the current value; also works for lists with a specific value typ...
DLLEXPORT ListIterator(QoreListNode *lst, size_t n_pos=-1)
initializes the iterator to the position given or, if omitted, just before the first element
DLLEXPORT ConstListIterator(const QoreListNode *lst, size_t n_pos=-1)
initializes the iterator to the position given or, if omitted, just before the first element
DLLLOCAL size_t index() const
returns the current iterator position in the list or -1 if not pointing at a valid element
Definition: QoreListNode.h:525
DLLEXPORT QoreValue getReferencedEntry(size_t index) const
returns the element at "index" (first element is index 0), the caller owns the reference
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
DLLEXPORT QoreValue shift()
returns the first element of the list, all other entries are moved down to fill up the first position...
DLLEXPORT int setEntry(size_t index, QoreValue val, ExceptionSink *xsink)
sets the value of a list element
DLLEXPORT QoreValue retrieveEntry(size_t index)
returns the element at "index" (first element is index 0)
virtual DLLEXPORT bool derefImpl(ExceptionSink *xsink)
dereferences all elements of the list
virtual DLLLOCAL void parseInit(QoreValue &val, LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo)
for initialization of lists in the parse tree at parse time (always returns "this")
const DLLEXPORT QoreValue getValue() const
returns a pointer to the value of the list element
DLLLOCAL size_t max() const
returns the number of elements in the list
Definition: QoreListNode.h:625
DLLLOCAL QoreListNode * getList()
returns the list
Definition: QoreListNode.h:531
DLLLOCAL size_t index() const
returns the current iterator position in the list or -1 if not pointing at a valid element
Definition: QoreListNode.h:622
DLLLOCAL bool valid() const
returns true if the iterator is pointing to a valid element
Definition: QoreListNode.h:539
DLLLOCAL size_t max() const
returns the number of elements in the list
Definition: QoreListNode.h:528
DLLEXPORT QoreListNode()
create an empty list
DLLLOCAL void setVariableList()
this function is not exported in the qore library
static const DLLLOCAL char * getStaticTypeName()
returns true if the list does not contain any parse expressions, otherwise returns false
Definition: QoreListNode.h:148
DLLEXPORT QoreListNode * sortDescendingStable(ExceptionSink *xsink) const
returns a new list based on executing mergesort on the source list ("this") in descending order
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 bool next()
moves the iterator to the next element, returns true if the iterator is pointing to an element of the...
DLLLOCAL bool empty() const
returns true if the list is empty
Definition: QoreListNode.h:534
DLLEXPORT QoreListNode * listRefSelf() const
returns "this" with an incremented reference count
base class for resolved call references
Definition: CallReferenceNode.h:105
DLLEXPORT bool first() const
returns true when the iterator is pointing to the first element in the list
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:54
virtual DLLLOCAL QoreValue evalImpl(bool &needs_deref, ExceptionSink *xsink) const
optionally evaluates the argument
For use on the stack only: iterates through a the elements of a QoreListNode.
Definition: QoreListNode.h:464
DLLEXPORT bool empty() const
returns true if the list is empty
DLLLOCAL bool isVariableList() const
this function is not exported in the qore library