helly Thu Apr 29 18:52:49 2004 EDT Modified files: /php-src/ext/spl spl.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.19&r2=1.20&ty=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.19 Wed 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.44&r2=1.45&ty=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.44 Thu 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 ArrayObject::offsetSet(mixed $index, mixed $newval) +/* {{{ proto void ArrayObject::offsetSet(mixed $index, mixed $newval) + proto void ArrayIterator::offsetSet(mixed $index, mixed $newval) Sets the value at the specified $index to $newval. */ SPL_METHOD(Array, offsetSet) { @@ -360,7 +365,8 @@ spl_array_write_dimension(getThis(), index, value TSRMLS_CC); } /* }}} */ -/* {{{ proto bool ArrayObject::append(mixed $newval) +/* {{{ proto void ArrayObject::append(mixed $newval) + proto void ArrayIterator::append(mixed $newval) Appends the value (cannot be called for objects). */ SPL_METHOD(Array, append) { @@ -388,7 +394,8 @@ } } /* }}} */ -/* {{{ proto bool ArrayObject::offsetUnset(mixed $index) +/* {{{ proto void ArrayObject::offsetUnset(mixed $index) + proto void ArrayIterator::offsetUnset(mixed $index) Unsets the value at the specified $index. */ SPL_METHOD(Array, offsetUnset) { @@ -400,6 +407,7 @@ } /* }}} */ /* {{ proto array ArrayObject::getArrayCopy() + proto array ArrayIterator::getArrayCopy() Return a copy of the contained array */ SPL_METHOD(Array, getArrayCopy) { @@ -713,7 +721,7 @@ } /* }}} */ -/* {{{ proto bool ArrayIterator::seek(int $position) +/* {{{ proto void ArrayIterator::seek(int $position) Seek to position. */ SPL_METHOD(Array, seek) { @@ -736,7 +744,8 @@ while (position-- > 0 && spl_array_next(intern TSRMLS_CC)); } /* }}} */ -/* {{{ proto bool ArrayObject::count() +/* {{{ proto int ArrayObject::count() + proto int ArrayIterator::count() Return the number of elements in the Iterator. */ SPL_METHOD(Array, count) {
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php