[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Wed Jul 23 06:07:55 2008 UTC Modified files: /php-src/ext/splspl.php Log: - Add new classes http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl.php?r1=1.85r2=1.86diff_format=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.85 php-src/ext/spl/spl.php:1.86 --- php-src/ext/spl/spl.php:1.85Sat Jul 19 15:43:35 2008 +++ php-src/ext/spl/spl.php Wed Jul 23 06:07:55 2008 @@ -49,6 +49,7 @@ * - class AppendIterator implements OuterIterator * - class RegexIterator extends FilterIterator * - class RecursiveRegexIterator extends RegexIterator implements RecursiveIterator + * - class MultipleIterator extends Iterator * * 2) Directories and Files * @@ -75,6 +76,7 @@ * - class ArrayObject implements IteratorAggregate, ArrayAccess, Countable * - class ArrayIterator implements Iterator, ArrayAccess, Countable, SeekableIterator * - class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator + * - class SplFixedArray implements Iterator, ArrayAccess, Countable * * As the above suggest an ArrayObject creates an ArrayIterator when it comes to * iteration (e.g. ArrayObject instance used inside foreach). -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php spl_iterators.c spl_iterators.h /ext/spl/examples recursivetreeiterator.inc /ext/spl/internal recursivetreeiterator.inc /ext/spl/tests recursive_tree_iterato
helly Sat Jul 19 15:43:35 2008 UTC Added files: /php-src/ext/spl/internal recursivetreeiterator.inc /php-src/ext/spl/tests recursive_tree_iterator_001.phpt recursive_tree_iterator_002.phpt recursive_tree_iterator_003.phpt recursive_tree_iterator_004.phpt recursive_tree_iterator_005.phpt recursive_tree_iterator_006.phpt recursive_tree_iterator_007.phpt recursive_tree_iterator_008.phpt Removed files: /php-src/ext/spl/examples recursivetreeiterator.inc Modified files: /php-src/ext/splspl.php spl_iterators.c spl_iterators.h Log: - Move RecursiveTreeIterator from PHP to C code (Arnaud, Marcus) [DOC] Added RecursiveTreeIterator Documentation in ext/spl/internal/recursivetreeiterator.inc http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl.php?r1=1.84r2=1.85diff_format=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.84 php-src/ext/spl/spl.php:1.85 --- php-src/ext/spl/spl.php:1.84Wed Feb 13 12:01:16 2008 +++ php-src/ext/spl/spl.php Sat Jul 19 15:43:35 2008 @@ -35,6 +35,7 @@ * - interface RecursiveIterator extends Iterator * - interface OuterIterator extends Iterator * - class RecursiveIteratorIterator implements OuterIterator + * - class RecursiveTreeIterator extends RecursiveIteratorIterator * - abstract class FilterIterator implements OuterIterator * - class ParentIterator extends FilterIterator implements RecursiveIterator * - interface SeekableIterator extends Iterator http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_iterators.c?r1=1.170r2=1.171diff_format=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.170 php-src/ext/spl/spl_iterators.c:1.171 --- php-src/ext/spl/spl_iterators.c:1.170 Wed Mar 19 14:00:46 2008 +++ php-src/ext/spl/spl_iterators.c Sat Jul 19 15:43:35 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_iterators.c,v 1.170 2008/03/19 14:00:46 felipe Exp $ */ +/* $Id: spl_iterators.c,v 1.171 2008/07/19 15:43:35 helly Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -35,6 +35,7 @@ #include spl_directory.h #include spl_array.h #include spl_exceptions.h +#include ext/standard/php_smart_str.h #ifdef accept #undef accept @@ -58,6 +59,7 @@ PHPAPI zend_class_entry *spl_ce_RegexIterator; PHPAPI zend_class_entry *spl_ce_RecursiveRegexIterator; PHPAPI zend_class_entry *spl_ce_Countable; +PHPAPI zend_class_entry *spl_ce_RecursiveTreeIterator; const zend_function_entry spl_funcs_RecursiveIterator[] = { SPL_ABSTRACT_ME(RecursiveIterator, hasChildren, NULL) @@ -74,6 +76,11 @@ #define RIT_CATCH_GET_CHILD CIT_CATCH_GET_CHILD typedef enum { + RTIT_BYPASS_CURRENT = 4, + RTIT_BYPASS_KEY = 8 +} RecursiveTreeIteratorFlags; + +typedef enum { RS_NEXT = 0, RS_TEST = 1, RS_SELF = 2, @@ -104,6 +111,7 @@ zend_function*endChildren; zend_function*nextElement; zend_class_entry *ce; + smart_strprefix[6]; } spl_recursive_it_object; typedef struct _spl_recursive_it_iterator { @@ -408,27 +416,65 @@ spl_recursive_it_rewind }; -/* {{{ proto void RecursiveIteratorIterator::__construct(RecursiveIterator|IteratorAggregate it [, int mode = RIT_LEAVES_ONLY [, int flags = 0]]) throws InvalidArgumentException U - Creates a RecursiveIteratorIterator from a RecursiveIterator. */ -SPL_METHOD(RecursiveIteratorIterator, __construct) +static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *ce_base, zend_class_entry *ce_inner, recursive_it_it_type rit_type TSRMLS_DC) { zval *object = getThis(); spl_recursive_it_object *intern; zval *iterator; zend_class_entry *ce_iterator; - long mode = RIT_LEAVES_ONLY, flags = 0; + long mode, flags; intinc_refcount = 1; php_set_error_handling(EH_THROW, spl_ce_InvalidArgumentException TSRMLS_CC); - if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, o|ll, iterator, mode, flags) == SUCCESS) { - if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate TSRMLS_CC)) { - zval *aggregate = iterator; - zend_call_method_with_0_params(aggregate, Z_OBJCE_P(aggregate), Z_OBJCE_P(aggregate)-iterator_funcs.zf_new_iterator, getiterator, iterator); - inc_refcount = 0; + switch(rit_type) { + case
[PHP-CVS] cvs: php-src /ext/spl spl.php spl_directory.c spl_directory.h /ext/spl/tests dit_002.phpt
helly Wed Feb 13 12:01:16 2008 UTC Added files: /php-src/ext/spl/tests dit_002.phpt Modified files: /php-src/ext/splspl.php spl_directory.c spl_directory.h Log: - Make this behave like in = 5.2.5 and test for it http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl.php?r1=1.83r2=1.84diff_format=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.83 php-src/ext/spl/spl.php:1.84 --- php-src/ext/spl/spl.php:1.83Mon Feb 4 21:37:43 2008 +++ php-src/ext/spl/spl.php Wed Feb 13 12:01:16 2008 @@ -1030,8 +1030,8 @@ */ class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveIterator { - const CURRENT_AS_SELF 0x; /* make RecursiveDirectoryTree::current() return getSelf() */ - const CURRENT_AS_FILEINFO 0x0010; /* make RecursiveDirectoryTree::current() return SplFileInfo */ + const CURRENT_AS_FILEINFO 0x; /* make RecursiveDirectoryTree::current() return SplFileInfo */ + const CURRENT_AS_SELF 0x0010; /* make RecursiveDirectoryTree::current() return getSelf() */ const CURRENT_AS_PATHNAME 0x0020; /* make RecursiveDirectoryTree::current() return getPathname() */ const KEY_AS_PATHNAME 0x; /* make RecursiveDirectoryTree::key() return getPathname() */ http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?r1=1.148r2=1.149diff_format=u Index: php-src/ext/spl/spl_directory.c diff -u php-src/ext/spl/spl_directory.c:1.148 php-src/ext/spl/spl_directory.c:1.149 --- php-src/ext/spl/spl_directory.c:1.148 Mon Feb 4 19:39:07 2008 +++ php-src/ext/spl/spl_directory.c Wed Feb 13 12:01:16 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_directory.c,v 1.148 2008/02/04 19:39:07 helly Exp $ */ +/* $Id: spl_directory.c,v 1.149 2008/02/13 12:01:16 helly Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -602,7 +602,7 @@ php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); if (ctor_flags DIT_CTOR_FLAGS) { - flags = 0; + flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO; parsed = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t|l, path, len, path_type, flags); } else { flags = SPL_FILE_DIR_KEY_AS_PATHNAME|SPL_FILE_DIR_CURRENT_AS_SELF; @@ -1214,6 +1214,28 @@ } /* }}} */ +/* {{{ proto int FilesystemIterator::getFlags() U + Get handling flags */ +SPL_METHOD(FilesystemIterator, getFlags) +{ + spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + + RETURN_LONG(intern-flags); +} /* }}} */ + +/* {{{ proto void FilesystemIterator::setFlags(long $flags) U + Set handling flags */ +SPL_METHOD(FilesystemIterator, setFlags) +{ + spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + long flags; + + zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, l, flags); + + intern-flags = ~(SPL_FILE_DIR_KEY_MODE_MASK|SPL_FILE_DIR_CURRENT_MODE_MASK); + intern-flags |= ((SPL_FILE_DIR_KEY_MODE_MASK|SPL_FILE_DIR_CURRENT_MODE_MASK) flags); +} /* }}} */ + /* {{{ proto bool RecursiveDirectoryIterator::hasChildren([bool $allow_links = false]) U Returns whether current entry is a directory and not '.' or '..' */ SPL_METHOD(RecursiveDirectoryIterator, hasChildren) @@ -1703,12 +1725,19 @@ ZEND_ARG_INFO(0, allow_links) ZEND_END_ARG_INFO() +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_r_dir_setFlags, 0, 0, 0) + ZEND_ARG_INFO(0, flags) +ZEND_END_ARG_INFO() + static const zend_function_entry spl_FilesystemIterator_functions[] = { SPL_ME(FilesystemIterator, __construct, arginfo_r_dir___construct, ZEND_ACC_PUBLIC) SPL_ME(FilesystemIterator, rewind,NULL, ZEND_ACC_PUBLIC) SPL_ME(FilesystemIterator, next, NULL, ZEND_ACC_PUBLIC) SPL_ME(FilesystemIterator, key, NULL, ZEND_ACC_PUBLIC) SPL_ME(FilesystemIterator, current, NULL, ZEND_ACC_PUBLIC) + SPL_ME(FilesystemIterator, getFlags, NULL, ZEND_ACC_PUBLIC) + SPL_ME(FilesystemIterator, setFlags, arginfo_r_dir_setFlags, ZEND_ACC_PUBLIC) {NULL, NULL, NULL} }; http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.h?r1=1.41r2=1.42diff_format=u Index: php-src/ext/spl/spl_directory.h diff -u php-src/ext/spl/spl_directory.h:1.41 php-src/ext/spl/spl_directory.h:1.42 --- php-src/ext/spl/spl_directory.h:1.41Mon Feb 4 21:37:43 2008 +++ php-src/ext/spl/spl_directory.h Wed Feb 13 12:01:16 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_directory.h,v 1.41 2008/02/04 21:37:43 helly Exp $ */ +/* $Id: spl_directory.h,v 1.42 2008/02/13
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Mon Feb 4 20:40:29 2008 UTC Modified files: /php-src/ext/splspl.php Log: - Update docu http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl.php?r1=1.81r2=1.82diff_format=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.81 php-src/ext/spl/spl.php:1.82 --- php-src/ext/spl/spl.php:1.81Mon Jan 21 21:54:00 2008 +++ php-src/ext/spl/spl.php Mon Feb 4 20:40:29 2008 @@ -13,25 +13,25 @@ * * SPL - Standard PHP Library * - * SPL is a collection of interfaces and classes that are meant to solve - * standard problems and implements some efficient data access interfaces - * and classes. You'll find the classes documented using php code in the - * file spl.php or in corresponding .inc files in subdirectories examples - * and internal. Based on the internal implementations or the files in the + * SPL is a collection of interfaces and classes that are meant to solve + * standard problems and implements some efficient data access interfaces + * and classes. You'll find the classes documented using php code in the + * file spl.php or in corresponding .inc files in subdirectories examples + * and internal. Based on the internal implementations or the files in the * examples subdirectory there are also some .php files to experiment with. - * - * The .inc files are not included automatically because they are sooner or - * later integrated into the extension. That means that you either need to - * put the code of examples/autoload.inc into your autoprepend file or that + * + * The .inc files are not included automatically because they are sooner or + * later integrated into the extension. That means that you either need to + * put the code of examples/autoload.inc into your autoprepend file or that * you have to point your ini setting auto_prepend_file to that file. - * + * * Below is a list of interfaces/classes already availabel natively through * the SPL extension grouped by category. - * + * * 1) Iterators - * + * * SPL offers some advanced iterator algorithms: - * + * * - interface RecursiveIterator extends Iterator * - interface OuterIterator extends Iterator * - class RecursiveIteratorIterator implements OuterIterator @@ -48,32 +48,35 @@ * - class AppendIterator implements OuterIterator * - class RegexIterator extends FilterIterator * - class RecursiveRegexIterator extends RegexIterator implements RecursiveIterator - * + * * 2) Directories and Files - * + * * SPL offers two advanced directory and file handling classes: - * + * * - class SplFileInfo * - class DirectoryIterator extends SplFileInfo implements Iterator - * - class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveIterator + * - class FilesystemIterator extends DirectoryIterator + * - class RecursiveDirectoryIterator extends FilesystemIterator implements RecursiveIterator + * - class GlobIterator extends FilesystemIterator implements Countable * - class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIterator - * + * - class SplTempFileObject extends SplFileObject + * * 3) XML - * + * * SPL offers an advanced XML handling class: - * + * * - class SimpleXMLIterator extends simplexml_element implements RecursiveIterator - * + * * 4) Array Overloading - * + * * SPL offers advanced Array overloading: - * + * * - class ArrayObject implements IteratorAggregate, ArrayAccess, Countable * - class ArrayIterator implements Iterator, ArrayAccess, Countable, SeekableIterator * - class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator - * + * * As the above suggest an ArrayObject creates an ArrayIterator when it comes to - * iteration (e.g. ArrayObject instance used inside foreach). + * iteration (e.g. ArrayObject instance used inside foreach). * * 5) Counting * @@ -81,7 +84,7 @@ * * 6) Exception%s * - * SPL provides a set of standard Exception classes each meant to indicate a + * SPL provides a set of standard Exception classes each meant to indicate a * certain problem type. * * - class LogicException extends Exception @@ -115,10 +118,10 @@ * * 9) @ref Examples * - * The classes and interfaces in this group are contained as PHP code in the + * The classes and interfaces in this group are contained as PHP code in the * examples subdirectory of ext/SPL. Sooner or later they will be moved to * c-code. - * + * * 10) Some articles about SPL: * - a href=http://www.phpro.org/tutorials/Introduction-to-SPL.html;Introduction to Standard PHP Library (SPL)/a * - a href=http://www.sitepoint.com/article/php5-standard-library/1;Introducing PHP 5's Standard Library/a @@ -139,7 +142,7 @@ * - Debug session 2 a href=http://talks.somabo.de/200509_toronto_iterator_debug_session_1.pps;[pps]/a, a href=http://talks.somabo.de/200509_toronto_iterator_debug_session_1.pdf;[pdf]/a, a
[PHP-CVS] cvs: php-src /ext/spl spl.php spl_directory.h /ext/spl/examples tree.php
helly Mon Feb 4 21:37:43 2008 UTC Modified files: /php-src/ext/splspl.php spl_directory.h /php-src/ext/spl/examples tree.php Log: - Really last flag change (got confused with code) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl.php?r1=1.82r2=1.83diff_format=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.82 php-src/ext/spl/spl.php:1.83 --- php-src/ext/spl/spl.php:1.82Mon Feb 4 20:40:29 2008 +++ php-src/ext/spl/spl.php Mon Feb 4 21:37:43 2008 @@ -1030,8 +1030,8 @@ */ class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveIterator { - const CURRENT_AS_FILEINFO 0x; /* make RecursiveDirectoryTree::current() return SplFileInfo */ - const CURRENT_AS_SELF 0x0010; /* make RecursiveDirectoryTree::current() return getSelf() */ + const CURRENT_AS_SELF 0x; /* make RecursiveDirectoryTree::current() return getSelf() */ + const CURRENT_AS_FILEINFO 0x0010; /* make RecursiveDirectoryTree::current() return SplFileInfo */ const CURRENT_AS_PATHNAME 0x0020; /* make RecursiveDirectoryTree::current() return getPathname() */ const KEY_AS_PATHNAME 0x; /* make RecursiveDirectoryTree::key() return getPathname() */ http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.h?r1=1.40r2=1.41diff_format=u Index: php-src/ext/spl/spl_directory.h diff -u php-src/ext/spl/spl_directory.h:1.40 php-src/ext/spl/spl_directory.h:1.41 --- php-src/ext/spl/spl_directory.h:1.40Mon Feb 4 19:33:03 2008 +++ php-src/ext/spl/spl_directory.h Mon Feb 4 21:37:43 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_directory.h,v 1.40 2008/02/04 19:33:03 helly Exp $ */ +/* $Id: spl_directory.h,v 1.41 2008/02/04 21:37:43 helly Exp $ */ #ifndef SPL_DIRECTORY_H #define SPL_DIRECTORY_H @@ -118,8 +118,8 @@ #define SPL_FILE_OBJECT_SKIP_EMPTY 0x0006 /* skip empty lines */ #define SPL_FILE_OBJECT_READ_CSV 0x0008 /* read via fgetcsv */ -#define SPL_FILE_DIR_CURRENT_AS_FILEINFO 0x /* make RecursiveDirectoryTree::current() return SplFileInfo */ -#define SPL_FILE_DIR_CURRENT_AS_SELF 0x0010 /* make RecursiveDirectoryTree::current() return getSelf() */ +#define SPL_FILE_DIR_CURRENT_AS_SELF 0x /* make RecursiveDirectoryTree::current() return getSelf() */ +#define SPL_FILE_DIR_CURRENT_AS_FILEINFO 0x0010 /* make RecursiveDirectoryTree::current() return SplFileInfo */ #define SPL_FILE_DIR_CURRENT_AS_PATHNAME 0x0020 /* make RecursiveDirectoryTree::current() return getPathname() */ #define SPL_FILE_DIR_CURRENT_MODE_MASK 0x00F0 /* mask RecursiveDirectoryTree::current() */ #define SPL_FILE_DIR_CURRENT(intern,mode) ((intern-flagsSPL_FILE_DIR_CURRENT_MODE_MASK)==mode) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/examples/tree.php?r1=1.13r2=1.14diff_format=u Index: php-src/ext/spl/examples/tree.php diff -u php-src/ext/spl/examples/tree.php:1.13 php-src/ext/spl/examples/tree.php:1.14 --- php-src/ext/spl/examples/tree.php:1.13 Tue Feb 21 23:21:53 2006 +++ php-src/ext/spl/examples/tree.php Mon Feb 4 21:37:43 2008 @@ -37,4 +37,4 @@ echo $file . \n; } -? \ No newline at end of file +? -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php /ext/spl/internal recursiveiterator.inc seekableiterator.inc
helly Tue Apr 17 06:31:19 2007 UTC Modified files: /php-src/ext/splspl.php /php-src/ext/spl/internal recursiveiterator.inc seekableiterator.inc Log: - Fix #41109: recursiveiterator.inc says 'implements' Iterator instead of 'extends' http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl.php?r1=1.78r2=1.79diff_format=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.78 php-src/ext/spl/spl.php:1.79 --- php-src/ext/spl/spl.php:1.78Mon Feb 26 22:32:57 2007 +++ php-src/ext/spl/spl.php Tue Apr 17 06:31:19 2007 @@ -32,12 +32,12 @@ * * SPL offers some advanced iterator algorithms: * - * - interface RecursiveIterator implements Iterator + * - interface RecursiveIterator extends Iterator * - interface OuterIterator extends Iterator * - class RecursiveIteratorIterator implements OuterIterator * - abstract class FilterIterator implements OuterIterator * - class ParentIterator extends FilterIterator implements RecursiveIterator - * - interface SeekableIterator implements Iterator + * - interface SeekableIterator extends Iterator * - class LimitIterator implements OuterIterator * - class CachingIterator implements OuterIterator * - class RecursiveCachingIterator extends CachingIterator implements RecursiveIterator http://cvs.php.net/viewvc.cgi/php-src/ext/spl/internal/recursiveiterator.inc?r1=1.7r2=1.8diff_format=u Index: php-src/ext/spl/internal/recursiveiterator.inc diff -u php-src/ext/spl/internal/recursiveiterator.inc:1.7 php-src/ext/spl/internal/recursiveiterator.inc:1.8 --- php-src/ext/spl/internal/recursiveiterator.inc:1.7 Tue Feb 21 23:21:53 2006 +++ php-src/ext/spl/internal/recursiveiterator.inc Tue Apr 17 06:31:19 2007 @@ -15,7 +15,7 @@ * @version 1.0 * @since PHP 5.0 */ -interface RecursiveIterator implements Iterator +interface RecursiveIterator extends Iterator { /** @return whether the current element has children */ http://cvs.php.net/viewvc.cgi/php-src/ext/spl/internal/seekableiterator.inc?r1=1.7r2=1.8diff_format=u Index: php-src/ext/spl/internal/seekableiterator.inc diff -u php-src/ext/spl/internal/seekableiterator.inc:1.7 php-src/ext/spl/internal/seekableiterator.inc:1.8 --- php-src/ext/spl/internal/seekableiterator.inc:1.7 Tue Feb 21 23:21:53 2006 +++ php-src/ext/spl/internal/seekableiterator.inc Tue Apr 17 06:31:19 2007 @@ -18,7 +18,7 @@ * to seek on an iterator LimitIterator can use this to efficiently rewind * to offset. */ -interface SeekableIterator implements Iterator +interface SeekableIterator extends Iterator { /** Seek to an absolute position * -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Sun Aug 13 10:37:46 2006 UTC Modified files: /php-src/ext/splspl.php Log: - Add link http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl.php?r1=1.74r2=1.75diff_format=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.74 php-src/ext/spl/spl.php:1.75 --- php-src/ext/spl/spl.php:1.74Sun Jul 16 23:48:15 2006 +++ php-src/ext/spl/spl.php Sun Aug 13 10:37:46 2006 @@ -112,6 +112,7 @@ * c-code. * * 9) Some articles about SPL: + * - a href=http://www.phpro.org/tutorials/Introduction-to-SPL.html;Introduction to Standard PHP Library (SPL)/a * - a href=http://www.sitepoint.com/article/php5-standard-library/1;Introducing PHP 5's Standard Library/a * - a href=http://www.ramikayyali.com/archives/2005/02/25/iterators;Iterators in PHP5/a * - a href=http://www.phpriot.com/d/articles/php/oop/oop-with-spl-php-5-1/index.html;Advanced OOP with SPL in PHP 5/a -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php /ext/spl/internal recursiveregexiterator.inc
helly Sun Jul 16 19:16:40 2006 UTC Added files: /php-src/ext/spl/internal recursiveregexiterator.inc Modified files: /php-src/ext/splspl.php Log: - Update docu http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl.php?r1=1.72r2=1.73diff_format=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.72 php-src/ext/spl/spl.php:1.73 --- php-src/ext/spl/spl.php:1.72Sat Mar 4 22:56:11 2006 +++ php-src/ext/spl/spl.php Sun Jul 16 19:16:40 2006 @@ -46,6 +46,8 @@ * - class EmptyIterator implements Iterator * - class InfiniteIterator extends IteratorIterator * - class AppendIterator implements OuterIterator + * - class RegexIterator extends FilterIterator + * - class RegursiveRegexIterator extends RegexIterator implements RecursiveIterator * * 2) Directories and Files * http://cvs.php.net/viewvc.cgi/php-src/ext/spl/internal/recursiveregexiterator.inc?view=markuprev=1.1 Index: php-src/ext/spl/internal/recursiveregexiterator.inc +++ php-src/ext/spl/internal/recursiveregexiterator.inc ?php /** @file recursiveregexiterator.inc * @ingroup SPL * @brief class RegexIterator * @author Marcus Boerger * @date2003 - 2006 * * SPL - Standard PHP Library */ /** * @brief Recursive regular expression filter for iterators * @author Marcus Boerger * @version 1.0 * @since PHP 5.1 * * This filter iterator assumes that the inner iterator */ class RecursiveRegexIterator extends RegexIterator implements RecursiveIterator { /** * Constructs a regular expression filter around an iterator whose * elemnts or keys are strings. * * @param it Object that implements at least */ function __construct(RecursiveIterator $it, $regex, $flags = 0, $mode = 0, $preg_flags = 0) { parent::__construct($it, $regex, $flags, $mode, $preg_flags); } /** @return whether the current element has children */ function hasChildren() { return $this-getInnerIterator()-hasChildren(); } /** @return an iterator for the current elements children * * @note the returned iterator will be of the same class as $this */ function getChildren() { if (empty($this-ref)) { $this-ref = new ReflectionClass($this); } return $this-ref-newInstance($this-getInnerIterator()-getChildren()); } private $ref; } ? -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Sun Jul 16 23:48:15 2006 UTC Modified files: /php-src/ext/splspl.php Log: -Typo http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl.php?r1=1.73r2=1.74diff_format=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.73 php-src/ext/spl/spl.php:1.74 --- php-src/ext/spl/spl.php:1.73Sun Jul 16 19:16:40 2006 +++ php-src/ext/spl/spl.php Sun Jul 16 23:48:15 2006 @@ -47,7 +47,7 @@ * - class InfiniteIterator extends IteratorIterator * - class AppendIterator implements OuterIterator * - class RegexIterator extends FilterIterator - * - class RegursiveRegexIterator extends RegexIterator implements RecursiveIterator + * - class RecursiveRegexIterator extends RegexIterator implements RecursiveIterator * * 2) Directories and Files * -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php spl_directory.c
helly Sat Mar 4 22:56:11 2006 UTC Modified files: /php-src/ext/splspl.php spl_directory.c Log: - Need to change a few things to exception based error handling - Drop erroneus/useless RecursiveDirectoryIterator::getSubPathInfo() http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl.php?r1=1.71r2=1.72diff_format=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.71 php-src/ext/spl/spl.php:1.72 --- php-src/ext/spl/spl.php:1.71Tue Feb 21 23:21:53 2006 +++ php-src/ext/spl/spl.php Sat Mar 4 22:56:11 2006 @@ -948,8 +948,8 @@ */ function setFileClass(string class_name = SplFileObject) {/**/} - /** @param class_name name of class used with getFileInfo(), getPathInfo(), -*getSubPathInfo(). Must be derived from SplFileInfo. + /** @param class_name name of class used with getFileInfo(), getPathInfo(). +* Must be derived from SplFileInfo. */ function setInfoClass(string class_name = SplFileInfo) {/**/} } @@ -1041,13 +1041,6 @@ /** @return the current sub path */ function getSubPathname() {/**/} - - /** @return SplFileInfo created for the current sub path -* @param class_name name of class to instantiate -* @see SplFileInfo::setInfoClass() -*/ - function getSubPathInfo(string $class_name = NULL) {/**/} - } /** @ingroup SPL http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_directory.c?r1=1.78r2=1.79diff_format=u Index: php-src/ext/spl/spl_directory.c diff -u php-src/ext/spl/spl_directory.c:1.78 php-src/ext/spl/spl_directory.c:1.79 --- php-src/ext/spl/spl_directory.c:1.78Mon Feb 27 22:31:07 2006 +++ php-src/ext/spl/spl_directory.c Sat Mar 4 22:56:11 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_directory.c,v 1.78 2006/02/27 22:31:07 helly Exp $ */ +/* $Id: spl_directory.c,v 1.79 2006/03/04 22:56:11 helly Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -748,26 +748,30 @@ spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zend_class_entry *ce = spl_ce_SplFileObject; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |C, ce) == FAILURE) { - return; + php_set_error_handling(EH_THROW, spl_ce_UnexpectedValueException TSRMLS_CC); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |C, ce) == SUCCESS) { + intern-file_class = ce; } - intern-file_class = ce; + php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } /* }}} */ /* {{{ proto SplFileObject SplFileInfo::setInfoClass([string class_name]) - Class to use in getFileInfo(), getPathInfo(), getSubPathInfo() */ + Class to use in getFileInfo(), getPathInfo() */ SPL_METHOD(SplFileInfo, setInfoClass) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zend_class_entry *ce = spl_ce_SplFileInfo; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |C, ce) == FAILURE) { - return; + php_set_error_handling(EH_THROW, spl_ce_UnexpectedValueException TSRMLS_CC); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |C, ce) == SUCCESS) { + intern-info_class = ce; } - intern-info_class = ce; + php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } /* }}} */ @@ -778,11 +782,13 @@ spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zend_class_entry *ce = intern-info_class; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |C, ce) == FAILURE) { - return; + php_set_error_handling(EH_THROW, spl_ce_UnexpectedValueException TSRMLS_CC); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |C, ce) == SUCCESS) { + spl_filesystem_object_create_type(ht, intern, SPL_FS_INFO, ce, return_value TSRMLS_CC); } - spl_filesystem_object_create_type(ht, intern, SPL_FS_INFO, ce, return_value TSRMLS_CC); + php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); } /* }}} */ @@ -793,11 +799,13 @@ spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); zend_class_entry *ce = intern-info_class; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |C, ce) == FAILURE) { - return; + php_set_error_handling(EH_THROW, spl_ce_UnexpectedValueException TSRMLS_CC); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |C, ce) == SUCCESS) { + spl_filesystem_object_create_info(intern, intern-path, intern-path_len, 1, ce, return_value TSRMLS_CC); } -
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Tue Feb 21 09:45:38 2006 UTC Modified files: /php-src/ext/splspl.php Log: - Update http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl.php?r1=1.66r2=1.67diff_format=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.66 php-src/ext/spl/spl.php:1.67 --- php-src/ext/spl/spl.php:1.66Mon Feb 20 22:21:24 2006 +++ php-src/ext/spl/spl.php Tue Feb 21 09:45:38 2006 @@ -66,8 +66,8 @@ * * SPL offers advanced Array overloading: * - * - class ArrayObject implements IteratorAggregate - * - class ArrayIterator implements Iterator + * - class ArrayObject implements IteratorAggregate, ArrayAccess, Countable + * - class ArrayIterator implements Iterator, ArrayAccess, Countable, SeekableIterator * - class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator * * As the above suggest an ArrayObject creates an ArrayIterator when it comes to -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Tue Feb 21 09:47:09 2006 UTC Modified files: /php-src/ext/splspl.php Log: - Its 2006 already http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl.php?r1=1.67r2=1.68diff_format=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.67 php-src/ext/spl/spl.php:1.68 --- php-src/ext/spl/spl.php:1.67Tue Feb 21 09:45:38 2006 +++ php-src/ext/spl/spl.php Tue Feb 21 09:47:09 2006 @@ -128,7 +128,7 @@ * You can download this documentation as a chm file * a href=http://php.net/~helly/php/ext/spl/spl.chm;here/a. * - * (c) Marcus Boerger, 2003 - 2005 + * (c) Marcus Boerger, 2003 - 2006 */ /** @defgroup ZendEngine Zend engine classes -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Tue Feb 21 21:19:34 2006 UTC Modified files: /php-src/ext/splspl.php Log: - Ensure non abstract methods have code # This is very usefull once doxygen 1.4.7 comes out with my patch :-) http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl.php?r1=1.68r2=1.69diff_format=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.68 php-src/ext/spl/spl.php:1.69 --- php-src/ext/spl/spl.php:1.68Tue Feb 21 09:47:09 2006 +++ php-src/ext/spl/spl.php Tue Feb 21 21:19:34 2006 @@ -157,7 +157,7 @@ * @param class_namename of class to load * @param file_extensions file extensions (use defaults if NULL) */ -function spl_autoload(string $class_name, string $file_extensions = NULL); +function spl_autoload(string $class_name, string $file_extensions = NULL) {/**/}; /** @ingroup SPL * @brief Manual invocation of all registerd autoload functions @@ -165,7 +165,7 @@ * * @param class_namename of class to load */ -function spl_autoload_call(string $class_name); +function spl_autoload_call(string $class_name) {/**/}; /** @ingroup SPL * @brief Register and return default file extensions for spl_autoload @@ -176,7 +176,7 @@ * @return comma separated list of file extensions to use in default autoload *function. */ -function spl_autoload_extensions($file_extensions); +function spl_autoload_extensions($file_extensions) {/**/}; /** @ingroup SPL * @brief Return all registered autoload functionns @@ -184,7 +184,7 @@ * * @return array of all registered autoload functions or false */ -function spl_autoload_functions(); +function spl_autoload_functions() {/**/}; /** @ingroup SPL * @brief Register given function as autoload implementation @@ -194,7 +194,7 @@ * function name to register as autoload function. * @param throw whether to throw or issue an error on failure. */ -function spl_autoload_register(string $autoload_function = spl_autoload, $throw = true); +function spl_autoload_register(string $autoload_function = spl_autoload, $throw = true) {/**/}; /** @ingroup SPL * @brief Unregister given function as autoload implementation @@ -203,7 +203,7 @@ * @param autoload_function name of function or array of object/class and * function name to unregister as autoload function. */ -function spl_autoload_unregister(string $autoload_function = spl_autoload); +function spl_autoload_unregister(string $autoload_function = spl_autoload) {/**/}; /** @ingroup SPL * @brief Return an array of classes and interfaces in SPL @@ -211,7 +211,7 @@ * @return array containing the names of all clsses and interfaces defined in * extension SPL */ -function spl_classes(); +function spl_classes() {/**/}; /** @ingroup SPL * @brief Count the elements in an iterator @@ -219,7 +219,7 @@ * * @return number of elements in an iterator */ -function iterator_count(Traversable $it); +function iterator_count(Traversable $it) {/**/}; /** @ingroup SPL * @brief Copy iterator elements into an array @@ -228,7 +228,7 @@ * @param it iterator to copy * @return array with elements copied from the iterator */ -function iterator_to_array(Traversable $it); +function iterator_to_array(Traversable $it) {/**/}; /** @ingroup ZendEngine * @brief Basic Exception class. @@ -611,7 +611,7 @@ * @param $flags see setFlags(). * @param $iterator_class class used in getIterator() */ - function __construct($array, $flags = 0, $iterator_class = ArrayIterator); + function __construct($array, $flags = 0, $iterator_class = ArrayIterator) {/**/} /** Set behavior flags. * @@ -620,90 +620,88 @@ * when accessed as list (var_dump, foreach, etc.) *1 set: array indices can be accessed as properties in read/write */ - function setFlags($flags); + function setFlags($flags) {/**/} - /** -* @ return current flags + /** @return current flags */ - function getFlags(); + function getFlags() {/**/} /** Sort the entries by values. */ - function asort(); + function asort() {/**/} /** Sort the entries by key. */ - function ksort(); + function ksort() {/**/} /** Sort the entries by values using user defined function. */ - function uasort(mixed cmp_function); + function uasort(mixed cmp_function) {/**/} /** Sort the entries by key using user defined function. */ - function uksort(mixed cmp_function); + function uksort(mixed cmp_function) {/**/} /** Sort the entries by values using natural order algorithm. */ - function natsort(); + function natsort() {/**/} /** Sort
[PHP-CVS] cvs: php-src /ext/spl spl.php /ext/spl/examples autoload.inc cachingrecursiveiterator.inc class_tree.php dba_array.php dba_dump.php dbaarray.inc dbareader.inc directoryfilterdots.inc direct
helly Tue Feb 21 23:21:53 2006 UTC Modified files: /php-src/ext/splspl.php /php-src/ext/spl/examples autoload.inc cachingrecursiveiterator.inc class_tree.php dba_array.php dba_dump.php dbaarray.inc dbareader.inc directoryfilterdots.inc directorygraphiterator.inc directorytree.inc directorytree.php directorytree_size.php directorytreeiterator.inc findfile.inc findfile.php ini_groups.php inigroups.inc keyfilter.inc regexfindfile.inc searchiterator.inc tree.php xml_tree.php xml_xpath_tree.php /php-src/ext/spl/internal appenditerator.inc cachingiterator.inc emptyiterator.inc filteriterator.inc infiniteiterator.inc iteratoriterator.inc limititerator.inc norewinditerator.inc outeriterator.inc parentiterator.inc recursivearrayiterator.inc recursivecachingiterator.inc recursivefilteriterator.inc recursiveiterator.inc recursiveiteratoriterator.inc seekableiterator.inc splfileobject.inc splobjectstorage.inc Log: - 2006 now http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl.php?r1=1.70r2=1.71diff_format=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.70 php-src/ext/spl/spl.php:1.71 --- php-src/ext/spl/spl.php:1.70Tue Feb 21 21:22:39 2006 +++ php-src/ext/spl/spl.php Tue Feb 21 23:21:53 2006 @@ -6,7 +6,7 @@ * * SPL - Standard PHP Library * - * (c) Marcus Boerger, 2003 - 2005 + * (c) Marcus Boerger, 2003 - 2006 */ /** @mainpage SPL - Standard PHP Library http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/examples/autoload.inc?r1=1.7r2=1.8diff_format=u Index: php-src/ext/spl/examples/autoload.inc diff -u php-src/ext/spl/examples/autoload.inc:1.7 php-src/ext/spl/examples/autoload.inc:1.8 --- php-src/ext/spl/examples/autoload.inc:1.7 Tue Feb 8 19:10:04 2005 +++ php-src/ext/spl/examples/autoload.inc Tue Feb 21 23:21:53 2006 @@ -4,7 +4,7 @@ * @ingroup Examples * @brief function __autoload * @author Marcus Boerger - * @date2003 - 2005 + * @date2003 - 2006 * * SPL - Standard PHP Library */ http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/examples/cachingrecursiveiterator.inc?r1=1.10r2=1.11diff_format=u Index: php-src/ext/spl/examples/cachingrecursiveiterator.inc diff -u php-src/ext/spl/examples/cachingrecursiveiterator.inc:1.10 php-src/ext/spl/examples/cachingrecursiveiterator.inc:1.11 --- php-src/ext/spl/examples/cachingrecursiveiterator.inc:1.10 Mon Sep 19 18:28:01 2005 +++ php-src/ext/spl/examples/cachingrecursiveiterator.inc Tue Feb 21 23:21:53 2006 @@ -4,7 +4,7 @@ * @ingroup Examples * @brief class CachingRecursiveIterator * @author Marcus Boerger - * @date2003 - 2005 + * @date2003 - 2006 * * SPL - Standard PHP Library */ http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/examples/class_tree.php?r1=1.6r2=1.7diff_format=u Index: php-src/ext/spl/examples/class_tree.php diff -u php-src/ext/spl/examples/class_tree.php:1.6 php-src/ext/spl/examples/class_tree.php:1.7 --- php-src/ext/spl/examples/class_tree.php:1.6 Sun Oct 30 16:07:29 2005 +++ php-src/ext/spl/examples/class_tree.php Tue Feb 21 23:21:53 2006 @@ -4,7 +4,7 @@ * @brief Class Tree example * @ingroup Examples * @author Marcus Boerger - * @date2003 - 2005 + * @date2003 - 2006 * @version 1.1 * * Usage: php class_tree.php \class\ http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/examples/dba_array.php?r1=1.6r2=1.7diff_format=u Index: php-src/ext/spl/examples/dba_array.php diff -u php-src/ext/spl/examples/dba_array.php:1.6 php-src/ext/spl/examples/dba_array.php:1.7 --- php-src/ext/spl/examples/dba_array.php:1.6 Tue Feb 8 19:10:04 2005 +++ php-src/ext/spl/examples/dba_array.php Tue Feb 21 23:21:53 2006 @@ -4,7 +4,7 @@ * @brief Program DBA array utility * @ingroup Examples * @author Marcus Boerger - * @date2003 - 2005 + * @date2003 - 2006 * * Usage php dba_array.php \file\ \handler\ \key\ [\value\] * http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/examples/dba_dump.php?r1=1.10r2=1.11diff_format=u Index: php-src/ext/spl/examples/dba_dump.php diff -u php-src/ext/spl/examples/dba_dump.php:1.10 php-src/ext/spl/examples/dba_dump.php:1.11 --- php-src/ext/spl/examples/dba_dump.php:1.10 Tue Feb 8 19:10:04 2005 +++ php-src/ext/spl/examples/dba_dump.php Tue
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Mon Feb 20 22:21:24 2006 UTC Modified files: /php-src/ext/splspl.php Log: - WS http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl.php?r1=1.65r2=1.66diff_format=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.65 php-src/ext/spl/spl.php:1.66 --- php-src/ext/spl/spl.php:1.65Mon Feb 20 22:19:04 2006 +++ php-src/ext/spl/spl.php Mon Feb 20 22:21:24 2006 @@ -634,7 +634,7 @@ /** Sort the entries by key. */ function ksort(); - + /** Sort the entries by values using user defined function. */ function uasort(mixed cmp_function); @@ -642,7 +642,7 @@ /** Sort the entries by key using user defined function. */ function uksort(mixed cmp_function); - + /** Sort the entries by values using natural order algorithm. */ function natsort(); @@ -650,7 +650,7 @@ /** Sort the entries by values using case insensitive natural order algorithm. */ function natcasesort(); - + /** * @param $array new array or object */ @@ -756,7 +756,7 @@ /** Sort the entries by key. */ function ksort(); - + /** Sort the entries by values using user defined function. */ function uasort(mixed cmp_function); @@ -764,7 +764,7 @@ /** Sort the entries by key using user defined function. */ function uksort(mixed cmp_function); - + /** Sort the entries by values using natural order algorithm. */ function natsort(); @@ -772,7 +772,7 @@ /** Sort the entries by values using case insensitive natural order algorithm. */ function natcasesort(); - + /** @param $index offset to inspect * @return whetehr offset $index esists */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Sat Jan 14 20:20:53 2006 UTC Modified files: /php-src/ext/splspl.php Log: - Update http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl.php?r1=1.63r2=1.64diff_format=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.63 php-src/ext/spl/spl.php:1.64 --- php-src/ext/spl/spl.php:1.63Tue Nov 1 21:46:31 2005 +++ php-src/ext/spl/spl.php Sat Jan 14 20:20:53 2006 @@ -811,7 +811,7 @@ /** @ingroup SPL * @brief File info class - * @since PHP 6.0 + * @since PHP 5.1.3 */ class SplFileInfo { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php /ext/spl/examples xml_tree.php xml_xpath_tree.php
helly Tue Nov 1 16:46:33 2005 EDT Modified files: /php-src/ext/splspl.php /php-src/ext/spl/examples xml_tree.php xml_xpath_tree.php Log: - Update docu http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.62r2=1.63ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.62 php-src/ext/spl/spl.php:1.63 --- php-src/ext/spl/spl.php:1.62Mon Oct 31 15:29:29 2005 +++ php-src/ext/spl/spl.php Tue Nov 1 16:46:31 2005 @@ -144,6 +144,86 @@ * c-code. */ +/** @ingroup SPL + * @brief Default implementation for __autoload() + * @since PHP 5.1 + * + * @param class_namename of class to load + * @param file_extensions file extensions (use defaults if NULL) + */ +function spl_autoload(string $class_name, string $file_extensions = NULL); + +/** @ingroup SPL + * @brief Manual invocation of all registerd autoload functions + * @since PHP 5.1 + * + * @param class_namename of class to load + */ +function spl_autoload_call(string $class_name); + +/** @ingroup SPL + * @brief Register and return default file extensions for spl_autoload + * @since PHP 5.1 + * + * @param file_extensions optional comma separated list of extensions to use in + *default autoload function. If not given just return the current list. + * @return comma separated list of file extensions to use in default autoload + *function. + */ +function spl_autoload_extensions($file_extensions); + +/** @ingroup SPL + * @brief Return all registered autoload functionns + * @since PHP 5.1 + * + * @return array of all registered autoload functions or false + */ +function spl_autoload_functions(); + +/** @ingroup SPL + * @brief Register given function as autoload implementation + * @since PHP 5.1 + * + * @param autoload_function name of function or array of object/class and + * function name to register as autoload function. + * @param throw whether to throw or issue an error on failure. + */ +function spl_autoload_register(string $autoload_function = spl_autoload, $throw = true); + +/** @ingroup SPL + * @brief Unregister given function as autoload implementation + * @since PHP 5.1 + * + * @param autoload_function name of function or array of object/class and + * function name to unregister as autoload function. + */ +function spl_autoload_unregister(string $autoload_function = spl_autoload); + +/** @ingroup SPL + * @brief Return an array of classes and interfaces in SPL + * + * @return array containing the names of all clsses and interfaces defined in + * extension SPL + */ +function spl_classes(); + +/** @ingroup SPL + * @brief Count the elements in an iterator + * @since PHP 5.1 + * + * @return number of elements in an iterator + */ +function iterator_count(Traversable $it); + +/** @ingroup SPL + * @brief Copy iterator elements into an array + * @since PHP 5.1 + * + * @param it iterator to copy + * @return array with elements copied from the iterator + */ +function iterator_to_array(Traversable $it); + /** @ingroup ZendEngine * @brief Basic Exception class. * @since PHP 5.0 @@ -750,16 +830,20 @@ function getFilename(); /** @return SplFileInfo created for the file +* @param class_name name of class to instantiate +* @see SplFileInfo::setInfoClass() */ - function getFileInfo(); + function getFileInfo(string class_name = NULL); /** @return The current entries path and file name. */ function getPathname(); /** @return SplFileInfo created for the path +* @param class_name name of class to instantiate +* @see SplFileInfo::setInfoClass() */ - function getPathInfo(); + function getPathInfo(string class_name = NULL); /** @return The current entry's permissions. */ @@ -835,9 +919,20 @@ * @return The opened file as a SplFileObject instance * * @see SplFileObject +* @see SplFileInfo::setFileClass() * @see file() */ function openFile($mode = 'r', $use_include_path = false, $context = NULL); + + /** @param class_name name of class used with openFile(). Must be derived +* from SPLFileObject. +*/ + function setFileClass(string class_name = SplFileObject); + + /** @param class_name name of class used with getFileInfo(), getPathInfo(), +*getSubPathInfo(). Must be derived from SplFileInfo. +*/ + function setInfoClass(string class_name = SplFileInfo); } /** @ingroup SPL @@ -887,7 +982,11 @@ /** Construct a directory iterator from a path-string. * -* @param $path directory to iterate. +* @param $path directory to iterate. +* @param $flags open flags +* - CURRENT_AS_FILEINFO +* - KEY_AS_FILENAME +* - NEW_CURRENT_AND_KEY
[PHP-CVS] cvs: php-src /ext/spl spl.php spl_sxe.c /ext/spl/tests sxe_005.phpt
helly Mon Oct 31 15:29:34 2005 EDT Added files: /php-src/ext/spl/tests sxe_005.phpt Modified files: /php-src/ext/splspl.php spl_sxe.c Log: - Make SimpleXMLIterator implement Countable http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.61r2=1.62ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.61 php-src/ext/spl/spl.php:1.62 --- php-src/ext/spl/spl.php:1.61Mon Oct 10 17:06:54 2005 +++ php-src/ext/spl/spl.php Mon Oct 31 15:29:29 2005 @@ -932,7 +932,7 @@ * has subelements, hasChildren() returns true. This will trigger a call to * getChildren() which returns the iterator for that sub element. */ -class SimpleXMLIterator extends SimpleXMLElement implements RecursiveIterator +class SimpleXMLIterator extends SimpleXMLElement implements RecursiveIterator, Countable { /** @return whether the current node has sub nodes. */ @@ -941,6 +941,10 @@ /** @return a SimpleXMLIterator for the current node. */ function getChildren(); + + /** @return number of elements/attributes seen with foreach() +*/ + function count(); } /** @ingroup SPL http://cvs.php.net/diff.php/php-src/ext/spl/spl_sxe.c?r1=1.14r2=1.15ty=u Index: php-src/ext/spl/spl_sxe.c diff -u php-src/ext/spl/spl_sxe.c:1.14 php-src/ext/spl/spl_sxe.c:1.15 --- php-src/ext/spl/spl_sxe.c:1.14 Sat Oct 29 16:37:59 2005 +++ php-src/ext/spl/spl_sxe.c Mon Oct 31 15:29:29 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_sxe.c,v 1.14 2005/10/29 20:37:59 helly Exp $ */ +/* $Id: spl_sxe.c,v 1.15 2005/10/31 20:29:29 helly Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -32,6 +32,7 @@ #include spl_engine.h #include spl_iterators.h #include spl_sxe.h +#include spl_array.h zend_class_entry *spl_ce_SimpleXMLIterator = NULL; zend_class_entry *spl_ce_SimpleXMLElement; @@ -135,6 +136,15 @@ return_value-value.obj = zend_objects_store_clone_obj(sxe-iter.data TSRMLS_CC); } +SPL_METHOD(SimpleXMLIterator, count) /* {{{ */ +{ + long count = 0; + + Z_OBJ_HANDLER_P(getThis(), count_elements)(getThis(), count TSRMLS_CC); + + RETURN_LONG(count); +} + static zend_function_entry spl_funcs_SimpleXMLIterator[] = { SPL_ME(SimpleXMLIterator, rewind, NULL, ZEND_ACC_PUBLIC) SPL_ME(SimpleXMLIterator, valid, NULL, ZEND_ACC_PUBLIC) @@ -143,6 +153,7 @@ SPL_ME(SimpleXMLIterator, next, NULL, ZEND_ACC_PUBLIC) SPL_ME(SimpleXMLIterator, hasChildren,NULL, ZEND_ACC_PUBLIC) SPL_ME(SimpleXMLIterator, getChildren,NULL, ZEND_ACC_PUBLIC) + SPL_ME(SimpleXMLIterator, count, NULL, ZEND_ACC_PUBLIC) {NULL, NULL, NULL} }; /* }}} */ @@ -161,6 +172,7 @@ REGISTER_SPL_SUB_CLASS_EX(SimpleXMLIterator, SimpleXMLElement, spl_ce_SimpleXMLElement-create_object, spl_funcs_SimpleXMLIterator); REGISTER_SPL_IMPLEMENTS(SimpleXMLIterator, RecursiveIterator); + REGISTER_SPL_IMPLEMENTS(SimpleXMLIterator, Countable); return SUCCESS; } http://cvs.php.net/co.php/php-src/ext/spl/tests/sxe_005.phpt?r=1.1p=1 Index: php-src/ext/spl/tests/sxe_005.phpt +++ php-src/ext/spl/tests/sxe_005.phpt --TEST-- SPL: SimpleXMLIterator and getChildren() --SKIPIF-- ?php if (!extension_loaded(spl)) print skip; if (!extension_loaded('simplexml')) print 'skip'; if (!extension_loaded(libxml)) print skip LibXML not present; if (!class_exists('RecursiveIteratorIterator')) print 'skip RecursiveIteratorIterator not available'; ? --FILE-- ?php $xml =EOF ?xml version='1.0'? sxe elem1/ elem2/ elem2/ /sxe EOF; class SXETest extends SimpleXMLIterator { function count() { echo __METHOD__ . \n; return parent::count(); } } $sxe = new SXETest($xml); var_dump(count($sxe)); var_dump(count($sxe-elem1)); var_dump(count($sxe-elem2)); ? ===DONE=== --EXPECT-- SXETest::count int(3) SXETest::count int(1) SXETest::count int(2) ===DONE=== -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php spl_directory.c
helly Mon Oct 10 17:06:57 2005 EDT Modified files: /php-src/ext/splspl.php spl_directory.c Log: - Finalize work on SplFileInfo and derived for now (add missing get*Info()) - Update docu http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.60r2=1.61ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.60 php-src/ext/spl/spl.php:1.61 --- php-src/ext/spl/spl.php:1.60Sat Oct 8 14:57:15 2005 +++ php-src/ext/spl/spl.php Mon Oct 10 17:06:54 2005 @@ -749,10 +749,18 @@ */ function getFilename(); + /** @return SplFileInfo created for the file +*/ + function getFileInfo(); + /** @return The current entries path and file name. */ function getPathname(); + /** @return SplFileInfo created for the path +*/ + function getPathInfo(); + /** @return The current entry's permissions. */ function getPerms(); @@ -898,6 +906,19 @@ /** @return a RecursiveDirectoryIterator for the current entry. */ function getChildren(); + + /** @return sub path only (without main path) +*/ + function getSubPath(); + + /** @return the current sub path +*/ + function getSubPathname(); + + /** @return SplFileInfo created for the current sub path +*/ + function getSubPathInfo(); + } /** @ingroup SPL http://cvs.php.net/diff.php/php-src/ext/spl/spl_directory.c?r1=1.51r2=1.52ty=u Index: php-src/ext/spl/spl_directory.c diff -u php-src/ext/spl/spl_directory.c:1.51 php-src/ext/spl/spl_directory.c:1.52 --- php-src/ext/spl/spl_directory.c:1.51Sat Oct 8 14:57:16 2005 +++ php-src/ext/spl/spl_directory.c Mon Oct 10 17:06:54 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_directory.c,v 1.51 2005/10/08 18:57:16 helly Exp $ */ +/* $Id: spl_directory.c,v 1.52 2005/10/10 21:06:54 helly Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -265,7 +265,49 @@ } /* }}} */ -static void spl_filesystem_object_create_type(int ht, spl_filesystem_object *source, int type, zval *return_value TSRMLS_DC) /* {{{ */ +void spl_filesystem_info_set_filename(spl_filesystem_object *intern, char *path, int len, int use_copy TSRMLS_DC) /* {{{ */ +{ + char *p1, *p2; + + intern-file_name = use_copy ? estrndup(path, len) : path; + intern-file_name_len = len; + + p1 = strrchr(path, '/'); + p2 = strrchr(path, '\\'); + if (p1 || p2) { + intern-path_len = (p1 p2 ? p1 : p2) - path; + } else { + intern-path_len = 0; + } + intern-path = estrndup(path, intern-path_len); +} /* }}} */ + +static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_object *source, char *file_path, int file_path_len, int use_copy, zval *return_value TSRMLS_DC) /* {{{ */ +{ + spl_filesystem_object *intern; + + if (!file_path || !file_path_len) { + zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, Cannot create SplFileInfo for empty path); + if (file_path !use_copy) + { + efree(file_path); + } + return NULL; + } + + php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_RuntimeException) TSRMLS_CC); + + return_value-value.obj = spl_filesystem_object_new_ex(spl_ce_SplFileInfo, intern TSRMLS_CC); + Z_TYPE_P(return_value) = IS_OBJECT; + + spl_filesystem_info_set_filename(intern, file_path, file_path_len, use_copy TSRMLS_CC); + + php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); + + return intern; +} /* }}} */ + +static spl_filesystem_object * spl_filesystem_object_create_type(int ht, spl_filesystem_object *source, int type, zval *return_value TSRMLS_DC) /* {{{ */ { spl_filesystem_object *intern; zend_bool use_include_path = 0; @@ -280,7 +322,7 @@ if (!source-u.dir.entry.d_name[0]) { zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, Could not open file); php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); - return; + return NULL; } } @@ -292,8 +334,6 @@ spl_filesystem_object_get_file_name(source TSRMLS_CC); intern-file_name = estrndup(source-file_name, source-file_name_len); intern-file_name_len = source-file_name_len; - - php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); break; case SPL_FS_FILE: return_value-value.obj = spl_filesystem_object_new_ex(spl_ce_SplFileObject, intern TSRMLS_CC); @@ -306,27 +346,29 @@ intern-u.file.open_mode = r;
[PHP-CVS] cvs: php-src /ext/spl spl.php spl_directory.c spl_directory.h spl_iterators.h /ext/spl/examples directorytree_size.php recursivetreeiterator.inc /ext/spl/internal cachingiterator.inc recur
helly Sat Oct 8 14:57:17 2005 EDT Added files: /php-src/ext/spl/examples directorytree_size.php Modified files: /php-src/ext/splspl.php spl_directory.c spl_directory.h spl_iterators.h /php-src/ext/spl/examples recursivetreeiterator.inc /php-src/ext/spl/internal cachingiterator.inc recursiveiteratoriterator.inc splfileobject.inc Log: - Add new example directorytree_size.php - Improve SplFileInfo: . add function getFilename() . add function getPath() -Improve RecursiveTreeIterator . add const BYPASS_CURRENT to bypass current instead of getting its string representation . make key() return the parent key() which calls inner iterators key() - Improve RecursiveDirectoryIterator . add consts CURRENT_AS_FILEINFO, KEY_AS_FILENAME, NEW_CURRENT_AND_KEY . make current() return getFilename() or getFileInfo() depending on flags . make key() return getPathname() or getFilename() depending on flags - Improve DirectoryIterator . make __construct() accept flags as second parameter - Update docu http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.59r2=1.60ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.59 php-src/ext/spl/spl.php:1.60 --- php-src/ext/spl/spl.php:1.59Mon Oct 3 09:34:00 2005 +++ php-src/ext/spl/spl.php Sat Oct 8 14:57:15 2005 @@ -51,9 +51,10 @@ * * SPL offers two advanced directory and file handling classes: * - * - class DirectoryIterator implements Iterator + * - class SplFileInfo + * - class DirectoryIterator extends SplFileInfo implements Iterator * - class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveIterator - * - class SplFileObject implements RecursiveIterator, SeekableIterator + * - class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIterator * * 3) XML * @@ -729,22 +730,22 @@ } /** @ingroup SPL - * @brief Directory iterator - * @since PHP 5.0 + * @brief File info class + * @since PHP 6.0 */ -class DirectoryIterator implements Iterator +class SplFileInfo { - /** Construct a directory iterator from a path-string. + /** Construct a file info object * -* @param $path directory to iterate. +* @param $file_name path or file name */ - function __construct($path); + function __construct($file_name); - /** @return The opened path. + /** @return the path part only. */ function getPath(); - /** @return The current file name. + /** @return the filename only. */ function getFilename(); @@ -808,15 +809,11 @@ */ function isDir(); - /** @return Whether the current entry is either '.' or '..'. -*/ - function isDot(); - /** @return whether the current entry is a link. */ function isLink(); - /** @return getFilename() + /** @return getPathname() */ function __toString(); @@ -832,15 +829,68 @@ * @see SplFileObject * @see file() */ - function DirectoryIterator::openFile($mode = 'r', $use_include_path = false, $context = NULL); + function openFile($mode = 'r', $use_include_path = false, $context = NULL); +} + +/** @ingroup SPL + * @brief Directory iterator + * @version 1.1 + * @since PHP 5.0 + */ +class DirectoryIterator extends SplFileInfo implements Iterator +{ + /** Construct a directory iterator from a path-string. +* +* @param $path directory to iterate. +*/ + function __construct($path); + + /** @return index of entry +*/ + function key(); + + /** @return $this +*/ + function current(); + + /** @return Whether the current entry is either '.' or '..'. +*/ + function isDot(); + + /** @return whether the current entry is a link. +*/ + function isLink(); + + /** @return getFilename() +*/ + function __toString(); } /** @ingroup SPL * @brief recursive directory iterator + * @version 1.1 * @since PHP 5.0 */ class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveIterator { + const CURRENT_AS_FILEINFO 0x0010; /* make RecursiveDirectoryTree::current() return SplFileInfo */ + const KEY_AS_FILENAME 0x0020; /* make RecursiveDirectoryTree::key() return getFilename() */ + const NEW_CURRENT_AND_KEY 0x0030; /* CURRENT_AS_FILEINFO + KEY_AS_FILENAME */ + + /** Construct a directory iterator from a path-string. +* +* @param $path directory to iterate. +*/ + function __construct($path, $flags = 0); + + /** @return getPathname() or getFilename() depending
[PHP-CVS] cvs: php-src /ext/spl spl.php spl_array.c /ext/spl/examples class_tree.php
helly Mon Oct 3 09:34:02 2005 EDT Modified files: /php-src/ext/splspl.php spl_array.c /php-src/ext/spl/examples class_tree.php Log: - Add more sorting funcs to ArrayObject/Iterator http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.58r2=1.59ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.58 php-src/ext/spl/spl.php:1.59 --- php-src/ext/spl/spl.php:1.58Sat Sep 24 19:18:14 2005 +++ php-src/ext/spl/spl.php Mon Oct 3 09:34:00 2005 @@ -502,7 +502,7 @@ /** @ingroup SPL * @brief An Array wrapper * @since PHP 5.0 - * @version 1.1 + * @version 1.2 * * This array wrapper allows to recursively iterate over Arrays and public * Object properties. @@ -540,6 +540,30 @@ */ function getFlags(); + /** Sort the entries by values. +*/ + function asort(); + + /** Sort the entries by key. +*/ + function ksort(); + + /** Sort the entries by values using user defined function. +*/ + function uasort(mixed cmp_function); + + /** Sort the entries by key using user defined function. +*/ + function uksort(mixed cmp_function); + + /** Sort the entries by values using natural order algorithm. +*/ + function natsort(); + + /** Sort the entries by values using case insensitive natural order algorithm. +*/ + function natcasesort(); + /** * @param $array new array or object */ @@ -598,7 +622,7 @@ /** @ingroup SPL * @brief An Array iterator * @since PHP 5.0 - * @version 1.1 + * @version 1.2 * * This iterator allows to unset and modify values and keys while iterating * over Arrays and Objects. @@ -632,12 +656,36 @@ *1 set: array indices can be accessed as properties in read/write */ function setFlags($flags); - + /** * @ return current flags */ function getFlags(); + /** Sort the entries by values. +*/ + function asort(); + + /** Sort the entries by key. +*/ + function ksort(); + + /** Sort the entries by values using user defined function. +*/ + function uasort(mixed cmp_function); + + /** Sort the entries by key using user defined function. +*/ + function uksort(mixed cmp_function); + + /** Sort the entries by values using natural order algorithm. +*/ + function natsort(); + + /** Sort the entries by values using case insensitive natural order algorithm. +*/ + function natcasesort(); + /** @param $index offset to inspect * @return whetehr offset $index esists */ http://cvs.php.net/diff.php/php-src/ext/spl/spl_array.c?r1=1.82r2=1.83ty=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.82 php-src/ext/spl/spl_array.c:1.83 --- php-src/ext/spl/spl_array.c:1.82Mon Oct 3 08:55:08 2005 +++ php-src/ext/spl/spl_array.c Mon Oct 3 09:34:00 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.82 2005/10/03 12:55:08 helly Exp $ */ +/* $Id: spl_array.c,v 1.83 2005/10/03 13:34:00 helly Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -1051,34 +1051,62 @@ RETURN_LONG(count); } /* }}} */ -static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fname_len) +static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fname_len, int use_arg) { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC); HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); - zval tmp; + zval tmp, **arg; INIT_PZVAL(tmp); Z_TYPE(tmp) = IS_ARRAY; Z_ARRVAL(tmp) = aht; - zend_call_method(NULL, NULL, NULL, fname, fname_len, return_value, 1, tmp, NULL TSRMLS_CC); + if (use_arg) { + if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, arg) == FAILURE) { + zend_throw_exception(U_CLASS_ENTRY(spl_ce_BadMethodCallException), Function expects exactly one argument, 0 TSRMLS_CC); + return; + } + zend_call_method(NULL, NULL, NULL, fname, fname_len, return_value, 2, tmp, *arg TSRMLS_CC); + } else { + zend_call_method(NULL, NULL, NULL, fname, fname_len, return_value, 1, tmp, NULL TSRMLS_CC); + } } -#define SPL_ARRAY_METHOD(cname, fname) \ +#define SPL_ARRAY_METHOD(cname, fname, use_arg) \ SPL_METHOD(cname, fname) \ { \ -
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Sat Sep 24 19:18:15 2005 EDT Modified files: /php-src/ext/splspl.php Log: - Serializeable was renamed to Serializable long ago http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.57r2=1.58ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.57 php-src/ext/spl/spl.php:1.58 --- php-src/ext/spl/spl.php:1.57Sun Sep 18 13:51:37 2005 +++ php-src/ext/spl/spl.php Sat Sep 24 19:18:14 2005 @@ -484,7 +484,7 @@ * constructor instead of calling __construct(). If you need to execute the * standard constructor you may do so in the method. */ -interface Serializeable +interface Serializable { /** * @return string representation of the instance -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Sun Sep 18 13:39:16 2005 EDT Modified files: /php-src/ext/splspl.php Log: - Add missing docu http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.54r2=1.55ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.54 php-src/ext/spl/spl.php:1.55 --- php-src/ext/spl/spl.php:1.54Sun Sep 18 12:51:20 2005 +++ php-src/ext/spl/spl.php Sun Sep 18 13:39:12 2005 @@ -521,6 +521,7 @@ * * @param $array the array to use. * @param $flags see setFlags(). +* @param $iterator_class class used in getIterator() */ function __construct($array, $flags = 0, $iterator_class = ArrayIterator); @@ -583,6 +584,14 @@ * properties in the object. */ function count(); + + /* @param $iterator_class new class used in getIterator() +*/ + function setIteratorClass($itertor_class); + + /* @return class used in getIterator() +*/ + function getIteratorClass(); } /** @ingroup SPL -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Sun Sep 18 13:44:53 2005 EDT Modified files: /php-src/ext/splspl.php Log: - Observer/Subject have been renamed http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.55r2=1.56ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.55 php-src/ext/spl/spl.php:1.56 --- php-src/ext/spl/spl.php:1.55Sun Sep 18 13:39:12 2005 +++ php-src/ext/spl/spl.php Sun Sep 18 13:44:50 2005 @@ -824,7 +824,7 @@ } /** @ingroup SPL - * @brief observer of the observer pattern + * @brief Observer of the observer pattern * @since PHP 5.1 * * For a detailed explanation see Observer pattern in @@ -833,29 +833,29 @@ * Design Patterns * /em */ -interface Observer +interface SplObserver { /** Called from the subject (i.e. when it's value has changed). * @param $subject the callee */ - function update(Subject $subject); + function update(SplSubject $subject); } /** @ingroup SPL - * @brief ubject to the observer pattern + * @brief Subject to the observer pattern * @since PHP 5.1 * @see Observer */ -interface Subject +interface SplSubject { /** @param $observer new observer to attach */ -function attach(Observer $observer); +function attach(SplObserver $observer); /** @param $observer existing observer to detach * @note a non attached observer shouldn't result in a warning or similar */ -function detach(Observer $observer); +function detach(SplObserver $observer); /** Notify all observers */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Sun Sep 18 13:51:41 2005 EDT Modified files: /php-src/ext/splspl.php Log: - Update docu: new slides are available http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.56r2=1.57ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.56 php-src/ext/spl/spl.php:1.57 --- php-src/ext/spl/spl.php:1.56Sun Sep 18 13:44:50 2005 +++ php-src/ext/spl/spl.php Sun Sep 18 13:51:37 2005 @@ -113,9 +113,10 @@ * * Talks on SPL: * - SPL for the masses a href=http://somabo.de/talks/200504_php_quebec_spl_for_the_masses.pps;[pps]/a, a href=http://somabo.de/talks/200504_php_quebec_spl_for_the_masses.pdf;[pdf]/a - * - Debug session 1 a href=http://somabo.de/talks/200504_php_quebec_iterator_debug_session_1.pps;[pps]/a, a href=http://somabo.de/talks/200504_php_quebec_iterator_debug_session_1.pdf;[pdf]/a - * - Debug session 2 a href=http://somabo.de/talks/200504_php_quebec_iterator_debug_session_2.pps;[pps]/a, a href=http://somabo.de/talks/200504_php_quebec_iterator_debug_session_2.pdf;[pdf]/a * - From engine overloading to SPL a href=http://somabo.de/talks/200505_cancun_from_engine_overloading_to_spl.pps;[pps]/a, a href=http://somabo.de/talks/200505_cancun_from_engine_overloading_to_spl.pdf;[pdf]/a + * - Happy SPLing a href=http://somabo.de/talks/200509_toronto_happy_spling.pps;[pps]/a, a href=http://somabo.de/talks/200509_toronto_happy_spling.pdf;[pdf]/a + * - Debug session 1 a href=http://somabo.de/talks/200509_toronto_iterator_debug_session_1.pps;[pps]/a, a href=http://somabo.de/talks/200509_toronto_iterator_debug_session_1.pdf;[pdf]/a + * - Debug session 2 a href=http://somabo.de/talks/200509_toronto_iterator_debug_session_2.pps;[pps]/a, a href=http://somabo.de/talks/200509_toronto_iterator_debug_session_2.pdf;[pdf]/a * * You can download this documentation as a chm file * a href=http://php.net/~helly/php/ext/spl/spl.chm;here/a. -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Fri Sep 2 15:10:53 2005 EDT Modified files: /php-src/ext/splspl.php Log: - Update docu http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.49r2=1.50ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.49 php-src/ext/spl/spl.php:1.50 --- php-src/ext/spl/spl.php:1.49Wed May 4 15:14:08 2005 +++ php-src/ext/spl/spl.php Fri Sep 2 15:10:51 2005 @@ -495,6 +495,7 @@ /** @ingroup SPL * @brief An Array wrapper * @since PHP 5.0 + * @version 1.1 * * This array wrapper allows to recursively iterate over Arrays and public * Object properties. @@ -507,8 +508,28 @@ * That is any Array or Object. * * @param $array the array to use. +* @param $flags see setFlags(). */ - function __construct($array); + function __construct($array, $flags = 0); + + /** Set behavior flags. +* +* @param $flags bitmask as follows: +*0 set: properties of the object have their normal functionality +* when accessed as list (var_dump, foreach, etc.) +*1 set: array indices can be accessed as properties in read/write +*/ + function setFlags($flags); + + /** +* @ return current flags +*/ + function getFlags(); + + /** +* @param $array new array or object +*/ + function exchangeArray($array); /** @return the iterator which is an ArrayIterator object connected to * this object. @@ -555,6 +576,7 @@ /** @ingroup SPL * @brief An Array iterator * @since PHP 5.0 + * @version 1.1 * * This iterator allows to unset and modify values and keys while iterating * over Arrays and Objects. @@ -570,8 +592,23 @@ * That is any Array or Object. * * @param $array the array to use. +* @param $flags see setFlags(). +*/ + function __construct($array, $flags = 0); + + /** Set behavior flags. +* +* @param $flags bitmask as follows: +*0 set: properties of the object have their normal functionality +* when accessed as list (var_dump, foreach, etc.) +*1 set: array indices can be accessed as properties in read/write +*/ + function setFlags($flags); + + /** +* @ return current flags */ - public function __construct($array); + function getFlags(); /** @param $index offset to inspect * @return whetehr offset $index esists -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Tue May 3 08:09:26 2005 EDT Modified files: /php-src/ext/splspl.php Log: - Fix speling - Add links http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.47r2=1.48ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.47 php-src/ext/spl/spl.php:1.48 --- php-src/ext/spl/spl.php:1.47Thu Apr 14 17:02:08 2005 +++ php-src/ext/spl/spl.php Tue May 3 08:09:26 2005 @@ -75,9 +75,9 @@ * * - interface Countable allows to hook into the standard array function count(). * - * 6) Exceptions + * 6) Exception%s * - * SPL provides a set of standard exception classes each meant to indicate a + * SPL provides a set of standard Exception classes each meant to indicate a * certain problem type. * * - class LogicException extends Exception @@ -102,10 +102,12 @@ * * Some articles about SPL: * - a href=http://www.sitepoint.com/article/php5-standard-library/1;Introducing PHP 5's Standard Library/a + * - a href=http://www.ramikayyali.com/archives/2005/02/25/iterators;Iterators in PHP5/a * - a href=http://www.phpriot.com/d/articles/php/oop/oop-with-spl-php-5-1/index.html;Advanced OOP with SPL in PHP 5/a * - a href=http://www.devshed.com/c/a/PHP/The-Standard-PHP-Library-Part-1/;The Standard PHP Library, Part 1/a + * - a href=http://www.devshed.com/c/a/PHP/The-Standard-PHP-Library-Part-2/;The Standard PHP Library, Part 2/a * - * Talks on PL: + * Talks on SPL: * - a href=http://somabo.de/talks/200504_php_quebec_spl_for_the_masses.pps;SPL for the masses [pps]/a * - a href=http://somabo.de/talks/200504_php_quebec_spl_for_the_masses.pdf;SPL for the masses [pdf]/a * -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Wed May 4 15:14:08 2005 EDT Modified files: /php-src/ext/splspl.php Log: - Update docu http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.48r2=1.49ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.48 php-src/ext/spl/spl.php:1.49 --- php-src/ext/spl/spl.php:1.48Tue May 3 08:09:26 2005 +++ php-src/ext/spl/spl.php Wed May 4 15:14:08 2005 @@ -53,7 +53,7 @@ * * - class DirectoryIterator implements Iterator * - class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveIterator - * - class FileObject implements RecursiveIterator + * - class FileObject implements RecursiveIterator, SeekableIterator * * 3) XML * -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php spl_exceptions.c spl_exceptions.h spl_iterators.c /ext/spl/tests iterator_021.phpt iterator_022.phpt
helly Sat Mar 12 18:03:33 2005 EDT Added files: /php-src/ext/spl/tests iterator_021.phpt iterator_022.phpt Modified files: /php-src/ext/splspl.php spl_exceptions.c spl_exceptions.h spl_iterators.c Log: - Allow to hook into RecursiveIteratorIterator's child handling - Better=faster function caching for RecursiveIteratorIterator - Check for exceptions and fix check for illegal return values - Add UnexpectedValueException - Add docu http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.45r2=1.46ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.45 php-src/ext/spl/spl.php:1.46 --- php-src/ext/spl/spl.php:1.45Tue Mar 8 20:21:04 2005 +++ php-src/ext/spl/spl.php Sat Mar 12 18:03:31 2005 @@ -252,6 +252,8 @@ * * This kind of exception should be used to inform about domain erors in * mathematical sense. + * + * @see RangeException */ class DomainException extends LogicException { @@ -260,6 +262,8 @@ /** @ingroup SPL * @brief Exception that denotes invalid arguments were passed. * @since PHP 5.1 + * + * @see UnexpectedValueException */ class InvalidArgumentException extends LogicException { @@ -321,19 +325,36 @@ * @since PHP 5.1 * * Normally this means there was an arithmetic error other than under/overflow. + * This is the runtime version of DomainException. + * + * @see DomainException */ class RangeException extends RuntimeException { } /** @ingroup SPL - * @brief Exception Exception thrown to indicate arithmetic/buffer underflow. + * @brief Exception thrown to indicate arithmetic/buffer underflow. * @since PHP 5.1 */ class UnderflowException extends RuntimeException { } +/** @ingroup SPL + * @brief Exception thrown to indicate an unexpected value. + * @since PHP 5.1 + * + * Typically this happens when a function calls another function and espects + * the return value to be of a certain type or value not including arithmetic + * or buffer related errors. + * + * @see InvalidArgumentException + */ +class UnexpectedValueException extends RuntimeException +{ +} + /** @ingroup ZendEngine * @brief Interface to override array access of objects. * @since PHP 5.0 http://cvs.php.net/diff.php/php-src/ext/spl/spl_exceptions.c?r1=1.4r2=1.5ty=u Index: php-src/ext/spl/spl_exceptions.c diff -u php-src/ext/spl/spl_exceptions.c:1.4 php-src/ext/spl/spl_exceptions.c:1.5 --- php-src/ext/spl/spl_exceptions.c:1.4Mon Nov 1 15:57:23 2004 +++ php-src/ext/spl/spl_exceptions.cSat Mar 12 18:03:31 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_exceptions.c,v 1.4 2004/11/01 20:57:23 helly Exp $ */ +/* $Id: spl_exceptions.c,v 1.5 2005/03/12 23:03:31 helly Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -45,6 +45,7 @@ PHPAPI zend_class_entry *spl_ce_OverflowException; PHPAPI zend_class_entry *spl_ce_RangeException; PHPAPI zend_class_entry *spl_ce_UnderflowException; +PHPAPI zend_class_entry *spl_ce_UnexpectedValueException; #define spl_ce_Exception zend_exception_get_default() @@ -64,6 +65,7 @@ REGISTER_SPL_SUB_CLASS_EX(OverflowException,RuntimeException, NULL, NULL); REGISTER_SPL_SUB_CLASS_EX(RangeException, RuntimeException, NULL, NULL); REGISTER_SPL_SUB_CLASS_EX(UnderflowException, RuntimeException, NULL, NULL); +REGISTER_SPL_SUB_CLASS_EX(UnexpectedValueException, RuntimeException, NULL, NULL); return SUCCESS; } http://cvs.php.net/diff.php/php-src/ext/spl/spl_exceptions.h?r1=1.3r2=1.4ty=u Index: php-src/ext/spl/spl_exceptions.h diff -u php-src/ext/spl/spl_exceptions.h:1.3 php-src/ext/spl/spl_exceptions.h:1.4 --- php-src/ext/spl/spl_exceptions.h:1.3Mon Nov 1 15:57:23 2004 +++ php-src/ext/spl/spl_exceptions.hSat Mar 12 18:03:31 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_exceptions.h,v 1.3 2004/11/01 20:57:23 helly Exp $ */ +/* $Id: spl_exceptions.h,v 1.4 2005/03/12 23:03:31 helly Exp $ */ #ifndef SPL_EXCEPTIONS_H #define SPL_EXCEPTIONS_H @@ -37,6 +37,7 @@ extern PHPAPI zend_class_entry *spl_ce_OverflowException; extern PHPAPI zend_class_entry *spl_ce_RangeException; extern PHPAPI zend_class_entry *spl_ce_UnderflowException; +extern PHPAPI zend_class_entry *spl_ce_UnexpectedValueException; PHP_MINIT_FUNCTION(spl_exceptions); http://cvs.php.net/diff.php/php-src/ext/spl/spl_iterators.c?r1=1.66r2=1.67ty=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.66 php-src/ext/spl/spl_iterators.c:1.67 --- php-src/ext/spl/spl_iterators.c:1.66Sun Mar 6 18:07:43 2005 +++ php-src/ext/spl/spl_iterators.c Sat Mar 12 18:03:31 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_iterators.c,v 1.66
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Tue Mar 8 20:21:06 2005 EDT Modified files: /php-src/ext/splspl.php Log: Add description for interface Serializeable http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.44r2=1.45ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.44 php-src/ext/spl/spl.php:1.45 --- php-src/ext/spl/spl.php:1.44Tue Mar 1 18:44:05 2005 +++ php-src/ext/spl/spl.php Tue Mar 8 20:21:04 2005 @@ -435,6 +435,33 @@ function count(); } +/** @ingroup ZendEngine + * @brief Interface for customized serializing + * @since 5.1 + * + * Classes that implement this interface no longer support __sleep() and + * __wakeup(). The method serialized is called whenever an instance needs to + * be serialized. This does not invoke __destruct() or has any other side + * effect unless programmed inside the method. When the data is unserialized + * the class is known and the appropriate unserialize() method is called as a + * constructor instead of calling __construct(). If you need to execute the + * standard constructor you may do so in the method. + */ +interface Serializeable +{ + /** +* @return string representation of the instance +*/ + function serialize(); + + /** +* @note This is a constructor +* +* @param $serialized data read from stream to construct the instance +*/ + function unserialize($serialized); +} + /** @ingroup SPL * @brief An Array wrapper * @since PHP 5.0 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php /ext/spl/internal seekableiterator.inc
helly Tue Mar 1 18:44:05 2005 EDT Modified files: /php-src/ext/splspl.php /php-src/ext/spl/internal seekableiterator.inc Log: - Update docu http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.43r2=1.44ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.43 php-src/ext/spl/spl.php:1.44 --- php-src/ext/spl/spl.php:1.43Wed Feb 16 19:24:57 2005 +++ php-src/ext/spl/spl.php Tue Mar 1 18:44:05 2005 @@ -548,6 +548,7 @@ function getArrayCopy(); /** @param $position offset to seek to +* @throw OutOfBoundsException if $position is invalid */ function seek($position); http://cvs.php.net/diff.php/php-src/ext/spl/internal/seekableiterator.inc?r1=1.5r2=1.6ty=u Index: php-src/ext/spl/internal/seekableiterator.inc diff -u php-src/ext/spl/internal/seekableiterator.inc:1.5 php-src/ext/spl/internal/seekableiterator.inc:1.6 --- php-src/ext/spl/internal/seekableiterator.inc:1.5 Wed Feb 16 19:24:57 2005 +++ php-src/ext/spl/internal/seekableiterator.inc Tue Mar 1 18:44:05 2005 @@ -25,17 +25,24 @@ * \param $index position to seek to * \return void * -* \note The method should throw an exception if it is not possible to -* seek to the given position. -*/ +* The method should throw an exception if it is not possible to seek to +* the given position. Typically this exception should be of type +* OutOfBoundsException. +\code function seek($index); -/* $this-rewind(); + $this-rewind(); $position = 0; while($position $index $this-valid()) { $this-next(); $position++; } - }*/ + if (!$this-valid()) { + throw new OutOfBoundsException('Invalid seek position'); + } + } +\endcode +*/ + function seek($index); } ? \ No newline at end of file -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Wed Feb 16 19:16:00 2005 EDT Modified files: /php-src/ext/splspl.php Log: - For now we need the simple way http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.41r2=1.42ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.41 php-src/ext/spl/spl.php:1.42 --- php-src/ext/spl/spl.php:1.41Tue Feb 8 15:42:47 2005 +++ php-src/ext/spl/spl.php Wed Feb 16 19:16:00 2005 @@ -696,9 +696,9 @@ */ function detach(Observer $observer); - /** @param $ignore optional observer that should not be notified + /** Notify all observers */ -function notify([Observer $ignore = NULL]); +function notify(); } ? -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Tue Feb 8 14:05:26 2005 EDT Modified files: /php-src/ext/splspl.php Log: - Fix year and speling http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.39r2=1.40ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.39 php-src/ext/spl/spl.php:1.40 --- php-src/ext/spl/spl.php:1.39Mon Nov 1 13:11:38 2004 +++ php-src/ext/spl/spl.php Tue Feb 8 14:05:25 2005 @@ -6,7 +6,7 @@ * * SPL - Standard PHP Library * - * (c) Marcus Boerger, 2003 - 2004 + * (c) Marcus Boerger, 2003 - 2005 */ /** @mainpage SPL - Standard PHP Library @@ -69,7 +69,7 @@ * * 5) Counting * - * - interface Counable allows to hook into the standard array function count(). + * - interface Countable allows to hook into the standard array function count(). * * 6) Exceptions * @@ -98,7 +98,7 @@ * You can download this documentation as a chm file * a href=http://php.net/~helly/php/ext/spl/spl.chm;here/a. * - * (c) Marcus Boerger, 2003 - 2004 + * (c) Marcus Boerger, 2003 - 2005 */ /** @defgroup ZendEngine Zend engine classes -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Mon Nov 1 12:05:45 2004 EDT Modified files: /php-src/ext/splspl.php Log: - Update docu http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.35r2=1.36ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.35 php-src/ext/spl/spl.php:1.36 --- php-src/ext/spl/spl.php:1.35Mon Nov 1 11:31:19 2004 +++ php-src/ext/spl/spl.php Mon Nov 1 12:05:45 2004 @@ -1,15 +1,15 @@ ?php -/** \file spl.php - * \ingroup SPL - * \brief Documentation of internal classes and interfaces +/** @file spl.php + * @ingroup SPL + * @brief Documentation of internal classes and interfaces * * SPL - Standard PHP Library * * (c) Marcus Boerger, 2003 - 2004 */ -/** \mainpage SPL - Standard PHP Library +/** @mainpage SPL - Standard PHP Library * * SPL - Standard PHP Library * @@ -224,42 +224,42 @@ { } -/** \ingroup ZendEngine - * \brief Interface to override array access of objects. +/** @ingroup ZendEngine + * @brief Interface to override array access of objects. */ interface ArrayAccess { - /** \param $offset to modify -* \param $value new value + /** @param $offset to modify +* @param $value new value */ function offsetSet($offset, $value); - /** \param $offset to retrieve -* \return value at given offset + /** @param $offset to retrieve +* @return value at given offset */ function offsetGet($offset); - /** \param $offset to delete + /** @param $offset to delete */ function offsetUnset($offset); - /** \param $offset to check -*\return whether the offset exists. + /** @param $offset to check +* @return whether the offset exists. */ function offsetExists($offset); } -/** \ingroup ZendEngine - * \brief Interface to detect a class is traversable using foreach. +/** @ingroup ZendEngine + * @brief Interface to detect a class is traversable using foreach. * * Abstract base interface that cannot be implemented alone. Instead it * must be implemented by either IteratorAggregate or Iterator. * - * \note Internal classes that implement this interface can be used in a + * @note Internal classes that implement this interface can be used in a * foreach construct and do not need to implement IteratorAggregate or * Iterator. * - * \note This is an engine internal interface which cannot be implemented + * @note This is an engine internal interface which cannot be implemented * in PHP scripts. Either IteratorAggregate or Iterator must be used * instead. */ @@ -267,25 +267,25 @@ { } -/** \ingroup ZendEngine - * \brief Interface to create an external Iterator. +/** @ingroup ZendEngine + * @brief Interface to create an external Iterator. * - * \note This is an engine internal interface. + * @note This is an engine internal interface. */ interface IteratorAggregate extends Traversable { - /** \return an Iterator for the implementing object. + /** @return an Iterator for the implementing object. */ function getIterator(); } -/** \ingroup ZendEngine - * \brief Basic iterator +/** @ingroup ZendEngine + * @brief Basic iterator * * Interface for external iterators or objects that can be iterated * themselves internally. * - * \note This is an engine internal interface. + * @note This is an engine internal interface. */ interface Iterator extends Traversable { @@ -310,26 +310,26 @@ function valid(); } -/** \ingroup SPL - * \brief Recursive iterator +/** @ingroup SPL + * @brief Recursive iterator * * Interface for recursive traversal to be used with * RecursiveIteratorIterator. */ interface RecursiveIterator extends Iterator { - /** \return whether current element can be iterated itself. + /** @return whether current element can be iterated itself. */ function hasChildren(); - /** \return an object that recursively iterates the current element. + /** @return an object that recursively iterates the current element. * This object must implement RecursiveIterator. */ function getChildren(); } -/** \ingroup SPL - * \brief Class for recursive traversal. +/** @ingroup SPL + * @brief Class for recursive traversal. * * The objects of this class are created by instances of RecursiveIterator. * Elements of those iterators may be traversable themselves. If so these @@ -339,23 +339,23 @@ { /** Construct an instance form a RecursiveIterator. * -* \param $iterator inner root iterator -* \param $mode one of +* @param $iterator inner root iterator +* @param $mode one of *- RIT_LEAVES_ONLY do not return elements that can be recursed. *- RIT_SELF_FIRST show elements before their sub elements. *- RIT_CHILD_FIRST
[PHP-CVS] cvs: php-src /ext/spl spl.php
sebastian Fri Oct 1 06:35:27 2004 EDT Modified files: /php-src/ext/splspl.php Log: Fugbix typo. http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.31r2=1.32ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.31 php-src/ext/spl/spl.php:1.32 --- php-src/ext/spl/spl.php:1.31Wed Sep 29 16:25:28 2004 +++ php-src/ext/spl/spl.php Fri Oct 1 06:35:26 2004 @@ -340,7 +340,7 @@ * This class uses SeekableIterator::seek() if available and rewind() plus * a skip loop otehrwise. */ -class LimitIetrator implements Iterator +class LimitIterator implements Iterator { /** Construct an instance form a Iterator. * -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Wed Sep 29 16:25:29 2004 EDT Modified files: /php-src/ext/splspl.php Log: - Fix docu http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.30r2=1.31ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.30 php-src/ext/spl/spl.php:1.31 --- php-src/ext/spl/spl.php:1.30Fri Sep 3 14:46:29 2004 +++ php-src/ext/spl/spl.php Wed Sep 29 16:25:28 2004 @@ -368,7 +368,7 @@ */ function seek($position); - /** return the current position (zero based) + /** \return the current position (zero based) */ function getPosition(); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Fri Sep 3 14:46:29 2004 EDT Modified files: /php-src/ext/splspl.php Log: - Add link to chm version - Change wording http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.29r2=1.30ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.29 php-src/ext/spl/spl.php:1.30 --- php-src/ext/spl/spl.php:1.29Fri Sep 3 02:16:34 2004 +++ php-src/ext/spl/spl.php Fri Sep 3 14:46:29 2004 @@ -13,6 +13,9 @@ * * SPL - Standard PHP Library * + * You can download this documentation as a chm file + * a href=http://php.net/~helly/php/ext/spl/spl.chm;here/a. + * * (c) Marcus Boerger, 2003 - 2004 */ @@ -358,8 +361,8 @@ /** Seek to a specific position if available or throw an exception. * If the inner iterator is an instance of SeekableIterator its seek() -* method will be used. Otherwise the iterator will be rewinded if -* necessary and then manually forwared element by element. +* method will be used. Otherwise the iterator will be rewound if +* necessary and then manually advanced element by element. * * \param $position index to seek to. */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/spl spl.php
Hello Mike, thanks, that i smuch better. Does an excuse that was in the morning before the first coffee count? marcus Friday, September 3, 2004, 12:30:40 PM, you wrote: On 03 September 2004 07:17, Marcus Boerger wrote: + * method will be used. Otherwise the iterator will be rewinded if + * necessary and then manually forwared element by element. Some bad and questionable grammar there -- better as ... rewound if necessary and then manually advanced Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- Best regards, Marcusmailto:[EMAIL PROTECTED] -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Sun Aug 29 06:33:24 2004 EDT Modified files: /php-src/ext/splspl.php Log: Add more docu http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.25r2=1.26ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.25 php-src/ext/spl/spl.php:1.26 --- php-src/ext/spl/spl.php:1.25Mon May 10 13:26:03 2004 +++ php-src/ext/spl/spl.php Sun Aug 29 06:33:24 2004 @@ -539,6 +539,13 @@ /** \ingroup SPL * \brief recursive SimpleXML_Element iterator + * + * SimpleXMLIterator implements the RecursiveIterator interface. This allows + * to iterator over all elements using foreach or appropriate while construct + * just like SimpleXMLElement does. But using the foreach construct you will + * also iterate over the subelements. Because for every element which has sub + * elements hasChildren() returns true what results in a call to getchildren() + * which then returns the iterator for that sub element. */ class SimpleXMLIterator extends SimpleXMLElement implements RecursiveIterator { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
jan Sun Aug 29 07:54:39 2004 EDT Modified files: /php-src/ext/splspl.php Log: - language refinements http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.26r2=1.27ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.26 php-src/ext/spl/spl.php:1.27 --- php-src/ext/spl/spl.php:1.26Sun Aug 29 06:33:24 2004 +++ php-src/ext/spl/spl.php Sun Aug 29 07:54:38 2004 @@ -540,12 +540,12 @@ /** \ingroup SPL * \brief recursive SimpleXML_Element iterator * - * SimpleXMLIterator implements the RecursiveIterator interface. This allows - * to iterator over all elements using foreach or appropriate while construct - * just like SimpleXMLElement does. But using the foreach construct you will - * also iterate over the subelements. Because for every element which has sub - * elements hasChildren() returns true what results in a call to getchildren() - * which then returns the iterator for that sub element. + * The SimpleXMLIterator implements the RecursiveIterator interface. This + * allows to iterate over all elements using foreach or an appropriate while + * construct just like SimpleXMLElement does. But using the foreach construct, + * you will also iterate over the subelements, because for every element which + * has subelements hasChildren() returns true what results in a call to + * getChildren() which then returns the iterator for that sub element. */ class SimpleXMLIterator extends SimpleXMLElement implements RecursiveIterator { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Sat May 8 08:26:28 2004 EDT Modified files: /php-src/ext/splspl.php Log: - Update docu http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.23r2=1.24ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.23 php-src/ext/spl/spl.php:1.24 --- php-src/ext/spl/spl.php:1.23Thu May 6 18:55:25 2004 +++ php-src/ext/spl/spl.php Sat May 8 08:26:28 2004 @@ -7,7 +7,21 @@ * (c) Marcus Boerger, 2003 - 2004 */ -/** Interface to override array access of objects. +/** \defgroup SPL Internal classes + * + * The classes and interfaces in this group are contained in the c-code of + * ext/SPL. + */ + +/** \defgroup Examples Example classes + * + * The classes and interfaces in this group are contained as PHP code in the + * examples subdirectory of ext/SPL. Sooner or later they will be moved to + * c-code. + */ + +/** \ingroup SPL + * \brief Interface to override array access of objects. */ interface ArrayAccess { @@ -31,7 +45,10 @@ function offsetExists($offset); } -/** Abstract base interface that cannot be implemented alone. Instead it +/** \ingroup SPL + * \brief Interface to detect a class is traversable using foreach. + * + * Abstract base interface that cannot be implemented alone. Instead it * must be implemented by either IteratorAggregate or Iterator. * * \note Internal classes that implement this interface can be used in a @@ -46,7 +63,8 @@ { } -/** Interface to create an external Iterator. +/** \ingroup SPL + * \brief Interface to create an external Iterator. * * \note This is an engine internal interface. */ @@ -57,7 +75,10 @@ function getIterator(); } -/** Interface for external iterators or objects that can be iterated +/** \ingroup SPL + * \brief Basic iterator + * + * Interface for external iterators or objects that can be iterated * themselves internally. * * \note This is an engine internal interface. @@ -85,7 +106,10 @@ function valid(); } -/** Interface for recursive traversal to be used with +/** \ingroup SPL + * \brief Recursive iterator + * + * Interface for recursive traversal to be used with * RecursiveIteratorIterator. */ interface RecursiveIterator extends Iterator @@ -100,7 +124,8 @@ function getChildren(); } -/** \brief Class for recursive traversal. +/** \ingroup SPL + * \brief Class for recursive traversal. * * The objects of this class are created by instances of RecursiveIterator. * Elements of those iterators may be traversable themselves. If so these @@ -114,7 +139,7 @@ * \param $mode one of *- RIT_LEAVES_ONLY do not return elements that can be recursed. *- RIT_SELF_FIRST show elements before their sub elements. -*- RIT_CHILD_FIRST show elements after their sub elements- +*- RIT_CHILD_FIRST show elements after their sub elements. * * \note If you want to see only those elements which have sub elements then * use a ParentIterator. @@ -132,7 +157,8 @@ function getSubIterator([$level]); } -/** \brief An Array wrapper +/** \ingroup SPL + * \brief An Array wrapper * * This array wrapper allows to recursively iterate over Arrays and public * Object properties. @@ -190,7 +216,8 @@ function count(); } -/** \brief An Array iterator +/** \ingroup SPL + * \brief An Array iterator * * This iterator allows to unset and modify values and keys while iterating * over Arrays and Objects. @@ -250,7 +277,8 @@ function count(); } -/** \brief An iterator that filters other iterators +/** \ingroup SPL + * \brief An iterator that filters other iterators * * Iterator that wrapps around another iterator and only returns selected * elements of the inner iterator. The only thing that needs to be done to @@ -276,7 +304,10 @@ function getInnerIterator(); } -/** This interface is used to optimize LimitIterator functionality. but it +/** \ingroup SPL + * \brief Seekable iterator + * + * This interface is used to optimize LimitIterator functionality. but it * may also be used for other situations where seeking a specific offset is * required and easily possible. */ @@ -288,7 +319,10 @@ function seek($position); } -/** A class that starts iteration at a certain offset and only iterates over +/** \ingroup SPL + * \brief Limiting iterator + * + * A class that starts iteration at a certain offset and only iterates over * a specified amount of elements. * * This class uses SeekableIterator::seek() if available and rewind() plus @@ -325,7 +359,10 @@ function getPosition(); } -/** A recursive iterator that only returns elements that themselves can be +/** \ingroup SPL + * \brief Iterator that shows only parents + * + * A recursive iterator that only returns elements that themselves can be * trversed. */ class
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Thu May 6 17:20:51 2004 EDT Modified files: /php-src/ext/splspl.php Log: - Update documentation http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.20r2=1.21ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.20 php-src/ext/spl/spl.php:1.21 --- php-src/ext/spl/spl.php:1.20Thu Apr 29 18:52:49 2004 +++ php-src/ext/spl/spl.php Thu May 6 17:20:50 2004 @@ -12,7 +12,9 @@ * foreach construct and do not need to implement IteratorAggregate or * Iterator. * - * \note This is an engine internal interface. + * \note This is an engine internal interface which cannot be implemented + * in PHP scripts. Either IteratorAggregate or Iterator must be used + * instead. */ interface Traversable { @@ -24,7 +26,7 @@ */ interface IteratorAggregate implements Traversable { - /** Return an Iterator for the implementing object. + /** \return an Iterator for the implementing object. */ function getIterator(); } @@ -72,9 +74,11 @@ function getChildren(); } -/** Class for recursive traversal. The objects of this class are created by - * instances of RecursiveIterator. Elements of those iterators may be - * traversable themselves. If so these sub elements are recursed into. +/** \brief Class for recursive traversal. + * + * The objects of this class are created by instances of RecursiveIterator. + * Elements of those iterators may be traversable themselves. If so these + * sub elements are recursed into. */ class RecursiveIteratorIterator implements Iterator { @@ -153,6 +157,11 @@ * returns an array of the public properties. */ function getArrayCopy(); + + /** \return the number of elements in the array or the number of public +* properties in the object. +*/ + function count(); } /** \brief An Array iterator @@ -209,8 +218,19 @@ */ function seek($position); -/** Iterator that wrapps around another iterator and only returns selected - * elements of the inner iterator. + /** \return the number of elements in the array or the number of public +* properties in the object. +*/ + function count(); +} + +/** \brief An iterator that filters other iterators + * + * Iterator that wrapps around another iterator and only returns selected + * elements of the inner iterator. The only thing that needs to be done to + * make this work is implementing method accept(). Typically this invloves + * reading the current element or key of the inner Iterator and checking + * whether it is acceptable. */ abstract class FilterIterator implements Iterator { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Thu May 6 17:46:40 2004 EDT Modified files: /php-src/ext/splspl.php Log: - interfaces 'extends' not 'implements' other interfaces http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.21r2=1.22ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.21 php-src/ext/spl/spl.php:1.22 --- php-src/ext/spl/spl.php:1.21Thu May 6 17:20:50 2004 +++ php-src/ext/spl/spl.php Thu May 6 17:46:40 2004 @@ -24,7 +24,7 @@ * * \note This is an engine internal interface. */ -interface IteratorAggregate implements Traversable +interface IteratorAggregate extends Traversable { /** \return an Iterator for the implementing object. */ @@ -36,7 +36,7 @@ * * \note This is an engine internal interface. */ -interface Iterator implements Traversable +interface Iterator extends Traversable { /** Rewind the Iterator to the first element. */ @@ -62,7 +62,7 @@ /** Interface for recursive traversal to be used with * RecursiveIteratorIterator. */ -interface RecursiveIterator implements Iterator +interface RecursiveIterator extends Iterator { /** \return whether current element can be iterated itself. */ @@ -254,7 +254,7 @@ * may also be used for other situations where seeking a specific offset is * required and easily possible. */ -interface SeekableIterator implements Iterator +interface SeekableIterator extends Iterator { /** Seek to a specific position if available or throw an exception. * \param $position offset to seek to. -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php /ext/spl/examples IniGroups.inc KeyFilter.inc dba_dump.php ini_groups.php key_filter.inc
helly Thu May 6 18:55:25 2004 EDT Added files: /php-src/ext/spl/examples IniGroups.inc KeyFilter.inc Removed files: /php-src/ext/spl/examples key_filter.inc Modified files: /php-src/ext/splspl.php /php-src/ext/spl/examples dba_dump.php ini_groups.php Log: - Update examples http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.22r2=1.23ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.22 php-src/ext/spl/spl.php:1.23 --- php-src/ext/spl/spl.php:1.22Thu May 6 17:46:40 2004 +++ php-src/ext/spl/spl.php Thu May 6 18:55:25 2004 @@ -1,10 +1,36 @@ ?php -/** Standard PHP Library +/** \mainpage SPL - Standard PHP Library + * + * SPL - Standard PHP Library * * (c) Marcus Boerger, 2003 - 2004 */ +/** Interface to override array access of objects. + */ +interface ArrayAccess +{ + /** \param $offset to modify +* \param $value new value +*/ + function offsetSet($offset, $value); + + /** \param $offset to retrieve +* \return value at given offset +*/ + function offsetGet($offset); + + /** \param $offset to delete +*/ + function offsetUnset($offset); + + /** \param $offset to check +*\return whether the offset exists. +*/ + function offsetExists($offset); +} + /** Abstract base interface that cannot be implemented alone. Instead it * must be implemented by either IteratorAggregate or Iterator. * @@ -343,7 +369,7 @@ /** The recursive version of the CachingIterator. */ -class CachingRecursiveIterator extends CachingIterator implemnets RecursiveIterator +class CachingRecursiveIterator extends CachingIterator implements RecursiveIterator { /** Construct an instance form a RecursiveIterator. * http://cvs.php.net/diff.php/php-src/ext/spl/examples/dba_dump.php?r1=1.5r2=1.6ty=u Index: php-src/ext/spl/examples/dba_dump.php diff -u php-src/ext/spl/examples/dba_dump.php:1.5 php-src/ext/spl/examples/dba_dump.php:1.6 --- php-src/ext/spl/examples/dba_dump.php:1.5 Thu Dec 4 14:39:46 2003 +++ php-src/ext/spl/examples/dba_dump.php Thu May 6 18:55:25 2004 @@ -25,7 +25,7 @@ } require_once(dba_reader.inc); -require_once(key_filter.inc); +require_once(KeyFilter.inc); $db = new DbaReader($argv[1], $argv[2]); http://cvs.php.net/diff.php/php-src/ext/spl/examples/ini_groups.php?r1=1.2r2=1.3ty=u Index: php-src/ext/spl/examples/ini_groups.php diff -u php-src/ext/spl/examples/ini_groups.php:1.2 php-src/ext/spl/examples/ini_groups.php:1.3 --- php-src/ext/spl/examples/ini_groups.php:1.2 Thu Dec 4 14:39:46 2003 +++ php-src/ext/spl/examples/ini_groups.php Thu May 6 18:55:25 2004 @@ -9,7 +9,7 @@ * * Note: configure with --enable-dba * - * (c) Marcus Boerger, 2003 + * (c) Marcus Boerger, 2003 - 2004 */ if ($argc 2) { @@ -25,50 +25,11 @@ } require_once(dba_reader.inc); -require_once(key_filter.inc); +require_once(IniGroups.inc); -/** - * @brief Class to iterate all groups within an ini file. - * @author Marcus Boerger - * @version 1.0 - * - * Using this class you can iterator over all groups of a ini file. - * - * This class uses a 'is-a' relation to key_filter in contrast to a 'has-a' - * relation. Doing so both current() and key() methods must be overwritten. - * If it would use a 'has-a' relation there would be much more to type... - * but for puritists that would allow correctness in so far as then no - * key() would be needed. - */ -class ini_groups extends key_filter -{ - /** -* Construct an ini file group iterator from a filename. -* -* @param file Ini file to open. -*/ - function __construct($file) { - parent::__construct(new dba_reader($file, 'inifile'), '^\[.*\]$'); - } - - /** -* @return The current group. -*/ - function current() { - return substr(parent::key(),1,-1); - } - - /** -* @return The current group. -*/ - function key() { - return substr(parent::key(),1,-1); - } -} - -$it = new ini_groups($argv[1]); +$it = new IniGroups($argv[1]); if ($argc2) { - $it = new key_filter($it, $argv[2]); + $it = new KeyFilter($it, $argv[2]); } foreach($it as $group) { http://cvs.php.net/co.php/php-src/ext/spl/examples/IniGroups.inc?r=1.1p=1 Index: php-src/ext/spl/examples/IniGroups.inc +++ php-src/ext/spl/examples/IniGroups.inc ?php require_once(KeyFilter.inc); /** * @brief Class to iterate all groups within an ini file. * @author Marcus Boerger * @version 1.0 * * Using this class you can iterator over all groups of a ini file. * * This class uses a 'is-a' relation to KeyFilter in contrast to a 'has-a' * relation. Doing so both current() and key() methods must be overwritten. * If it would use a 'has-a' relation there would be much
[PHP-CVS] cvs: php-src /ext/spl spl.php spl_array.c
helly Thu Apr 29 18:52:49 2004 EDT Modified files: /php-src/ext/splspl.php spl_array.c Log: - Fix protos and add notes to the docs - Reorder func prototypes to show what is common and what is specific http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.19r2=1.20ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.19 php-src/ext/spl/spl.php:1.20 --- php-src/ext/spl/spl.php:1.19Wed Apr 28 15:58:47 2004 +++ php-src/ext/spl/spl.php Thu Apr 29 18:52:49 2004 @@ -143,10 +143,14 @@ function offsetUnset($index); /** \param $value is appended as last element +* \warning this method cannot be called when the ArrayObject refers to +* an object. */ function append($value); /** \return a \b copy of the array +* \note when the ArrayObject refers to an object then this method +* returns an array of the public properties. */ function getArrayCopy(); } @@ -190,10 +194,14 @@ function offsetUnset($index); /** \param $value is appended as last element +* \warning this method cannot be called when the ArrayIterator refers to +* an object. */ function append($value); /** \return a \b copy of the array +* \note when the ArrayIterator refers to an object then this method +* returns an array of the public properties. */ function getArrayCopy(); http://cvs.php.net/diff.php/php-src/ext/spl/spl_array.c?r1=1.44r2=1.45ty=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.44 php-src/ext/spl/spl_array.c:1.45 --- php-src/ext/spl/spl_array.c:1.44Thu Apr 29 18:25:44 2004 +++ php-src/ext/spl/spl_array.c Thu Apr 29 18:52:49 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: spl_array.c,v 1.44 2004/04/29 22:25:44 helly Exp $ */ +/* $Id: spl_array.c,v 1.45 2004/04/29 22:52:49 helly Exp $ */ #ifdef HAVE_CONFIG_H # include config.h @@ -77,7 +77,6 @@ static zend_function_entry spl_funcs_ArrayObject[] = { SPL_ME(Array, __construct, arginfo_array___construct, ZEND_ACC_PUBLIC) - SPL_ME(Array, getIterator, NULL, ZEND_ACC_PUBLIC) SPL_ME(Array, offsetExists, arginfo_array_offsetGet, ZEND_ACC_PUBLIC) SPL_ME(Array, offsetGet, arginfo_array_offsetGet, ZEND_ACC_PUBLIC) SPL_ME(Array, offsetSet, arginfo_array_offsetSet, ZEND_ACC_PUBLIC) @@ -85,24 +84,27 @@ SPL_ME(Array, append,arginfo_array_append,ZEND_ACC_PUBLIC) SPL_ME(Array, getArrayCopy, NULL, ZEND_ACC_PUBLIC) SPL_ME(Array, count, NULL, ZEND_ACC_PUBLIC) + /* ArrayObject specific */ + SPL_ME(Array, getIterator, NULL, ZEND_ACC_PUBLIC) {NULL, NULL, NULL} }; static zend_function_entry spl_funcs_ArrayIterator[] = { SPL_ME(Array, __construct, arginfo_array___construct, ZEND_ACC_PUBLIC) - SPL_ME(Array, rewind,NULL, ZEND_ACC_PUBLIC) - SPL_ME(Array, current, NULL, ZEND_ACC_PUBLIC) - SPL_ME(Array, key, NULL, ZEND_ACC_PUBLIC) - SPL_ME(Array, next, NULL, ZEND_ACC_PUBLIC) - SPL_ME(Array, valid, NULL, ZEND_ACC_PUBLIC) SPL_ME(Array, offsetExists, arginfo_array_offsetGet, ZEND_ACC_PUBLIC) SPL_ME(Array, offsetGet, arginfo_array_offsetGet, ZEND_ACC_PUBLIC) SPL_ME(Array, offsetSet, arginfo_array_offsetSet, ZEND_ACC_PUBLIC) SPL_ME(Array, offsetUnset, arginfo_array_offsetGet, ZEND_ACC_PUBLIC) SPL_ME(Array, append,arginfo_array_append,ZEND_ACC_PUBLIC) SPL_ME(Array, getArrayCopy, NULL, ZEND_ACC_PUBLIC) - SPL_ME(Array, seek, arginfo_array_seek,ZEND_ACC_PUBLIC) SPL_ME(Array, count, NULL, ZEND_ACC_PUBLIC) + /* ArrayIterator specific */ + SPL_ME(Array, rewind,NULL, ZEND_ACC_PUBLIC) + SPL_ME(Array, current, NULL, ZEND_ACC_PUBLIC) + SPL_ME(Array, key, NULL, ZEND_ACC_PUBLIC) + SPL_ME(Array, next, NULL, ZEND_ACC_PUBLIC) + SPL_ME(Array, valid, NULL, ZEND_ACC_PUBLIC) + SPL_ME(Array, seek, arginfo_array_seek,ZEND_ACC_PUBLIC) {NULL, NULL, NULL} }; @@ -327,6 +329,7 @@ /* }}} */ /* {{{ proto bool ArrayObject::offsetExists(mixed $index) + proto bool ArrayIterator::offsetExists(mixed $index) Returns whether the requested $index exists. */ SPL_METHOD(Array, offsetExists) { @@ -338,6 +341,7 @@ } /* }}} */ /* {{{ proto bool ArrayObject::offsetGet(mixed $index) + proto bool ArrayIterator::offsetGet(mixed $index) Returns the value at the specified $index. */ SPL_METHOD(Array, offsetGet) { @@ -349,7 +353,8 @@ RETURN_ZVAL(value, 0, 1); } /* }}} */ -/* {{{ proto bool
[PHP-CVS] cvs: php-src /ext/spl spl.php /ext/spl/examples appenditerator.inc findfile.inc findfile.php /ext/spl/tests array_005.phpt array_009.phpt array_011.phpt caching_iterator_str.phpt iterator_001.phpt iterator_002.phpt iterator_003.phpt iterator_004.phpt iterator_aggregation.phpt iterator_get_inner.phpt limititerator.phpt
helly Wed Apr 28 15:58:48 2004 EDT Added files: /php-src/ext/spl/tests iterator_001.phpt iterator_002.phpt iterator_003.phpt iterator_004.phpt Removed files: /php-src/ext/spl/tests caching_iterator_str.phpt iterator_aggregation.phpt iterator_get_inner.phpt limititerator.phpt Modified files: /php-src/ext/splspl.php /php-src/ext/spl/examples appenditerator.inc findfile.inc findfile.php /php-src/ext/spl/tests array_005.phpt array_009.phpt array_011.phpt Log: - DOS 2 UNIX http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.18r2=1.19ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.18 php-src/ext/spl/spl.php:1.19 --- php-src/ext/spl/spl.php:1.18Tue Apr 27 11:39:33 2004 +++ php-src/ext/spl/spl.php Wed Apr 28 15:58:47 2004 @@ -1,447 +1,447 @@ -?php - -/** Standard PHP Library - * - * (c) Marcus Boerger, 2003 - 2004 - */ - -/** Abstract base interface that cannot be implemented alone. Instead it - * must be implemented by either IteratorAggregate or Iterator. - * - * \note Internal classes that implement this interface can be used in a - * foreach construct and do not need to implement IteratorAggregate or - * Iterator. - * - * \note This is an engine internal interface. - */ -interface Traversable -{ -} - -/** Interface to create an external Iterator. - * - * \note This is an engine internal interface. - */ -interface IteratorAggregate implements Traversable -{ - /** Return an Iterator for the implementing object. -*/ - function getIterator(); -} - -/** Interface for external iterators or objects that can be iterated - * themselves internally. - * - * \note This is an engine internal interface. - */ -interface Iterator implements Traversable -{ - /** Rewind the Iterator to the first element. -*/ +?php + +/** Standard PHP Library + * + * (c) Marcus Boerger, 2003 - 2004 + */ + +/** Abstract base interface that cannot be implemented alone. Instead it + * must be implemented by either IteratorAggregate or Iterator. + * + * \note Internal classes that implement this interface can be used in a + * foreach construct and do not need to implement IteratorAggregate or + * Iterator. + * + * \note This is an engine internal interface. + */ +interface Traversable +{ +} + +/** Interface to create an external Iterator. + * + * \note This is an engine internal interface. + */ +interface IteratorAggregate implements Traversable +{ + /** Return an Iterator for the implementing object. +*/ + function getIterator(); +} + +/** Interface for external iterators or objects that can be iterated + * themselves internally. + * + * \note This is an engine internal interface. + */ +interface Iterator implements Traversable +{ + /** Rewind the Iterator to the first element. +*/ function rewind(); - - /** Return the current element. -*/ + + /** Return the current element. +*/ function current(); - - /** Return the key of the current element. -*/ + + /** Return the key of the current element. +*/ function key(); - - /** Move forward to next element. -*/ + + /** Move forward to next element. +*/ function next(); - - /** Check if there is a current element after calls to rewind() or next(). -*/ + + /** Check if there is a current element after calls to rewind() or next(). +*/ function valid(); -} - -/** Interface for recursive traversal to be used with - * RecursiveIteratorIterator. - */ -interface RecursiveIterator implements Iterator -{ - /** \return whether current element can be iterated itself. - */ - function hasChildren(); - - /** \return an object that recursively iterates the current element. -* This object must implement RecursiveIterator. -*/ - function getChildren(); -} - -/** Class for recursive traversal. The objects of this class are created by - * instances of RecursiveIterator. Elements of those iterators may be - * traversable themselves. If so these sub elements are recursed into. - */ -class RecursiveIteratorIterator implements Iterator -{ - /** Construct an instance form a RecursiveIterator. -* -* \param $iterator inner root iterator -* \param $mode one of -*- RIT_LEAVES_ONLY do not return elements that can be recursed. -*- RIT_SELF_FIRST show elements before their sub elements. -*- RIT_CHILD_FIRST show elements after their sub elements- -* -* \note If you want to see only those elements which have sub elements then -* use a ParentIterator. -
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Tue Apr 27 11:39:33 2004 EDT Modified files: /php-src/ext/splspl.php Log: Fix documentation http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.17r2=1.18ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.17 php-src/ext/spl/spl.php:1.18 --- php-src/ext/spl/spl.php:1.17Mon Apr 26 17:34:45 2004 +++ php-src/ext/spl/spl.php Tue Apr 27 11:39:33 2004 @@ -377,7 +377,7 @@ */ function getMTime(); - /** \return The current entry's creation time. + /** \return The current entry's last change time. */ function getCTime(); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Mon Apr 26 17:34:45 2004 EDT Modified files: /php-src/ext/splspl.php Log: Update http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.16r2=1.17ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.16 php-src/ext/spl/spl.php:1.17 --- php-src/ext/spl/spl.php:1.16Tue Mar 9 12:36:32 2004 +++ php-src/ext/spl/spl.php Mon Apr 26 17:34:45 2004 @@ -104,11 +104,12 @@ /** \brief An Array wrapper * - * This array wrapper allows to recursively iterate over Arrays and Objects. + * This array wrapper allows to recursively iterate over Arrays and public + * Object properties. * * \see ArrayIterator */ -class ArrayObject implements IteratorAggregate +class ArrayObject implements IteratorAggregate, ArrayAccess { /** Construct a new array iterator from anything that has a hash table. * That is any Array or Object. @@ -117,10 +118,37 @@ */ function __construct($array); - /** Get the iterator which is a ArrayIterator object connected to this -* object. + /** \return the iterator which is an ArrayIterator object connected to +* this object. */ function getIterator(); + + /** \param $index offset to inspect +* \return whetehr offset $index esists +*/ + function offsetExists($index); + + /** \param $index offset to return value for +* \return value at offset $index +*/ + function offsetGet($index); + + /** \param $index index to set +* \param $newval new value to store at offset $index +*/ + function offsetSet($index, $newval); + + /** \param $index offset to unset +*/ + function offsetUnset($index); + + /** \param $value is appended as last element +*/ + function append($value); + + /** \return a \b copy of the array +*/ + function getArrayCopy(); } /** \brief An Array iterator @@ -128,18 +156,50 @@ * This iterator allows to unset and modify values and keys while iterating * over Arrays and Objects. * - * To use this class you must instanciate ArrayObject. - * You cannot instanciate an ArrayIterator directly. + * When you want to iterate over the same array multiple times you need to + * instanciate ArrayObject and let it create ArrayIterator instances that + * refer to it either by using foreach or by calling its getIterator() + * method manually. */ -class ArrayIterator implements Iterator +class ArrayIterator implements Iterator, SeekableIterator, ArrayAccess { /** Construct a new array iterator from anything that has a hash table. * That is any Array or Object. * * \param $array the array to use. */ - private function __construct($array); -} + public function __construct($array); + + /** \param $index offset to inspect +* \return whetehr offset $index esists +*/ + function offsetExists($index); + + /** \param $index offset to return value for +* \return value at offset $index +*/ + function offsetGet($index); + + /** \param $index index to set +* \param $newval new value to store at offset $index +*/ + function offsetSet($index, $newval); + + /** \param $index offset to unset +*/ + function offsetUnset($index); + + /** \param $value is appended as last element +*/ + function append($value); + + /** \return a \b copy of the array +*/ + function getArrayCopy(); + + /** \param $position offset to seek to +*/ + function seek($position); /** Iterator that wrapps around another iterator and only returns selected * elements of the inner iterator. @@ -162,15 +222,23 @@ function getInnerIterator(); } +/** This interface is used to optimize LimitIterator functionality. but it + * may also be used for other situations where seeking a specific offset is + * required and easily possible. + */ interface SeekableIterator implements Iterator { /** Seek to a specific position if available or throw an exception. +* \param $position offset to seek to. */ function seek($position); } /** A class that starts iteration at a certain offset and only iterates over * a specified amount of elements. + * + * This class uses SeekableIterator::seek() if available and rewind() plus + * a skip loop otehrwise. */ class LimitIetrator implements Iterator { @@ -232,7 +300,7 @@ /** \return whether the inner iterator is valid. That is this iterator * is valid and has one more element. */ - function hasNext(); + function valid(); /** \return The last value from the inner iterators __toString() or * (string) conversion. The value is only
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Tue Mar 9 12:01:23 2004 EDT Modified files: /php-src/ext/splspl.php Log: Update http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.14r2=1.15ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.14 php-src/ext/spl/spl.php:1.15 --- php-src/ext/spl/spl.php:1.14Mon Mar 8 12:33:29 2004 +++ php-src/ext/spl/spl.php Tue Mar 9 12:01:21 2004 @@ -2,7 +2,7 @@ /** Standard PHP Library * - * (c) Marcus Boerger, 2003 + * (c) Marcus Boerger, 2003 - 2004 */ /** Abstract base interface that cannot be implemented alone. Instead it @@ -318,6 +318,22 @@ */ class SimpleXMLIterator extends simplexml_element implements RecursiveIterator { + /** \copydoc Iterator::rewind +*/ + function rewind(); + + /** \copydoc Iterator::current +*/ + function current(); + + /** \copydoc Iterator::next +*/ + function next(); + + /** \copydoc Iterator::valid +*/ + function valid(); + /** \return whether the current node has sub nodes. */ function hasChildren(); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Tue Mar 9 12:36:34 2004 EDT Modified files: /php-src/ext/splspl.php Log: Drop copydoc and add more classes/methods http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.15r2=1.16ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.15 php-src/ext/spl/spl.php:1.16 --- php-src/ext/spl/spl.php:1.15Tue Mar 9 12:01:21 2004 +++ php-src/ext/spl/spl.php Tue Mar 9 12:36:32 2004 @@ -139,26 +139,6 @@ * \param $array the array to use. */ private function __construct($array); - - /** \copydoc Iterator::rewind -*/ - function rewind(); - - /** \copydoc Iterator::current -*/ - function current(); - - /** \copydoc Iterator::key -*/ - function key(); - - /** \copydoc Iterator::next -*/ - function next(); - - /** \copydoc Iterator::valid -*/ - function valid(); } /** Iterator that wrapps around another iterator and only returns selected @@ -176,26 +156,51 @@ * used as a current element of this iterator or if it should be skipped. */ abstract function accept(); - - /** \copydoc Iterator::rewind + + /** \return the inner Iterator */ - function rewind(); + function getInnerIterator(); +} - /** \copydoc Iterator::current +interface SeekableIterator implements Iterator +{ + /** Seek to a specific position if available or throw an exception. */ - function current(); + function seek($position); +} - /** \copydoc Iterator::key +/** A class that starts iteration at a certain offset and only iterates over + * a specified amount of elements. + */ +class LimitIetrator implements Iterator +{ + /** Construct an instance form a Iterator. +* +* \param $iterator inner iterator +* \param $offset starting position (zero based) +* \param $countamount of elements returned, if available) */ - function key(); + function __construct(Iterator $iterator, $offset = 0, $count = -1); - /** \copydoc Iterator::next + /** \return whether the current element of the inner iterator should be +* used as a current element of this iterator or if it should be skipped. */ - function next(); - - /** \copydoc Iterator::valid + abstract function accept(); + + /** \return the inner Iterator +*/ + function getInnerIterator(); + + /** Seek to a specific position if available or throw an exception. +* If the inner iterator is an instance of SeekableIterator its seek() +* method will be used. Otherwise the iterator will me manually forwared +* and rewinded first if necessary. */ - function valid(); + function seek($position); + + /** return the current position (zero based) +*/ + function getPosition(); } /** A recursive iterator that only returns elements that themselves can be @@ -208,34 +213,50 @@ * \param $iterator inner iterator */ function __construct(RecursiveIterator $iterator); +} - /** \copydoc RecursiveIterator::hasChildren -*/ - function hasChildren(); - - /** \copydoc RecursiveIterator::getChildren -*/ - function getChildren(); - - /** \copydoc Iterator::rewind +/** This Iterator allways reads one ahead. That allows it to know whether + * more elements are available. + */ +class CachingIterator implements Iterator +{ + /** Construct an instance form a RecursiveIterator. +* +* \param $iterator inner iterator +* \param $getStrVal whether to fetch the value returned by __toString() +* or the (string) conversion. This is optional since +* it is not always used nad takes an additional fcall. */ - function rewind(); + function __construct(Iterator $iterator, $getStrVal = false); - /** \copydoc Iterator::current + /** \return whether the inner iterator is valid. That is this iterator +* is valid and has one more element. */ - function current(); + function hasNext(); - /** \copydoc Iterator::key + /** \return The last value from the inner iterators __toString() or +* (string) conversion. The value is only fetched when the __constructor +* was called with $getStrVal = true. */ - function key(); - - /** \copydoc Iterator::next + function __tostring(); + + /** \return the inner Iterator */ - function next(); + function getInnerIterator(); +} - /** \copydoc Iterator::valid +/** The recursive version of the CachingIterator. + */ +class CachingRecursiveIterator extends CachingIterator implemnets RecursiveIterator
[PHP-CVS] cvs: php-src /ext/spl spl.php
helly Wed Jan 28 19:10:34 2004 EDT Modified files: /php-src/ext/splspl.php Log: Update http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.12r2=1.13ty=u Index: php-src/ext/spl/spl.php diff -u php-src/ext/spl/spl.php:1.12 php-src/ext/spl/spl.php:1.13 --- php-src/ext/spl/spl.php:1.12Thu Dec 4 15:01:46 2003 +++ php-src/ext/spl/spl.php Wed Jan 28 19:10:33 2004 @@ -11,13 +11,19 @@ * \note Internal classes that implement this interface can be used in a * foreach construct and do not need to implement IteratorAggregate or * Iterator. + * + * \note This is an engine internal interface. */ -interface Traversable { +interface Traversable +{ } /** Interface to create an external Iterator. + * + * \note This is an engine internal interface. */ -interface IteratorAggregate implements Traversable { +interface IteratorAggregate implements Traversable +{ /** Return an Iterator for the implementing object. */ function getIterator(); @@ -25,8 +31,11 @@ /** Interface for external iterators or objects that can be iterated * themselves internally. + * + * \note This is an engine internal interface. */ -interface Iterator implements Traversable { +interface Iterator implements Traversable +{ /** Rewind the Iterator to the first element. */ function rewind(); @@ -51,7 +60,8 @@ /** Interface for recursive traversal to be used with * RecursiveIteratorIterator. */ -interface RecursiveIterator implements Iterator { +interface RecursiveIterator implements Iterator +{ /** \return whether current element can be iterated itself. */ function hasChildren(); @@ -66,7 +76,8 @@ * instances of RecursiveIterator. Elements of those iterators may be * traversable themselves. If so these sub elements are recursed into. */ -class RecursiveIteratorIterator implements Iterator { +class RecursiveIteratorIterator implements Iterator +{ /** Construct an instance form a RecursiveIterator. * * \param $iterator inner root iterator @@ -97,8 +108,8 @@ * * \see ArrayIterator */ -class ArrayObject implements IteratorAggregate { - +class ArrayObject implements IteratorAggregate +{ /** Construct a new array iterator from anything that has a hash table. * That is any Array or Object. * @@ -118,9 +129,10 @@ * over Arrays and Objects. * * To use this class you must instanciate ArrayObject. + * You cannot instanciate an ArrayIterator directly. */ -class ArrayIterator implements Iterator { - +class ArrayIterator implements Iterator +{ /** Construct a new array iterator from anything that has a hash table. * That is any Array or Object. * @@ -152,7 +164,8 @@ /** Iterator that wrapps around another iterator and only returns selected * elements of the inner iterator. */ -abstract class FilterIterator implements Iterator { +abstract class FilterIterator implements Iterator +{ /** Construct an instance form a Iterator. * * \param $iterator inner iterator @@ -188,7 +201,8 @@ /** A recursive iterator that only returns elements that themselves can be * trversed. */ -class ParentIterator extends FilterIterator implements RecursiveIterator { +class ParentIterator extends FilterIterator implements RecursiveIterator +{ /** Construct an instance form a RecursiveIterator. * * \param $iterator inner iterator @@ -226,8 +240,8 @@ /** \brief Directory iterator */ -class DirectoryIterator implements Iterator { - +class DirectoryIterator implements Iterator +{ /** Construct a directory iterator from a path-string. * * \param $path directory to iterate. @@ -273,16 +287,44 @@ /** \brief recursive directory iterator */ -class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveIterator { +class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveIterator +{ + /** \copydoc Iterator::rewind +*/ + function rewind(); + /** \copydoc Iterator::current +*/ + function current(); + + /** \copydoc Iterator::next +*/ + function next(); + + /** \copydoc Iterator::hasMore +*/ + function hasMore(); + /** \return whether the current is a directory (not '.' or '..'). */ function hasChildren(); /** \return a RecursiveDirectoryIterator for the current entry. */ + function getChildren(); +} + +/** \brief recursive SimpleXML_Element iterator + */ +class SimpleXMLIterator extends simplexml_element implements RecursiveIterator +{ + /** \return whether the current node has sub nodes. +*/ + function hasChildren(); + + /** \return a SimpleXMLIterator for the current node. +*/ function getChildren(); - } ? \ No newline