summaryrefslogtreecommitdiff
path: root/ext/spl/examples
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2004-10-31 18:43:00 +0000
committerMarcus Boerger <helly@php.net>2004-10-31 18:43:00 +0000
commit90012aa3cc2b95a05a2e9f780823c8d217186aea (patch)
tree198d660fdaf7341dda42729ad120079ae02a9d25 /ext/spl/examples
parent6166a4a49d3bd905017712f6e2837afc569c6359 (diff)
downloadphp-git-90012aa3cc2b95a05a2e9f780823c8d217186aea.tar.gz
- Implement classes IteratorIterator and NoRewindIterator in C
Diffstat (limited to 'ext/spl/examples')
-rwxr-xr-xext/spl/examples/iteratoriterator.inc77
-rwxr-xr-xext/spl/examples/norewinditerator.inc28
2 files changed, 0 insertions, 105 deletions
diff --git a/ext/spl/examples/iteratoriterator.inc b/ext/spl/examples/iteratoriterator.inc
deleted file mode 100755
index 8ed8c6fcd7..0000000000
--- a/ext/spl/examples/iteratoriterator.inc
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-
-/** \ingroup SPL
- * \brief Basic Iterator wrapper
- */
-class IteratorIterator implements OuterIterator
-{
- /** Construct an IteratorIterator from an Iterator or an IteratorAggregate.
- *
- * Classes that only implement Traversable can be wrapped only after
- * converting class IteratorIterator into c code.
- */
- function __construct(Traversable $iterator)
- {
- if ($iterator instanceof IteratorAggregate)
- {
- $iterator = $iterator->getIterator();
- }
- if ($iterator instanceof Iterator)
- {
- $this->iterator = $iterator;
- }
- else
- {
- throw new Exception("Classes that only implement Traversable can be wrapped only after converting class IteratorItaerator into c code");
- }
- }
-
- /** \return the inner iterator as passed to the constructor
- */
- function getInnerIterator()
- {
- return $this->iterator;
- }
-
- /** \return whether the iterator is valid
- */
- function valid()
- {
- return $this->iterator->valid();
- }
-
- /** \return current key
- */
- function key()
- {
- return $this->iterator->key();
- }
-
- /** \return current value
- */
- function current()
- {
- return $this->iterator->current();
- }
-
- /** forward to next element
- */
- function next()
- {
- return $this->iterator->next();
- }
-
- /** rewind to the first element
- */
- function rewind()
- {
- return $this->iterator->rewind();
- }
-
- /** The inner iterator must be private because when this class will be
- * converted to c code it won't no longer be available.
- */
- private $iterator;
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/norewinditerator.inc b/ext/spl/examples/norewinditerator.inc
deleted file mode 100755
index dbf69c5531..0000000000
--- a/ext/spl/examples/norewinditerator.inc
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/** @file norewinditerator.inc
- * @ingroup Examples
- * @brief class NoRewindIterator
- * @author Marcus Boerger
- * @date 2003 - 2004
- *
- * SPL - Standard PHP Library
- */
-
-/** @ingroup Examples
- * @brief An Iterator that doesn't call rewind
- * @author Marcus Boerger
- * @version 1.1
- *
- */
-class NoRewindIterator extends IteratorIterator
-{
- /** Simply prevent execution of inner iterators rewind().
- */
- function rewind()
- {
- // nothing to do
- }
-}
-
-?> \ No newline at end of file