2003-05-02 07:28:28 +08:00
|
|
|
<?php
|
|
|
|
|
2004-05-07 06:55:25 +08:00
|
|
|
/** \mainpage SPL - Standard PHP Library
|
|
|
|
*
|
|
|
|
* SPL - Standard PHP Library
|
2003-05-02 07:28:28 +08:00
|
|
|
*
|
2004-03-10 01:01:21 +08:00
|
|
|
* (c) Marcus Boerger, 2003 - 2004
|
2003-05-02 07:28:28 +08:00
|
|
|
*/
|
|
|
|
|
2004-05-08 20:26:28 +08:00
|
|
|
/** \defgroup SPL Internal classes
|
|
|
|
*
|
|
|
|
* The classes and interfaces in this group are contained in the c-code of
|
|
|
|
* ext/SPL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** \defgroup Examples Example classes
|
|
|
|
*
|
|
|
|
* The classes and interfaces in this group are contained as PHP code in the
|
|
|
|
* examples subdirectory of ext/SPL. Sooner or later they will be moved to
|
|
|
|
* c-code.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** \ingroup SPL
|
|
|
|
* \brief Interface to override array access of objects.
|
2004-05-07 06:55:25 +08:00
|
|
|
*/
|
|
|
|
interface ArrayAccess
|
|
|
|
{
|
|
|
|
/** \param $offset to modify
|
|
|
|
* \param $value new value
|
|
|
|
*/
|
|
|
|
function offsetSet($offset, $value);
|
|
|
|
|
|
|
|
/** \param $offset to retrieve
|
|
|
|
* \return value at given offset
|
|
|
|
*/
|
|
|
|
function offsetGet($offset);
|
|
|
|
|
|
|
|
/** \param $offset to delete
|
|
|
|
*/
|
|
|
|
function offsetUnset($offset);
|
|
|
|
|
|
|
|
/** \param $offset to check
|
|
|
|
*\return whether the offset exists.
|
|
|
|
*/
|
|
|
|
function offsetExists($offset);
|
|
|
|
}
|
|
|
|
|
2004-05-08 20:26:28 +08:00
|
|
|
/** \ingroup SPL
|
|
|
|
* \brief Interface to detect a class is traversable using foreach.
|
|
|
|
*
|
|
|
|
* Abstract base interface that cannot be implemented alone. Instead it
|
2003-12-05 03:39:46 +08:00
|
|
|
* must be implemented by either IteratorAggregate or Iterator.
|
2003-06-10 00:58:51 +08:00
|
|
|
*
|
2003-12-05 03:39:46 +08:00
|
|
|
* \note Internal classes that implement this interface can be used in a
|
|
|
|
* foreach construct and do not need to implement IteratorAggregate or
|
|
|
|
* Iterator.
|
2004-01-29 08:10:33 +08:00
|
|
|
*
|
2004-05-07 05:20:50 +08:00
|
|
|
* \note This is an engine internal interface which cannot be implemented
|
|
|
|
* in PHP scripts. Either IteratorAggregate or Iterator must be used
|
|
|
|
* instead.
|
2003-06-10 00:58:51 +08:00
|
|
|
*/
|
2004-01-29 08:10:33 +08:00
|
|
|
interface Traversable
|
|
|
|
{
|
2003-06-10 00:58:51 +08:00
|
|
|
}
|
2003-05-02 07:28:28 +08:00
|
|
|
|
2004-05-08 20:26:28 +08:00
|
|
|
/** \ingroup SPL
|
|
|
|
* \brief Interface to create an external Iterator.
|
2004-01-29 08:10:33 +08:00
|
|
|
*
|
|
|
|
* \note This is an engine internal interface.
|
2003-12-05 03:39:46 +08:00
|
|
|
*/
|
2004-05-07 05:46:40 +08:00
|
|
|
interface IteratorAggregate extends Traversable
|
2004-01-29 08:10:33 +08:00
|
|
|
{
|
2004-05-07 05:20:50 +08:00
|
|
|
/** \return an Iterator for the implementing object.
|
2003-06-10 00:58:51 +08:00
|
|
|
*/
|
2003-12-05 03:39:46 +08:00
|
|
|
function getIterator();
|
2003-06-10 00:58:51 +08:00
|
|
|
}
|
2003-05-02 07:28:28 +08:00
|
|
|
|
2004-05-08 20:26:28 +08:00
|
|
|
/** \ingroup SPL
|
|
|
|
* \brief Basic iterator
|
|
|
|
*
|
|
|
|
* Interface for external iterators or objects that can be iterated
|
2003-12-05 03:39:46 +08:00
|
|
|
* themselves internally.
|
2004-01-29 08:10:33 +08:00
|
|
|
*
|
|
|
|
* \note This is an engine internal interface.
|
2003-06-10 00:58:51 +08:00
|
|
|
*/
|
2004-05-07 05:46:40 +08:00
|
|
|
interface Iterator extends Traversable
|
2004-01-29 08:10:33 +08:00
|
|
|
{
|
2003-12-05 03:39:46 +08:00
|
|
|
/** Rewind the Iterator to the first element.
|
2003-06-10 00:58:51 +08:00
|
|
|
*/
|
|
|
|
function rewind();
|
|
|
|
|
2003-12-05 03:39:46 +08:00
|
|
|
/** Return the current element.
|
|
|
|
*/
|
|
|
|
function current();
|
|
|
|
|
|
|
|
/** Return the key of the current element.
|
2003-05-02 07:28:28 +08:00
|
|
|
*/
|
2003-06-10 00:58:51 +08:00
|
|
|
function key();
|
2003-05-02 07:28:28 +08:00
|
|
|
|
2003-12-05 03:39:46 +08:00
|
|
|
/** Move forward to next element.
|
|
|
|
*/
|
|
|
|
function next();
|
2003-05-02 07:28:28 +08:00
|
|
|
|
2003-12-05 03:39:46 +08:00
|
|
|
/** Check if there is a current element after calls to rewind() or next().
|
|
|
|
*/
|
2004-03-09 01:33:31 +08:00
|
|
|
function valid();
|
2003-06-10 00:58:51 +08:00
|
|
|
}
|
|
|
|
|
2004-05-08 20:26:28 +08:00
|
|
|
/** \ingroup SPL
|
|
|
|
* \brief Recursive iterator
|
|
|
|
*
|
|
|
|
* Interface for recursive traversal to be used with
|
2003-12-05 03:39:46 +08:00
|
|
|
* RecursiveIteratorIterator.
|
2003-06-10 00:58:51 +08:00
|
|
|
*/
|
2004-05-07 05:46:40 +08:00
|
|
|
interface RecursiveIterator extends Iterator
|
2004-01-29 08:10:33 +08:00
|
|
|
{
|
2003-12-05 03:39:46 +08:00
|
|
|
/** \return whether current element can be iterated itself.
|
|
|
|
*/
|
|
|
|
function hasChildren();
|
2003-05-02 07:28:28 +08:00
|
|
|
|
2003-12-05 03:39:46 +08:00
|
|
|
/** \return an object that recursively iterates the current element.
|
|
|
|
* This object must implement RecursiveIterator.
|
2003-05-02 07:28:28 +08:00
|
|
|
*/
|
2003-12-05 03:39:46 +08:00
|
|
|
function getChildren();
|
2003-06-10 00:58:51 +08:00
|
|
|
}
|
2003-05-02 07:28:28 +08:00
|
|
|
|
2004-05-08 20:26:28 +08:00
|
|
|
/** \ingroup SPL
|
|
|
|
* \brief Class for recursive traversal.
|
2004-05-07 05:20:50 +08:00
|
|
|
*
|
|
|
|
* The objects of this class are created by instances of RecursiveIterator.
|
|
|
|
* Elements of those iterators may be traversable themselves. If so these
|
|
|
|
* sub elements are recursed into.
|
2003-06-10 00:58:51 +08:00
|
|
|
*/
|
2004-01-29 08:10:33 +08:00
|
|
|
class RecursiveIteratorIterator implements Iterator
|
|
|
|
{
|
2003-12-05 03:39:46 +08:00
|
|
|
/** Construct an instance form a RecursiveIterator.
|
|
|
|
*
|
|
|
|
* \param $iterator inner root iterator
|
|
|
|
* \param $mode one of
|
|
|
|
* - RIT_LEAVES_ONLY do not return elements that can be recursed.
|
|
|
|
* - RIT_SELF_FIRST show elements before their sub elements.
|
2004-05-08 20:26:28 +08:00
|
|
|
* - RIT_CHILD_FIRST show elements after their sub elements.
|
2003-12-05 03:39:46 +08:00
|
|
|
*
|
|
|
|
* \note If you want to see only those elements which have sub elements then
|
|
|
|
* use a ParentIterator.
|
|
|
|
*/
|
|
|
|
function __construct(RecursiveIterator $iterator, $mode);
|
2003-05-02 07:28:28 +08:00
|
|
|
|
2003-12-05 03:39:46 +08:00
|
|
|
/** \return the level of recursion (>=0).
|
2003-05-02 07:28:28 +08:00
|
|
|
*/
|
2003-12-05 03:39:46 +08:00
|
|
|
function getDepth();
|
2003-08-05 07:00:57 +08:00
|
|
|
|
2003-12-05 03:39:46 +08:00
|
|
|
/** \param $level the level of the sub iterator to return.
|
|
|
|
* \return the current inner sub iterator or the iterator at the
|
|
|
|
* specified $level.
|
2003-08-05 07:00:57 +08:00
|
|
|
*/
|
2003-12-05 03:39:46 +08:00
|
|
|
function getSubIterator([$level]);
|
2003-08-05 07:00:57 +08:00
|
|
|
}
|
|
|
|
|
2004-05-08 20:26:28 +08:00
|
|
|
/** \ingroup SPL
|
|
|
|
* \brief An Array wrapper
|
2003-08-05 07:00:57 +08:00
|
|
|
*
|
2004-04-27 05:34:45 +08:00
|
|
|
* This array wrapper allows to recursively iterate over Arrays and public
|
|
|
|
* Object properties.
|
2003-08-05 07:00:57 +08:00
|
|
|
*
|
2003-12-05 03:39:46 +08:00
|
|
|
* \see ArrayIterator
|
2003-08-05 07:00:57 +08:00
|
|
|
*/
|
2004-04-27 05:34:45 +08:00
|
|
|
class ArrayObject implements IteratorAggregate, ArrayAccess
|
2004-01-29 08:10:33 +08:00
|
|
|
{
|
2003-12-05 03:39:46 +08:00
|
|
|
/** Construct a new array iterator from anything that has a hash table.
|
2003-08-05 07:00:57 +08:00
|
|
|
* That is any Array or Object.
|
|
|
|
*
|
|
|
|
* \param $array the array to use.
|
|
|
|
*/
|
|
|
|
function __construct($array);
|
|
|
|
|
2004-04-27 05:34:45 +08:00
|
|
|
/** \return the iterator which is an ArrayIterator object connected to
|
|
|
|
* this object.
|
2003-08-05 07:00:57 +08:00
|
|
|
*/
|
2003-12-05 03:39:46 +08:00
|
|
|
function getIterator();
|
2004-04-27 05:34:45 +08:00
|
|
|
|
|
|
|
/** \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
|
2004-04-30 06:52:49 +08:00
|
|
|
* \warning this method cannot be called when the ArrayObject refers to
|
|
|
|
* an object.
|
2004-04-27 05:34:45 +08:00
|
|
|
*/
|
|
|
|
function append($value);
|
|
|
|
|
|
|
|
/** \return a \b copy of the array
|
2004-04-30 06:52:49 +08:00
|
|
|
* \note when the ArrayObject refers to an object then this method
|
|
|
|
* returns an array of the public properties.
|
2004-04-27 05:34:45 +08:00
|
|
|
*/
|
|
|
|
function getArrayCopy();
|
2004-05-07 05:20:50 +08:00
|
|
|
|
|
|
|
/** \return the number of elements in the array or the number of public
|
|
|
|
* properties in the object.
|
|
|
|
*/
|
|
|
|
function count();
|
2003-08-05 07:00:57 +08:00
|
|
|
}
|
|
|
|
|
2004-05-08 20:26:28 +08:00
|
|
|
/** \ingroup SPL
|
|
|
|
* \brief An Array iterator
|
2003-08-05 07:00:57 +08:00
|
|
|
*
|
|
|
|
* This iterator allows to unset and modify values and keys while iterating
|
|
|
|
* over Arrays and Objects.
|
|
|
|
*
|
2004-04-27 05:34:45 +08:00
|
|
|
* 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.
|
2003-08-05 07:00:57 +08:00
|
|
|
*/
|
2004-04-27 05:34:45 +08:00
|
|
|
class ArrayIterator implements Iterator, SeekableIterator, ArrayAccess
|
2004-01-29 08:10:33 +08:00
|
|
|
{
|
2003-12-05 03:39:46 +08:00
|
|
|
/** Construct a new array iterator from anything that has a hash table.
|
2003-08-05 07:00:57 +08:00
|
|
|
* That is any Array or Object.
|
|
|
|
*
|
|
|
|
* \param $array the array to use.
|
|
|
|
*/
|
2004-04-27 05:34:45 +08:00
|
|
|
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
|
2004-04-30 06:52:49 +08:00
|
|
|
* \warning this method cannot be called when the ArrayIterator refers to
|
|
|
|
* an object.
|
2004-04-27 05:34:45 +08:00
|
|
|
*/
|
|
|
|
function append($value);
|
|
|
|
|
|
|
|
/** \return a \b copy of the array
|
2004-04-30 06:52:49 +08:00
|
|
|
* \note when the ArrayIterator refers to an object then this method
|
|
|
|
* returns an array of the public properties.
|
2004-04-27 05:34:45 +08:00
|
|
|
*/
|
|
|
|
function getArrayCopy();
|
|
|
|
|
|
|
|
/** \param $position offset to seek to
|
|
|
|
*/
|
|
|
|
function seek($position);
|
2003-12-05 03:39:46 +08:00
|
|
|
|
2004-05-07 05:20:50 +08:00
|
|
|
/** \return the number of elements in the array or the number of public
|
|
|
|
* properties in the object.
|
|
|
|
*/
|
|
|
|
function count();
|
|
|
|
}
|
|
|
|
|
2004-05-08 20:26:28 +08:00
|
|
|
/** \ingroup SPL
|
|
|
|
* \brief An iterator that filters other iterators
|
2004-05-07 05:20:50 +08:00
|
|
|
*
|
|
|
|
* Iterator that wrapps around another iterator and only returns selected
|
|
|
|
* elements of the inner iterator. The only thing that needs to be done to
|
|
|
|
* make this work is implementing method accept(). Typically this invloves
|
|
|
|
* reading the current element or key of the inner Iterator and checking
|
|
|
|
* whether it is acceptable.
|
2003-12-05 04:01:46 +08:00
|
|
|
*/
|
2004-01-29 08:10:33 +08:00
|
|
|
abstract class FilterIterator implements Iterator
|
|
|
|
{
|
2003-12-05 03:39:46 +08:00
|
|
|
/** Construct an instance form a Iterator.
|
|
|
|
*
|
|
|
|
* \param $iterator inner iterator
|
|
|
|
*/
|
|
|
|
function __construct(Iterator $iterator);
|
|
|
|
|
|
|
|
/** \return whether the current element of the inner iterator should be
|
|
|
|
* used as a current element of this iterator or if it should be skipped.
|
|
|
|
*/
|
|
|
|
abstract function accept();
|
2004-03-10 01:36:32 +08:00
|
|
|
|
|
|
|
/** \return the inner Iterator
|
2003-08-05 07:00:57 +08:00
|
|
|
*/
|
2004-03-10 01:36:32 +08:00
|
|
|
function getInnerIterator();
|
|
|
|
}
|
2003-08-05 07:00:57 +08:00
|
|
|
|
2004-05-08 20:26:28 +08:00
|
|
|
/** \ingroup SPL
|
|
|
|
* \brief Seekable iterator
|
|
|
|
*
|
|
|
|
* This interface is used to optimize LimitIterator functionality. but it
|
2004-04-27 05:34:45 +08:00
|
|
|
* may also be used for other situations where seeking a specific offset is
|
|
|
|
* required and easily possible.
|
|
|
|
*/
|
2004-05-07 05:46:40 +08:00
|
|
|
interface SeekableIterator extends Iterator
|
2004-03-10 01:36:32 +08:00
|
|
|
{
|
|
|
|
/** Seek to a specific position if available or throw an exception.
|
2004-04-27 05:34:45 +08:00
|
|
|
* \param $position offset to seek to.
|
2003-08-05 07:00:57 +08:00
|
|
|
*/
|
2004-03-10 01:36:32 +08:00
|
|
|
function seek($position);
|
|
|
|
}
|
2003-08-05 07:00:57 +08:00
|
|
|
|
2004-05-08 20:26:28 +08:00
|
|
|
/** \ingroup SPL
|
|
|
|
* \brief Limiting iterator
|
|
|
|
*
|
|
|
|
* A class that starts iteration at a certain offset and only iterates over
|
2004-03-10 01:36:32 +08:00
|
|
|
* a specified amount of elements.
|
2004-04-27 05:34:45 +08:00
|
|
|
*
|
|
|
|
* This class uses SeekableIterator::seek() if available and rewind() plus
|
|
|
|
* a skip loop otehrwise.
|
2004-03-10 01:36:32 +08:00
|
|
|
*/
|
|
|
|
class LimitIetrator implements Iterator
|
|
|
|
{
|
|
|
|
/** Construct an instance form a Iterator.
|
|
|
|
*
|
|
|
|
* \param $iterator inner iterator
|
|
|
|
* \param $offset starting position (zero based)
|
|
|
|
* \param $count amount of elements returned, if available)
|
2003-08-05 07:00:57 +08:00
|
|
|
*/
|
2004-03-10 01:36:32 +08:00
|
|
|
function __construct(Iterator $iterator, $offset = 0, $count = -1);
|
2003-08-05 07:00:57 +08:00
|
|
|
|
2004-03-10 01:36:32 +08:00
|
|
|
/** \return whether the current element of the inner iterator should be
|
|
|
|
* used as a current element of this iterator or if it should be skipped.
|
2003-08-05 07:00:57 +08:00
|
|
|
*/
|
2004-03-10 01:36:32 +08:00
|
|
|
abstract function accept();
|
|
|
|
|
|
|
|
/** \return the inner Iterator
|
2003-08-05 07:00:57 +08:00
|
|
|
*/
|
2004-03-10 01:36:32 +08:00
|
|
|
function getInnerIterator();
|
|
|
|
|
|
|
|
/** Seek to a specific position if available or throw an exception.
|
|
|
|
* If the inner iterator is an instance of SeekableIterator its seek()
|
|
|
|
* method will be used. Otherwise the iterator will me manually forwared
|
|
|
|
* and rewinded first if necessary.
|
|
|
|
*/
|
|
|
|
function seek($position);
|
|
|
|
|
|
|
|
/** return the current position (zero based)
|
|
|
|
*/
|
|
|
|
function getPosition();
|
2003-06-10 00:58:51 +08:00
|
|
|
}
|
2003-05-02 07:28:28 +08:00
|
|
|
|
2004-05-08 20:26:28 +08:00
|
|
|
/** \ingroup SPL
|
|
|
|
* \brief Iterator that shows only parents
|
|
|
|
*
|
|
|
|
* A recursive iterator that only returns elements that themselves can be
|
2003-12-05 04:01:46 +08:00
|
|
|
* trversed.
|
|
|
|
*/
|
2004-01-29 08:10:33 +08:00
|
|
|
class ParentIterator extends FilterIterator implements RecursiveIterator
|
|
|
|
{
|
2003-12-05 03:39:46 +08:00
|
|
|
/** Construct an instance form a RecursiveIterator.
|
|
|
|
*
|
|
|
|
* \param $iterator inner iterator
|
|
|
|
*/
|
|
|
|
function __construct(RecursiveIterator $iterator);
|
2004-03-10 01:36:32 +08:00
|
|
|
}
|
2003-12-05 03:39:46 +08:00
|
|
|
|
2004-05-08 20:26:28 +08:00
|
|
|
/** \ingroup SPL
|
|
|
|
* \brief Caching iterator
|
|
|
|
*
|
|
|
|
* This Iterator allways reads one ahead. That allows it to know whether
|
2004-03-10 01:36:32 +08:00
|
|
|
* more elements are available.
|
|
|
|
*/
|
|
|
|
class CachingIterator implements Iterator
|
|
|
|
{
|
|
|
|
/** Construct an instance form a RecursiveIterator.
|
|
|
|
*
|
|
|
|
* \param $iterator inner iterator
|
|
|
|
* \param $getStrVal whether to fetch the value returned by __toString()
|
|
|
|
* or the (string) conversion. This is optional since
|
|
|
|
* it is not always used nad takes an additional fcall.
|
2003-12-05 03:39:46 +08:00
|
|
|
*/
|
2004-03-10 01:36:32 +08:00
|
|
|
function __construct(Iterator $iterator, $getStrVal = false);
|
2003-12-05 03:39:46 +08:00
|
|
|
|
2004-03-10 01:36:32 +08:00
|
|
|
/** \return whether the inner iterator is valid. That is this iterator
|
|
|
|
* is valid and has one more element.
|
2003-12-05 03:39:46 +08:00
|
|
|
*/
|
2004-04-27 05:34:45 +08:00
|
|
|
function valid();
|
2003-12-05 03:39:46 +08:00
|
|
|
|
2004-03-10 01:36:32 +08:00
|
|
|
/** \return The last value from the inner iterators __toString() or
|
|
|
|
* (string) conversion. The value is only fetched when the __constructor
|
|
|
|
* was called with $getStrVal = true.
|
2003-12-05 03:39:46 +08:00
|
|
|
*/
|
2004-03-10 01:36:32 +08:00
|
|
|
function __tostring();
|
|
|
|
|
|
|
|
/** \return the inner Iterator
|
2003-12-05 03:39:46 +08:00
|
|
|
*/
|
2004-03-10 01:36:32 +08:00
|
|
|
function getInnerIterator();
|
|
|
|
}
|
2003-12-05 03:39:46 +08:00
|
|
|
|
2004-05-08 20:26:28 +08:00
|
|
|
/** \ingroup SPL
|
|
|
|
* \brief The recursive version of the CachingIterator.
|
2004-03-10 01:36:32 +08:00
|
|
|
*/
|
2004-05-07 06:55:25 +08:00
|
|
|
class CachingRecursiveIterator extends CachingIterator implements RecursiveIterator
|
2004-03-10 01:36:32 +08:00
|
|
|
{
|
|
|
|
/** Construct an instance form a RecursiveIterator.
|
|
|
|
*
|
|
|
|
* \param $iterator inner iterator
|
|
|
|
* \param $getStrVal whether to fetch the value returned by __toString()
|
|
|
|
* or the (string) conversion. This is optional since
|
|
|
|
* it is not always used nad takes an additional fcall.
|
2003-12-05 03:39:46 +08:00
|
|
|
*/
|
2004-03-10 01:36:32 +08:00
|
|
|
function __construct(RecursiveIterator $iterator, $getStrVal);
|
2003-12-05 03:39:46 +08:00
|
|
|
}
|
|
|
|
|
2004-05-08 20:26:28 +08:00
|
|
|
/** \ingroup SPL
|
|
|
|
* \brief Directory iterator
|
2003-08-05 07:15:56 +08:00
|
|
|
*/
|
2004-01-29 08:10:33 +08:00
|
|
|
class DirectoryIterator implements Iterator
|
|
|
|
{
|
2003-12-05 03:39:46 +08:00
|
|
|
/** Construct a directory iterator from a path-string.
|
2003-08-05 07:15:56 +08:00
|
|
|
*
|
|
|
|
* \param $path directory to iterate.
|
|
|
|
*/
|
2003-08-05 07:21:27 +08:00
|
|
|
function __construct($path);
|
2003-08-05 07:15:56 +08:00
|
|
|
|
2003-12-05 03:39:46 +08:00
|
|
|
/** \return The opened path.
|
|
|
|
*/
|
|
|
|
function getPath();
|
|
|
|
|
|
|
|
/** \return The current file name.
|
|
|
|
*/
|
|
|
|
function getFilename();
|
|
|
|
|
|
|
|
/** \return The current entries path and file name.
|
2003-08-05 07:15:56 +08:00
|
|
|
*/
|
2003-12-05 03:39:46 +08:00
|
|
|
function getPathname();
|
|
|
|
|
2004-04-27 05:34:45 +08:00
|
|
|
/** \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();
|
|
|
|
|
2004-04-27 23:39:33 +08:00
|
|
|
/** \return The current entry's last change time.
|
2004-04-27 05:34:45 +08:00
|
|
|
*/
|
|
|
|
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();
|
|
|
|
|
2003-12-05 03:39:46 +08:00
|
|
|
/** \return Whether the current entry is a directory.
|
|
|
|
*/
|
|
|
|
function isDir();
|
|
|
|
|
|
|
|
/** \return Whether the current entry is either '.' or '..'.
|
|
|
|
*/
|
|
|
|
function isDot();
|
2004-04-27 05:34:45 +08:00
|
|
|
|
|
|
|
/** \return whether the current entry is a link.
|
|
|
|
*/
|
|
|
|
function isLink();
|
|
|
|
|
|
|
|
/** \return getFilename()
|
|
|
|
*/
|
|
|
|
function __toString();
|
2003-08-05 07:15:56 +08:00
|
|
|
}
|
2003-12-05 03:39:46 +08:00
|
|
|
|
2004-05-08 20:26:28 +08:00
|
|
|
/** \ingroup SPL
|
|
|
|
* \brief recursive directory iterator
|
2003-12-05 03:39:46 +08:00
|
|
|
*/
|
2004-01-29 08:10:33 +08:00
|
|
|
class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveIterator
|
|
|
|
{
|
2003-12-05 03:39:46 +08:00
|
|
|
/** \return whether the current is a directory (not '.' or '..').
|
|
|
|
*/
|
|
|
|
function hasChildren();
|
|
|
|
|
|
|
|
/** \return a RecursiveDirectoryIterator for the current entry.
|
|
|
|
*/
|
|
|
|
function getChildren();
|
2004-01-29 08:10:33 +08:00
|
|
|
}
|
|
|
|
|
2004-05-08 20:26:28 +08:00
|
|
|
/** \ingroup SPL
|
|
|
|
* \brief recursive SimpleXML_Element iterator
|
2004-01-29 08:10:33 +08:00
|
|
|
*/
|
2004-04-27 05:34:45 +08:00
|
|
|
class SimpleXMLIterator extends SimpleXMLElement implements RecursiveIterator
|
2004-01-29 08:10:33 +08:00
|
|
|
{
|
|
|
|
/** \return whether the current node has sub nodes.
|
|
|
|
*/
|
|
|
|
function hasChildren();
|
|
|
|
|
|
|
|
/** \return a SimpleXMLIterator for the current node.
|
|
|
|
*/
|
|
|
|
function getChildren();
|
2003-12-05 03:39:46 +08:00
|
|
|
}
|
|
|
|
|
2003-05-02 07:28:28 +08:00
|
|
|
?>
|