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;
47 DLLLOCAL QoreMapSelectOperatorNode(
const QoreProgramLocation* loc,
QoreValue e0,
QoreValue e1,
QoreValue e2) : QoreNOperatorNodeBase<3>(loc, e0, QoreSimpleValue().assign(e1), QoreSimpleValue().assign(e2)), returnTypeInfo(nullptr), iterator_func(nullptr) {
54 DLLLOCAL
virtual const char* getTypeName()
const {
55 return map_str.getBuffer();
58 DLLLOCAL
virtual QoreOperatorNode* copyBackground(
ExceptionSink* xsink)
const {
59 ValueHolder n_e0(copy_value_and_resolve_lvar_refs(e[0], xsink), xsink);
62 ValueHolder n_e1(copy_value_and_resolve_lvar_refs(e[1], xsink), xsink);
65 ValueHolder n_e2(copy_value_and_resolve_lvar_refs(e[2], xsink), xsink);
68 QoreMapSelectOperatorNode* rv =
new QoreMapSelectOperatorNode(loc, n_e0.release(), n_e1.release(), n_e2.release());
69 rv->iterator_func =
dynamic_cast<FunctionalOperator*
>(rv->e[1].getInternalNode());
73 DLLLOCAL
virtual bool hasEffectAsRoot()
const {
77 DLLLOCAL
virtual FunctionalOperatorInterface* getFunctionalIteratorImpl(FunctionalValueType& value_type,
ExceptionSink* xsink)
const;
80 const QoreTypeInfo* returnTypeInfo;
81 const QoreTypeInfo* expTypeInfo =
nullptr;
82 FunctionalOperator* iterator_func;
88 DLLLOCAL
virtual ~QoreMapSelectOperatorNode() {
91 DLLLOCAL
virtual void parseInitImpl(
QoreValue& val, LocalVar* oflag,
int pflag,
int& lvids,
const QoreTypeInfo*& typeInfo);
93 DLLLOCAL
virtual const QoreTypeInfo* getTypeInfo()
const {
94 return returnTypeInfo;
100 class QoreFunctionalMapSelectListOperator :
public FunctionalOperatorInterface,
public ConstListIterator {
102 const QoreMapSelectOperatorNode* map;
109 DLLLOCAL
virtual ~QoreFunctionalMapSelectListOperator() {
113 DLLLOCAL
virtual const QoreTypeInfo* getValueType()
const {
114 return getList()->getValueTypeInfo();
119 DLLLOCAL
virtual const QoreTypeInfo* getValueTypeImpl()
const {
120 return l->getValueTypeInfo();
124 class QoreFunctionalMapSelectSingleValueOperator :
public FunctionalOperatorInterface {
126 const QoreMapSelectOperatorNode* map;
132 DLLLOCAL QoreFunctionalMapSelectSingleValueOperator(
const QoreMapSelectOperatorNode* m,
QoreValue n,
ExceptionSink* xs) : map(m), v(n), done(false), xsink(xs) {
135 DLLLOCAL
virtual ~QoreFunctionalMapSelectSingleValueOperator() {
141 DLLLOCAL
virtual const QoreTypeInfo* getValueTypeImpl()
const {
146 class QoreFunctionalMapSelectIteratorOperator :
public FunctionalOperatorInterface {
148 const QoreMapSelectOperatorNode* map;
150 AbstractIteratorHelper h;
155 DLLLOCAL QoreFunctionalMapSelectIteratorOperator(
const QoreMapSelectOperatorNode* m,
bool t, AbstractIteratorHelper n_h,
ExceptionSink* xs) : map(m), temp(t), h(n_h), xsink(xs) {
158 DLLLOCAL ~QoreFunctionalMapSelectIteratorOperator() {
165 DLLLOCAL
virtual const QoreTypeInfo* getValueTypeImpl()
const {
170 class QoreFunctionalMapSelectOperator :
public FunctionalOperatorInterface {
172 const QoreMapSelectOperatorNode* map;
173 FunctionalOperatorInterface* f;
177 DLLLOCAL QoreFunctionalMapSelectOperator(
const QoreMapSelectOperatorNode* m, FunctionalOperatorInterface* n_f) : map(m), f(n_f), index(0) {
180 DLLLOCAL ~QoreFunctionalMapSelectOperator() {
186 DLLLOCAL
virtual const QoreTypeInfo* getValueTypeImpl()
const {
187 return f->getValueType();
allows storing a value and setting a boolean flag that indicates if the value should be dereference i...
Definition: QoreValue.h:485
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:81
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:262
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:46
DLLEXPORT const QoreTypeInfo * getTypeInfo() const
returns the type of the value
holds an object and dereferences it in the destructor
Definition: QoreValue.h:452
DLLEXPORT void discard(ExceptionSink *xsink)
dereferences any contained AbstractQoreNode pointer and sets to 0; does not modify other values ...
For use on the stack only: iterates through elements of a const QoreListNode.
Definition: QoreListNode.h:566