diff options
author | Marcus Boerger <helly@php.net> | 2004-10-29 20:58:58 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2004-10-29 20:58:58 +0000 |
commit | b67ca452c33a595f6f1382e32c441943a343353e (patch) | |
tree | 36cdf6a0e33dad178c84c121a4ec4ae3ac235116 /ext/spl/internal/cachingiterator.inc | |
parent | 208a97a221055eba43430139fef0d02875e3ffbd (diff) | |
download | php-git-b67ca452c33a595f6f1382e32c441943a343353e.tar.gz |
- Update docu
Diffstat (limited to 'ext/spl/internal/cachingiterator.inc')
-rwxr-xr-x | ext/spl/internal/cachingiterator.inc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/ext/spl/internal/cachingiterator.inc b/ext/spl/internal/cachingiterator.inc index a474131b5c..f1b896d05d 100755 --- a/ext/spl/internal/cachingiterator.inc +++ b/ext/spl/internal/cachingiterator.inc @@ -1,8 +1,23 @@ <?php +/** @file cachingiterator.inc + * @ingroup Internal + * @brief class CachingIterator + * @author Marcus Boerger + * @date 2003 - 2004 + * + * SPL - Standard PHP Library + */ + define('CIT_CALL_TOSTRING', 1); define('CIT_CATCH_GET_CHILD', 2); +/** + * @brief Cached Iteration over another Iterator + * @author Marcus Boerger + * @version 1.1 + * + */ class CachingIterator implements OuterIterator { protected $it; @@ -11,6 +26,12 @@ class CachingIterator implements OuterIterator protected $valid; protected $strValue; + /** Construct from another iterator + * + * @param it Iterator to cache + * @param flags Bitmask: + * - CIT_CALL_TOSTRING (whether to call __toString() for every element) + */ function __construct(Iterator $it, $flags = CIT_CALL_TOSTRING) { $this->it = $it; @@ -18,12 +39,16 @@ class CachingIterator implements OuterIterator $this->next(); } + /** Rewind the Iterator + */ function rewind() { $this->it->rewind(); $this->next(); } + /** Forward to the next element + */ function next() { if ($this->valid = $this->it->valid()) { @@ -44,31 +69,45 @@ class CachingIterator implements OuterIterator $this->it->next(); } + /** @return whether teh iterator is valid + */ function valid() { return $this->valid; } + /** @return whether there is one more element + */ function hasNext() { return $this->it->valid(); } + /** @return the current element + */ function current() { return $this->current; } + /** @return the current key + */ function key() { return $this->key; } + /** Aggregate the inner iterator + */ function __call($func, $params) { return call_user_func_array(array($this->it, $func), $params); } + /** @return the string represenatation that was generated for the current + * element + * @throw exception when CIT_CALL_TOSTRING was not specified in constructor + */ function __toString() { if (!$this->flags & CIT_CALL_TOSTRING) { @@ -77,6 +116,9 @@ class CachingIterator implements OuterIterator return $this->strValue; } + /** + * @return The inner iterator + */ function getInnerIterator() { return $this->it; |