helly Sat Oct 8 15:09:58 2005 EDT Modified files: (Branch: PHP_5_1) /php-src/ext/spl spl_iterators.h /php-src/ext/spl/examples class_tree.php recursivetreeiterator.inc /php-src/ext/spl/internal cachingiterator.inc recursiveiteratoriterator.inc Log: - Update docu - Synch class consts with HEAD - Synch example RecursiveTreeIterator (as far as possible) http://cvs.php.net/diff.php/php-src/ext/spl/spl_iterators.h?r1=1.18.2.4&r2=1.18.2.5&ty=u Index: php-src/ext/spl/spl_iterators.h diff -u php-src/ext/spl/spl_iterators.h:1.18.2.4 php-src/ext/spl/spl_iterators.h:1.18.2.5 --- php-src/ext/spl/spl_iterators.h:1.18.2.4 Mon Oct 3 11:43:40 2005 +++ php-src/ext/spl/spl_iterators.h Sat Oct 8 15:09:58 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_iterators.h,v 1.18.2.4 2005/10/03 15:43:40 helly Exp $ */ +/* $Id: spl_iterators.h,v 1.18.2.5 2005/10/08 19:09:58 helly Exp $ */ #ifndef SPL_ITERATORS_H #define SPL_ITERATORS_H @@ -66,8 +66,8 @@ /* public */ CIT_CALL_TOSTRING = 0x00000001, CIT_CATCH_GET_CHILD = 0x00000002, - CIT_TOSTRING_USE_KEY = 0x00000004, - CIT_TOSTRING_USE_CURRENT = 0x00000008, + CIT_TOSTRING_USE_KEY = 0x00000010, + CIT_TOSTRING_USE_CURRENT = 0x00000020, CIT_PUBLIC = 0x0000FFFF, /* private */ CIT_VALID = 0x00010000, http://cvs.php.net/diff.php/php-src/ext/spl/examples/class_tree.php?r1=1.1.2.3&r2=1.1.2.4&ty=u Index: php-src/ext/spl/examples/class_tree.php diff -u php-src/ext/spl/examples/class_tree.php:1.1.2.3 php-src/ext/spl/examples/class_tree.php:1.1.2.4 --- php-src/ext/spl/examples/class_tree.php:1.1.2.3 Mon Oct 3 05:14:30 2005 +++ php-src/ext/spl/examples/class_tree.php Sat Oct 8 15:09:58 2005 @@ -5,6 +5,7 @@ * @ingroup Examples * @author Marcus Boerger * @date 2003 - 2005 + * @version 1.0 * * Usage: php class_tree.php \<class\> * http://cvs.php.net/diff.php/php-src/ext/spl/examples/recursivetreeiterator.inc?r1=1.1.2.4&r2=1.1.2.5&ty=u Index: php-src/ext/spl/examples/recursivetreeiterator.inc diff -u php-src/ext/spl/examples/recursivetreeiterator.inc:1.1.2.4 php-src/ext/spl/examples/recursivetreeiterator.inc:1.1.2.5 --- php-src/ext/spl/examples/recursivetreeiterator.inc:1.1.2.4 Wed Oct 5 15:11:51 2005 +++ php-src/ext/spl/examples/recursivetreeiterator.inc Sat Oct 8 15:09:58 2005 @@ -18,16 +18,21 @@ */ class RecursiveTreeIterator extends RecursiveIteratorIterator { + const BYPASS_CURRENT = 0x00000004; + private $callToString; + private $rit_flags; /** * @param it iterator to use as inner iterator - * @param flags flags passed to RecursiveIteratoIterator (parent) + * @param rit_flags flags passed to RecursiveIteratoIterator (parent) * @param cit_flags flags passed to RecursiveCachingIterator (for hasNext) + * @param mode mode passed to RecursiveIteratoIterator (parent) */ - function __construct(RecursiveIterator $it, $flags = self::SELF_FIRST, $cit_flags = CachingIterator::CATCH_GET_CHILD) + function __construct(RecursiveIterator $it, $rit_flags = 0, $cit_flags = CachingIterator::CATCH_GET_CHILD, $mode = self::SELF_FIRST) { - parent::__construct(new RecursiveCachingIterator($it, $cit_flags), $flags); + parent::__construct(new RecursiveCachingIterator($it, $cit_flags), $mode, $rit_flags); + $this->rit_flags = $rit_flags; $this->callToString = (bool)($cit_flags & CachingIterator::CALL_TOSTRING); } @@ -74,7 +79,21 @@ */ function current() { + if ($this->rit_flags & self::BYPASS_CURRENT) + { + return parent::current(); + } + else + { return $this->getPrefix() . $this->getEntry() . $this->getPostfix(); + } + } + + /** @return the current key prefixed and postfixed + */ + function key() + { + return $this->getPrefix() . parent::key() . $this->getPostfix(); } /** Aggregates the inner iterator http://cvs.php.net/diff.php/php-src/ext/spl/internal/cachingiterator.inc?r1=1.7.2.2&r2=1.7.2.3&ty=u Index: php-src/ext/spl/internal/cachingiterator.inc diff -u php-src/ext/spl/internal/cachingiterator.inc:1.7.2.2 php-src/ext/spl/internal/cachingiterator.inc:1.7.2.3 --- php-src/ext/spl/internal/cachingiterator.inc:1.7.2.2 Mon Oct 3 12:05:08 2005 +++ php-src/ext/spl/internal/cachingiterator.inc Sat Oct 8 15:09:58 2005 @@ -1,14 +1,14 @@ <?php -/** @file cachingiterator.inc - * @ingroup SPL - * @brief class CachingIterator - * @author Marcus Boerger - * @date 2003 - 2005 - * - * SPL - Standard PHP Library - */ - +/** @file cachingiterator.inc + * @ingroup SPL + * @brief class CachingIterator + * @author Marcus Boerger + * @date 2003 - 2005 + * + * SPL - Standard PHP Library + */ + /** * @brief Cached iteration over another Iterator * @author Marcus Boerger @@ -27,10 +27,10 @@ */ class CachingIterator implements OuterIterator { - const CALL_TOSTRING = 1; - const CATCH_GET_CHILD = 2; - const TOSTRING_USE_KEY = 4; - const TOSTRING_USE_CURRENT = 8; + const CALL_TOSTRING = 0x00000001; + const CATCH_GET_CHILD = 0x00000002; + const TOSTRING_USE_KEY = 0x00000010; + const TOSTRING_USE_CURRENT = 0x00000020; private $it; private $current; http://cvs.php.net/diff.php/php-src/ext/spl/internal/recursiveiteratoriterator.inc?r1=1.14.2.1&r2=1.14.2.2&ty=u Index: php-src/ext/spl/internal/recursiveiteratoriterator.inc diff -u php-src/ext/spl/internal/recursiveiteratoriterator.inc:1.14.2.1 php-src/ext/spl/internal/recursiveiteratoriterator.inc:1.14.2.2 --- php-src/ext/spl/internal/recursiveiteratoriterator.inc:1.14.2.1 Wed Sep 14 23:33:04 2005 +++ php-src/ext/spl/internal/recursiveiteratoriterator.inc Sat Oct 8 15:09:58 2005 @@ -1,14 +1,14 @@ <?php -/** @file recursiveiteratoriterator.inc - * @ingroup SPL - * @brief class RecursiveIteratorIterator - * @author Marcus Boerger - * @date 2003 - 2005 - * - * SPL - Standard PHP Library - */ - +/** @file recursiveiteratoriterator.inc + * @ingroup SPL + * @brief class RecursiveIteratorIterator + * @author Marcus Boerger + * @date 2003 - 2005 + * + * SPL - Standard PHP Library + */ + /** * @brief Iterates through recursive iterators * @author Marcus Boerger @@ -30,7 +30,7 @@ /** Flag: Catches exceptions during getChildren() calls and simply jumps * to the next element. */ - const CATCH_GET_CHILD = 2; + const CATCH_GET_CHILD = 0x00000002; private $ait = array(); private $count = 0;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php