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 DLLLOCAL QoreSelectOperatorNode(
const QoreProgramLocation* loc,
QoreValue l,
QoreValue r)
48 : QoreBinaryOperatorNode<>(loc, l, r), returnTypeInfo(nullptr), iterator_func(nullptr) {
55 DLLLOCAL
virtual const char* getTypeName()
const {
56 return select_str.getBuffer();
59 DLLLOCAL
virtual QoreOperatorNode* copyBackground(
ExceptionSink *xsink)
const {
60 QoreSelectOperatorNode* rv = copyBackgroundExplicit<QoreSelectOperatorNode>(xsink);
61 rv->iterator_func =
dynamic_cast<FunctionalOperator*
>(rv->left.getInternalNode());
65 DLLLOCAL
virtual FunctionalOperatorInterface* getFunctionalIteratorImpl(FunctionalValueType& value_type,
69 const QoreTypeInfo* returnTypeInfo;
70 FunctionalOperator* iterator_func;
78 DLLLOCAL
virtual ~QoreSelectOperatorNode() {
81 DLLLOCAL
virtual int parseInitImpl(
QoreValue& val, QoreParseContext& parse_context);
83 DLLLOCAL
virtual const QoreTypeInfo* getTypeInfo()
const {
84 return returnTypeInfo;
90 class QoreFunctionalSelectListOperator :
public FunctionalOperatorInterface,
public ConstListIterator {
96 DLLLOCAL
virtual ~QoreFunctionalSelectListOperator() {
102 DLLLOCAL
virtual const QoreTypeInfo* getValueTypeImpl()
const {
107 const QoreSelectOperatorNode* select;
111 class QoreFunctionalSelectSingleValueOperator :
public FunctionalOperatorInterface {
113 DLLLOCAL QoreFunctionalSelectSingleValueOperator(
const QoreSelectOperatorNode* s,
QoreValue n,
ExceptionSink* xs)
114 : select(s), v(n), xsink(xs) {
117 DLLLOCAL
virtual ~QoreFunctionalSelectSingleValueOperator() {
123 DLLLOCAL
virtual const QoreTypeInfo* getValueTypeImpl()
const {
124 return v.getTypeInfo();
128 const QoreSelectOperatorNode* select;
134 class QoreFunctionalSelectIteratorOperator :
public FunctionalOperatorInterface {
136 DLLLOCAL QoreFunctionalSelectIteratorOperator(
const QoreSelectOperatorNode* s,
bool t, AbstractIteratorHelper n_h,
140 DLLLOCAL ~QoreFunctionalSelectIteratorOperator() {
147 DLLLOCAL
virtual const QoreTypeInfo* getValueTypeImpl()
const {
152 const QoreSelectOperatorNode* select;
154 AbstractIteratorHelper h;
159 class QoreFunctionalSelectOperator :
public FunctionalOperatorInterface {
161 DLLLOCAL QoreFunctionalSelectOperator(
const QoreSelectOperatorNode* s, FunctionalOperatorInterface* n_f)
162 : select(s), f(n_f) {
165 DLLLOCAL ~QoreFunctionalSelectOperator() {
171 DLLLOCAL
virtual const QoreTypeInfo* getValueTypeImpl()
const {
172 return f->getValueType();
176 const QoreSelectOperatorNode* select;
177 FunctionalOperatorInterface* f;
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
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