mirror of
https://github.com/php/php-src.git
synced 2024-11-25 10:54:15 +08:00
No more namespaces
This commit is contained in:
parent
67befca5e6
commit
cdac4401d8
@ -1,12 +1,11 @@
|
||||
<?php
|
||||
|
||||
/* \brief Standard PHP Library
|
||||
/* Standard PHP Library
|
||||
*
|
||||
* (c) M.Boerger 2003
|
||||
*/
|
||||
namespace spl {
|
||||
|
||||
/*! \brief Interface to foreach() construct
|
||||
/*! \brief Interface to foreach() construct
|
||||
*
|
||||
* Any class that implements this interface can for example be used as
|
||||
* the input parameter to foreach() calls which would normally be an
|
||||
@ -14,16 +13,16 @@ namespace spl {
|
||||
*
|
||||
* The only thing a class has to do is
|
||||
*/
|
||||
interface iterator {
|
||||
interface iterator {
|
||||
|
||||
/*! \brief Create a new iterator
|
||||
*
|
||||
* used for example in foreach() operator.
|
||||
*/
|
||||
function new_iterator();
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief Simple forward iterator
|
||||
/*! \brief Simple forward iterator
|
||||
*
|
||||
* Any class that implements this interface can be used as the
|
||||
* return of a foreach interface. And hence the class itself
|
||||
@ -128,7 +127,7 @@ namespace spl {
|
||||
}
|
||||
\endcode
|
||||
*/
|
||||
interface forward {
|
||||
interface forward {
|
||||
|
||||
/*! \brief Retrieve the current currentent
|
||||
*
|
||||
@ -145,9 +144,9 @@ namespace spl {
|
||||
* \return \c bool whether or not more elements are available
|
||||
*/
|
||||
function has_more();
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief A restartable iterator.
|
||||
/*! \brief A restartable iterator.
|
||||
*
|
||||
* This iterator allows you to implement a restartable iterator. That
|
||||
* means the iterator can be rewind to the first element after accessing
|
||||
@ -156,28 +155,28 @@ namespace spl {
|
||||
* \note If you use sequence in foreach then rewind() will be called
|
||||
* first.
|
||||
*/
|
||||
interface sequence extends forward {
|
||||
interface sequence extends forward {
|
||||
|
||||
/*! Restart the sequence by positioning it to the first element.
|
||||
*/
|
||||
function rewind();
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief associative interface
|
||||
/*! \brief associative interface
|
||||
*
|
||||
* This interface allows to implement associative iterators
|
||||
* and containers.
|
||||
*/
|
||||
interface assoc {
|
||||
interface assoc {
|
||||
|
||||
/*! \brief Retrieve the current elements key
|
||||
*
|
||||
* \return \c mixed current key or \c false if no more elements
|
||||
*/
|
||||
function key();
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief associative foreach() interface
|
||||
/*! \brief associative foreach() interface
|
||||
*
|
||||
* This interface extends the forward interface to support keys.
|
||||
* With this interface you can do:
|
||||
@ -186,17 +185,17 @@ namespace spl {
|
||||
foreach($t as $key => $elem).
|
||||
\endcode
|
||||
*/
|
||||
interface assoc_forward extends forward implements assoc {
|
||||
}
|
||||
interface assoc_forward extends forward implements assoc {
|
||||
}
|
||||
|
||||
/*! \brief associative sequence
|
||||
/*! \brief associative sequence
|
||||
*/
|
||||
interface assoc_sequence extends sequence implements assoc {
|
||||
}
|
||||
interface assoc_sequence extends sequence implements assoc {
|
||||
}
|
||||
|
||||
/*! \brief array read only access for objects
|
||||
/*! \brief array read only access for objects
|
||||
*/
|
||||
interface array_read {
|
||||
interface array_read {
|
||||
|
||||
/*! Check whether or not the given index exists.
|
||||
* The returned value is interpreted as converted to bool.
|
||||
@ -207,9 +206,9 @@ namespace spl {
|
||||
* This function is only beeing called if exists() returns true.
|
||||
*/
|
||||
function get($index);
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief array read/write access for objects.
|
||||
/*! \brief array read/write access for objects.
|
||||
*
|
||||
* The following example shows how to use an array_writer:
|
||||
* \code
|
||||
@ -227,14 +226,14 @@ namespace spl {
|
||||
}
|
||||
\endcode
|
||||
*/
|
||||
interface array_access extends array_read {
|
||||
interface array_access extends array_read {
|
||||
|
||||
/*! Set the value identified by $index to $value.
|
||||
*/
|
||||
function set($value, $index);
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief array read/write access with customized array_writer
|
||||
/*! \brief array read/write access with customized array_writer
|
||||
*
|
||||
* The internal structure requires that write access via interfaces
|
||||
* is divided into two parts. First the index is used to create an
|
||||
@ -255,7 +254,7 @@ namespace spl {
|
||||
}
|
||||
\endcode
|
||||
*/
|
||||
interface array_access_ex extends array_access {
|
||||
interface array_access_ex extends array_access {
|
||||
|
||||
/*! Create an array_writer interface for the specified index.
|
||||
*
|
||||
@ -269,9 +268,9 @@ namespace spl {
|
||||
\endcode
|
||||
*/
|
||||
function new_writer($index);
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief array writer interface
|
||||
/*! \brief array writer interface
|
||||
*
|
||||
* for every write access to an array_access instance an array_writer
|
||||
* is created which receives the originating object and the index as
|
||||
@ -295,12 +294,11 @@ namespace spl {
|
||||
*
|
||||
* See array_access for more.
|
||||
*/
|
||||
interface array_writer {
|
||||
interface array_writer {
|
||||
|
||||
/*! Set the corresponding value to $value.
|
||||
*/
|
||||
function set($value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -209,7 +209,7 @@ int spl_fetch_dimension_address(znode *result, znode *op1, znode *op2, temp_vari
|
||||
writer->idx = dim; writer->idx->refcount++;
|
||||
SELECTIVE_PZVAL_LOCK(*retval, result);
|
||||
} else {
|
||||
zend_error(E_ERROR, "Object must implement spl::array_access for write access");
|
||||
zend_error(E_ERROR, "Object must implement spl_array_access for write access");
|
||||
retval = &EG(error_zval_ptr);
|
||||
}
|
||||
SELECTIVE_PZVAL_LOCK(*retval, result);
|
||||
@ -282,7 +282,7 @@ ZEND_EXECUTE_HOOK_FUNCTION(ZEND_ASSIGN)
|
||||
|
||||
if (writer && *writer && Z_TYPE_PP(writer) == IS_OBJECT) {
|
||||
/* optimization: do pre checks and only test for handlers in case of
|
||||
* spl::array_writer_default, for spl::array_writer we must use the
|
||||
* spl_array_writer_default, for spl_array_writer we must use the
|
||||
* long way of calling spl_instance
|
||||
* if (spl_is_instance_of(writer, spl_ce_array_writer_default TSRMLS_CC))
|
||||
*/
|
||||
|
@ -75,7 +75,7 @@ ZEND_EXECUTE_HOOK_FUNCTION(ZEND_FE_RESET)
|
||||
instance_ce = spl_get_class_entry(retval TSRMLS_CC);
|
||||
is_a = spl_implements(instance_ce);
|
||||
if (!(is_a & SPL_IS_A_FORWARD)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Objects created by new_iterator() must implement spl::forward");
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Objects created by new_iterator() must implement spl_forward");
|
||||
ZEND_EXECUTE_HOOK_ORIGINAL(ZEND_FE_RESET);
|
||||
}
|
||||
PZVAL_LOCK(retval);
|
||||
|
Loading…
Reference in New Issue
Block a user