32 #ifndef _QORE_QOREMAPSELECTOPERATORNODE_H
34 #define _QORE_QOREMAPSELECTOPERATORNODE_H
36 #include "qore/intern/AbstractIteratorHelper.h"
37 #include "qore/intern/FunctionalOperator.h"
38 #include "qore/intern/FunctionalOperatorInterface.h"
40 class QoreMapSelectOperatorNode :
public QoreNOperatorNodeBase<3>,
public FunctionalOperator {
41 friend class QoreFunctionalMapSelectListOperator;
42 friend class QoreFunctionalMapSelectSingleValueOperator;
43 friend class QoreFunctionalMapSelectIteratorOperator;
44 friend class QoreFunctionalMapSelectOperator;
48 : QoreNOperatorNodeBase<3>(loc, e0, QoreSimpleValue().assign(e1), QoreSimpleValue().assign(e2)),
49 returnTypeInfo(nullptr), iterator_func(nullptr) {
56 DLLLOCAL
virtual const char* getTypeName()
const {
57 return map_str.getBuffer();
60 DLLLOCAL
virtual QoreOperatorNode* copyBackground(
ExceptionSink* xsink)
const {
61 ValueHolder n_e0(copy_value_and_resolve_lvar_refs(e[0], xsink), xsink);
64 ValueHolder n_e1(copy_value_and_resolve_lvar_refs(e[1], xsink), xsink);
67 ValueHolder n_e2(copy_value_and_resolve_lvar_refs(e[2], xsink), xsink);
70 QoreMapSelectOperatorNode* rv =
new QoreMapSelectOperatorNode(loc, n_e0.release(), n_e1.release(),
72 rv->iterator_func =
dynamic_cast<FunctionalOperator*
>(rv->e[1].getInternalNode());
76 DLLLOCAL
virtual bool hasEffectAsRoot()
const {
80 DLLLOCAL
virtual FunctionalOperatorInterface* getFunctionalIteratorImpl(FunctionalValueType& value_type,
84 const QoreTypeInfo* returnTypeInfo;
85 const QoreTypeInfo* expTypeInfo =
nullptr;
86 FunctionalOperator* iterator_func;
92 DLLLOCAL
virtual ~QoreMapSelectOperatorNode() {
95 DLLLOCAL
virtual int parseInitImpl(
QoreValue& val, QoreParseContext& parse_context);
97 DLLLOCAL
virtual const QoreTypeInfo* getTypeInfo()
const {
98 return returnTypeInfo;
104 class QoreFunctionalMapSelectListOperator :
public FunctionalOperatorInterface,
public ConstListIterator {
106 const QoreMapSelectOperatorNode* map;
113 DLLLOCAL
virtual ~QoreFunctionalMapSelectListOperator() {
117 DLLLOCAL
virtual const QoreTypeInfo* getValueType()
const {
123 DLLLOCAL
virtual const QoreTypeInfo* getValueTypeImpl()
const {
128 class QoreFunctionalMapSelectSingleValueOperator :
public FunctionalOperatorInterface {
130 const QoreMapSelectOperatorNode* map;
136 DLLLOCAL QoreFunctionalMapSelectSingleValueOperator(
const QoreMapSelectOperatorNode* m,
QoreValue n,
ExceptionSink* xs) : map(m), v(n), done(false), xsink(xs) {
139 DLLLOCAL
virtual ~QoreFunctionalMapSelectSingleValueOperator() {
145 DLLLOCAL
virtual const QoreTypeInfo* getValueTypeImpl()
const {
150 class QoreFunctionalMapSelectIteratorOperator :
public FunctionalOperatorInterface {
152 const QoreMapSelectOperatorNode* map;
154 AbstractIteratorHelper h;
159 DLLLOCAL QoreFunctionalMapSelectIteratorOperator(
const QoreMapSelectOperatorNode* m,
bool t, AbstractIteratorHelper n_h,
ExceptionSink* xs) : map(m), temp(t), h(n_h), xsink(xs) {
162 DLLLOCAL ~QoreFunctionalMapSelectIteratorOperator() {
169 DLLLOCAL
virtual const QoreTypeInfo* getValueTypeImpl()
const {
174 class QoreFunctionalMapSelectOperator :
public FunctionalOperatorInterface {
176 const QoreMapSelectOperatorNode* map;
177 FunctionalOperatorInterface* f;
181 DLLLOCAL QoreFunctionalMapSelectOperator(
const QoreMapSelectOperatorNode* m, FunctionalOperatorInterface* n_f) : map(m), f(n_f), index(0) {
184 DLLLOCAL ~QoreFunctionalMapSelectOperator() {
190 DLLLOCAL
virtual const QoreTypeInfo* getValueTypeImpl()
const {
191 return map->expTypeInfo;
For use on the stack only: iterates through elements of a const QoreListNode.
Definition: QoreListNode.h:563
DLLLOCAL const QoreListNode * getList() const
returns the list
Definition: QoreListNode.h:627
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
DLLEXPORT const QoreTypeInfo * getValueTypeInfo() const
returns the value type declaration (if set)
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:93
holds an object and dereferences it in the destructor
Definition: QoreValue.h:476
allows storing a value and setting a boolean flag that indicates if the value should be dereference i...
Definition: QoreValue.h:509
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:275
DLLEXPORT void discard(ExceptionSink *xsink)
dereferences any contained AbstractQoreNode pointer and sets to 0; does not modify other values
DLLEXPORT const QoreTypeInfo * getTypeInfo() const
returns the type of the value