32 #ifndef _QORE_QORESELECTOPERATORNODE_H
34 #define _QORE_QORESELECTOPERATORNODE_H
36 #include "qore/intern/AbstractIteratorHelper.h"
37 #include "qore/intern/FunctionalOperator.h"
38 #include "qore/intern/FunctionalOperatorInterface.h"
40 class QoreSelectOperatorNode :
public QoreBinaryOperatorNode<>,
public FunctionalOperator {
41 friend class QoreFunctionalSelectListOperator;
42 friend class QoreFunctionalSelectSingleValueOperator;
43 friend class QoreFunctionalSelectIteratorOperator;
44 friend class QoreFunctionalSelectOperator;
47 const QoreTypeInfo* returnTypeInfo;
48 FunctionalOperator* iterator_func;
56 DLLLOCAL
virtual ~QoreSelectOperatorNode() {
59 DLLLOCAL
virtual void parseInitImpl(
QoreValue& val, LocalVar* oflag,
int pflag,
int& lvids,
const QoreTypeInfo*& typeInfo);
61 DLLLOCAL
virtual const QoreTypeInfo* getTypeInfo()
const {
62 return returnTypeInfo;
68 DLLLOCAL QoreSelectOperatorNode(
const QoreProgramLocation* loc,
QoreValue l,
QoreValue r) : QoreBinaryOperatorNode<>(loc, l, r), returnTypeInfo(nullptr), iterator_func(nullptr) {
75 DLLLOCAL
virtual const char* getTypeName()
const {
76 return select_str.getBuffer();
79 DLLLOCAL
virtual QoreOperatorNode* copyBackground(
ExceptionSink *xsink)
const {
80 QoreSelectOperatorNode* rv = copyBackgroundExplicit<QoreSelectOperatorNode>(xsink);
81 rv->iterator_func =
dynamic_cast<FunctionalOperator*
>(rv->left.getInternalNode());
85 DLLLOCAL
virtual FunctionalOperatorInterface* getFunctionalIteratorImpl(FunctionalValueType& value_type,
ExceptionSink* xsink)
const;
88 class QoreFunctionalSelectListOperator :
public FunctionalOperatorInterface,
public ConstListIterator {
90 const QoreSelectOperatorNode* select;
97 DLLLOCAL
virtual ~QoreFunctionalSelectListOperator() {
103 DLLLOCAL
virtual const QoreTypeInfo* getValueTypeImpl()
const {
108 class QoreFunctionalSelectSingleValueOperator :
public FunctionalOperatorInterface {
110 const QoreSelectOperatorNode* select;
116 DLLLOCAL QoreFunctionalSelectSingleValueOperator(
const QoreSelectOperatorNode* s,
QoreValue n,
ExceptionSink* xs) : select(s), v(n), done(false), xsink(xs) {
119 DLLLOCAL
virtual ~QoreFunctionalSelectSingleValueOperator() {
125 DLLLOCAL
virtual const QoreTypeInfo* getValueTypeImpl()
const {
130 class QoreFunctionalSelectIteratorOperator :
public FunctionalOperatorInterface {
132 const QoreSelectOperatorNode* select;
134 AbstractIteratorHelper h;
139 DLLLOCAL QoreFunctionalSelectIteratorOperator(
const QoreSelectOperatorNode* s,
bool t, AbstractIteratorHelper n_h,
ExceptionSink* xs) : select(s), temp(t), h(n_h), index(0), xsink(xs) {
142 DLLLOCAL ~QoreFunctionalSelectIteratorOperator() {
149 DLLLOCAL
virtual const QoreTypeInfo* getValueTypeImpl()
const {
154 class QoreFunctionalSelectOperator :
public FunctionalOperatorInterface {
156 const QoreSelectOperatorNode* select;
157 FunctionalOperatorInterface* f;
161 DLLLOCAL QoreFunctionalSelectOperator(
const QoreSelectOperatorNode* s, FunctionalOperatorInterface* n_f) : select(s), f(n_f), index(0) {
164 DLLLOCAL ~QoreFunctionalSelectOperator() {
170 DLLLOCAL
virtual const QoreTypeInfo* getValueTypeImpl()
const {
171 return f->getValueType();