summaryrefslogtreecommitdiff
path: root/ext/spl/spl_directory.h
diff options
context:
space:
mode:
Diffstat (limited to 'ext/spl/spl_directory.h')
-rwxr-xr-xext/spl/spl_directory.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/ext/spl/spl_directory.h b/ext/spl/spl_directory.h
index 0764920512..aa15742a75 100755
--- a/ext/spl/spl_directory.h
+++ b/ext/spl/spl_directory.h
@@ -26,7 +26,9 @@
extern PHPAPI zend_class_entry *spl_ce_SplFileInfo;
extern PHPAPI zend_class_entry *spl_ce_DirectoryIterator;
+extern PHPAPI zend_class_entry *spl_ce_FilesystemIterator;
extern PHPAPI zend_class_entry *spl_ce_RecursiveDirectoryIterator;
+extern PHPAPI zend_class_entry *spl_ce_GlobIterator;
extern PHPAPI zend_class_entry *spl_ce_SplFileObject;
extern PHPAPI zend_class_entry *spl_ce_SplTempFileObject;
@@ -50,6 +52,13 @@ typedef struct _spl_other_handler {
spl_foreign_clone_t clone;
} spl_other_handler;
+/* define an overloaded iterator structure */
+typedef struct {
+ zend_object_iterator intern;
+ zval *current;
+ spl_filesystem_object *object;
+} spl_filesystem_iterator;
+
struct _spl_filesystem_object {
zend_object std;
void *oth;
@@ -89,8 +98,19 @@ struct _spl_filesystem_object {
char escape;
} file;
} u;
+ spl_filesystem_iterator it;
};
+static inline spl_filesystem_iterator* spl_filesystem_object_to_iterator(spl_filesystem_object *obj)
+{
+ return &obj->it;
+}
+
+static inline spl_filesystem_object* spl_filesystem_iterator_to_object(spl_filesystem_iterator *it)
+{
+ return (spl_filesystem_object*)((char*)it - XtOffsetOf(spl_filesystem_object, it));
+}
+
#define SPL_FILE_OBJECT_DROP_NEW_LINE 0x00000001 /* drop new lines */
#define SPL_FILE_OBJECT_READ_AHEAD 0x00000002 /* read on rewind/next */
#define SPL_FILE_OBJECT_SKIP_EMPTY 0x00000006 /* skip empty lines */