32 #ifndef _QORE_QOREFOLDLOPERATORNODE_H
34 #define _QORE_QOREFOLDLOPERATORNODE_H
36 #include "qore/intern/AbstractIteratorHelper.h"
37 #include "qore/intern/FunctionalOperator.h"
38 #include "qore/intern/FunctionalOperatorInterface.h"
40 class QoreFoldlOperatorNode :
public QoreBinaryOperatorNode<> {
42 const QoreTypeInfo* returnTypeInfo;
43 FunctionalOperator* iterator_func;
51 DLLLOCAL
virtual ~QoreFoldlOperatorNode() {
54 DLLLOCAL
virtual void parseInitImpl(
QoreValue& val, LocalVar* oflag,
int pflag,
int& lvids,
const QoreTypeInfo*& typeInfo);
56 DLLLOCAL
virtual const QoreTypeInfo* getTypeInfo()
const {
57 return returnTypeInfo;
62 DLLLOCAL FunctionalOperatorInterface* getFunctionalIterator(FunctionalOperator::FunctionalValueType& value_type,
bool fwd,
ExceptionSink* xsink)
const;
65 DLLLOCAL QoreFoldlOperatorNode(
const QoreProgramLocation* loc,
QoreValue l,
QoreValue r) : QoreBinaryOperatorNode<>(loc, l, r), returnTypeInfo(nullptr), iterator_func(nullptr) {
72 DLLLOCAL
virtual const char* getTypeName()
const {
73 return foldl_str.getBuffer();
76 DLLLOCAL
virtual QoreOperatorNode* copyBackground(
ExceptionSink *xsink)
const {
77 QoreFoldlOperatorNode* rv = copyBackgroundExplicit<QoreFoldlOperatorNode>(xsink);
79 rv->iterator_func =
dynamic_cast<FunctionalOperator*
>(rv->right.getInternalNode());
84 class QoreFoldrOperatorNode :
public QoreFoldlOperatorNode {
91 DLLLOCAL QoreFoldrOperatorNode(
const QoreProgramLocation* loc,
QoreValue l,
QoreValue r) : QoreFoldlOperatorNode(loc, l, r) {
98 DLLLOCAL
virtual const char* getTypeName()
const {
99 return foldr_str.c_str();
102 DLLLOCAL
virtual QoreOperatorNode* copyBackground(
ExceptionSink *xsink)
const {
103 QoreFoldrOperatorNode* rv = copyBackgroundExplicit<QoreFoldrOperatorNode>(xsink);
105 rv->iterator_func =
dynamic_cast<FunctionalOperator*
>(rv->right.getInternalNode());