cvs: ZendEngine2 / zend_reflection_api.c
| From: | Marcus Boerger | Date: | Fri, 17 Oct 2003 17:51:02 +0000 |
| Subject: | cvs: ZendEngine2 / zend_reflection_api.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-1917@lists.php.net to get a copy of this message | ||
helly Fri Oct 17 13:51:02 2003 EDT
Modified files:
/ZendEngine2 zend_reflection_api.c
Log:
Show if a class/object is iterateable
Index: ZendEngine2/zend_reflection_api.c
diff -u ZendEngine2/zend_reflection_api.c:1.69 ZendEngine2/zend_reflection_api.c:1.70
--- ZendEngine2/zend_reflection_api.c:1.69 Fri Oct 17 04:15:48 2003
+++ ZendEngine2/zend_reflection_api.c Fri Oct 17 13:51:01 2003
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_reflection_api.c,v 1.69 2003/10/17 08:15:48 helly Exp $ */
+/* $Id: zend_reflection_api.c,v 1.70 2003/10/17 17:51:01 helly Exp $ */
#include "zend.h"
#include "zend_API.h"
#include "zend_default_classes.h"
@@ -260,6 +260,9 @@
string_printf(str, "%s%s [ ", indent, (ce->ce_flags & ZEND_ACC_INTERFACE) ?
"Interface" : "Class");
}
string_printf(str, (ce->type == ZEND_USER_CLASS) ? "<user> " :
"<internal> ");
+ if (ce->get_iterator != NULL) {
+ string_printf(str, "<iterateable> ");
+ }
if (ce->ce_flags & ZEND_ACC_ABSTRACT_CLASS) {
string_printf(str, "abstract ");
}
@@ -2385,6 +2388,20 @@
}
/* }}} */
+/* {{{ proto public bool Reflection_Class::isIterateable()
+ Returns whether this class is iterateable (can be used inside foreach) */
+ZEND_METHOD(reflection_class, isIterateable)
+{
+ reflection_object *intern;
+ zend_class_entry *ce;
+
+ METHOD_NOTSTATIC;
+ GET_REFLECTION_OBJECT_PTR(ce);
+
+ RETURN_BOOL(ce->get_iterator != NULL);
+}
+/* }}} */
+
/* {{{ proto public static mixed Reflection_Object::export(mixed argument, [, bool return]) throws
Exception
Exports a reflection object. Returns the output if TRUE is specified for return, printing it
otherwise. */
ZEND_METHOD(reflection_object, export)
@@ -2949,6 +2966,7 @@
ZEND_ME(reflection_class, isSubclassOf, NULL, 0)
ZEND_ME(reflection_class, getStaticProperties, NULL, 0)
ZEND_ME(reflection_class, getDefaultProperties, NULL, 0)
+ ZEND_ME(reflection_class, isIterateable, NULL, 0)
{NULL, NULL, NULL}
};