helly           Mon Apr 26 17:34:45 2004 EDT

  Modified files:              
    /php-src/ext/spl    spl.php 
  Log:
  Update
  
http://cvs.php.net/diff.php/php-src/ext/spl/spl.php?r1=1.16&r2=1.17&ty=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.16        Tue 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 fetched when the __constructor
@@ -281,6 +349,58 @@
         */
        function getPathname(); 
 
+       /** \return The current entry's permissions.
+        */
+       function getPerms();
+
+       /** \return The current entry's inode.
+        */
+       function getInode();
+
+       /** \return The current entry's size in bytes .
+        */
+       function getSize();
+
+       /** \return The current entry's owner name.
+        */
+       function getOwner();
+
+       /** \return The current entry's group name.
+        */
+       function getGroup();
+
+       /** \return The current entry's last access time.
+        */
+       function getATime();
+
+       /** \return The current entry's last modification time.
+        */
+       function getMTime();
+
+       /** \return The current entry's creation time.
+        */
+       function getCTime();
+
+       /** \return The current entry's size in bytes .
+        */
+       function getType();
+
+       /** \return Whether the current entry is writeable.
+        */
+       function isWritable();
+
+       /** \return Whether the current entry is readable.
+        */
+       function isReadable();
+
+       /** \return Whether the current entry is executable.
+        */
+       function isExecutable();
+
+       /** \return Whether the current entry is .
+        */
+       function isFile();
+
        /** \return Whether the current entry is a directory.
         */
        function isDir();       
@@ -288,6 +408,14 @@
        /** \return Whether the current entry is either '.' or '..'.
         */
        function isDot();       
+
+       /** \return whether the current entry is a link.
+        */
+       function isLink();
+
+       /** \return getFilename()
+        */
+       function __toString();
 }
 
 /** \brief recursive directory iterator
@@ -305,7 +433,7 @@
 
 /** \brief recursive SimpleXML_Element iterator
  */
-class SimpleXMLIterator extends simplexml_element implements RecursiveIterator
+class SimpleXMLIterator extends SimpleXMLElement implements RecursiveIterator
 {
        /** \return whether the current node has sub nodes.
         */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to