32 #ifndef _QORE_ABSTRACTITERATORHELPER_H
34 #define _QORE_ABSTRACTITERATORHELPER_H
36 #include "qore/intern/QoreClassIntern.h"
38 class AbstractIteratorHelper {
48 bool get_value =
true) {
55 const qore_class_private* class_ctx = runtime_get_class();
56 if (class_ctx && !qore_class_private::runtimeCheckPrivateClassAccess(*o->
getClass(), class_ctx))
61 nextMethod = qore_class_private::get(*o->
getClass())->runtimeFindCommittedMethod(fwd ?
"next" :
"prev",
65 nextVariant = getCheckVariant(xsink, op, nextMethod);
69 getValueMethod = qore_class_private::get(*o->
getClass())->runtimeFindCommittedMethod(
"getValue", access,
72 assert(getValueMethod);
73 getValueVariant = getCheckVariant(xsink, op, getValueMethod);
80 DLLLOCAL
operator bool()
const {
87 ValueHolder rv(qore_method_private::evalNormalVariant(*nextMethod, xsink, obj, nextVariant, 0), xsink);
88 return rv->getAsBool();
92 assert(getValueMethod);
93 assert(getValueVariant);
94 return qore_method_private::evalNormalVariant(*getValueMethod, xsink, obj, getValueVariant, 0);
100 const qore_class_private* class_ctx = runtime_get_class();
101 const MethodVariantBase* variant =
reinterpret_cast<const MethodVariantBase*
>(
102 qore_method_private::get(*m)->getFunction()->runtimeFindVariant(xsink, (
QoreListNode*)
nullptr,
false,
112 if (variant->isPrivate()) {
114 if (!qore_class_private::runtimeCheckPrivateClassAccess(*(variant->method()->getClass()), class_ctx)) {
117 opstr.concat(
"-ITERATOR-ERROR");
118 xsink->
raiseException(opstr.getBuffer(),
"cannot access private %s::%s() iterator method with the %s",
119 variant->method()->getClass()->getName(), m->
getName(), op);
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
DLLEXPORT AbstractQoreNode * raiseException(const char *err, const char *fmt,...)
appends a Qore-language exception to the list
defines a Qore-language class
Definition: QoreClass.h:249
DLLEXPORT const QoreClass * getClass(qore_classid_t cid) const
returns a pointer to the QoreClass object representing the class ID passed if it exists in the class ...
external wrapper class for method variants
Definition: QoreReflection.h:90
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
a method in a QoreClass
Definition: QoreClass.h:135
DLLEXPORT const char * getName() const
returns the method's name
the implementation of Qore's object data type, reference counted, dynamically-allocated only
Definition: QoreObject.h:60
DLLEXPORT const QoreClass * getClass(qore_classid_t cid) const
returns a pointer to a QoreClass object if the class ID passed is a valid class in the hierarchy
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
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:275