mirror of
https://github.com/php/php-src.git
synced 2025-08-18 23:18:56 +02:00
- Rename file class again by popular demmand: calling it SplFileObject now
# Any other idea about the name? Or should i come up with a renaming plan # for the upcoming versions? :-)
This commit is contained in:
parent
1a1f97ee7e
commit
50301ddc98
7 changed files with 108 additions and 108 deletions
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
/** @file fileobject.inc
|
||||
/** @file splfileobject.inc
|
||||
* @ingroup SPL
|
||||
* @brief class FileObject
|
||||
* @author Marcus Boerger
|
||||
|
@ -15,7 +15,7 @@
|
|||
* @version 1.0
|
||||
* @since PHP 5.1
|
||||
*/
|
||||
class FileObject implements RecursiveIterator, SeekableIterator
|
||||
class SplFileObject implements RecursiveIterator, SeekableIterator
|
||||
{
|
||||
/** Flag: wheter to suppress new lines */
|
||||
const DROP_NEW_LINE = 0x00000001;
|
|
@ -159,7 +159,6 @@ PHP_FUNCTION(class_implements)
|
|||
SPL_ADD_CLASS(DirectoryIterator, z_list, sub, allow, ce_flags); \
|
||||
SPL_ADD_CLASS(DomainException, z_list, sub, allow, ce_flags); \
|
||||
SPL_ADD_CLASS(EmptyIterator, z_list, sub, allow, ce_flags); \
|
||||
SPL_ADD_CLASS(FileObject, z_list, sub, allow, ce_flags); \
|
||||
SPL_ADD_CLASS(FilterIterator, z_list, sub, allow, ce_flags); \
|
||||
SPL_ADD_CLASS(InfiniteIterator, z_list, sub, allow, ce_flags); \
|
||||
SPL_ADD_CLASS(InvalidArgumentException, z_list, sub, allow, ce_flags); \
|
||||
|
@ -181,6 +180,7 @@ PHP_FUNCTION(class_implements)
|
|||
SPL_ADD_CLASS(RuntimeException, z_list, sub, allow, ce_flags); \
|
||||
SPL_ADD_CLASS(SeekableIterator, z_list, sub, allow, ce_flags); \
|
||||
SPL_ADD_CLASS(SimpleXMLIterator, z_list, sub, allow, ce_flags); \
|
||||
SPL_ADD_CLASS(SplFileObject, z_list, sub, allow, ce_flags); \
|
||||
SPL_ADD_CLASS(SplObjectStorage, z_list, sub, allow, ce_flags); \
|
||||
SPL_ADD_CLASS(SplObserver, z_list, sub, allow, ce_flags); \
|
||||
SPL_ADD_CLASS(SplSubject, z_list, sub, allow, ce_flags); \
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
*
|
||||
* - class DirectoryIterator implements Iterator
|
||||
* - class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveIterator
|
||||
* - class FileObject implements RecursiveIterator, SeekableIterator
|
||||
* - class SplFileObject implements RecursiveIterator, SeekableIterator
|
||||
*
|
||||
* 3) XML
|
||||
*
|
||||
|
@ -761,16 +761,16 @@ class DirectoryIterator implements Iterator
|
|||
*/
|
||||
function __toString();
|
||||
|
||||
/** Open the current file as a FileObject instance
|
||||
/** Open the current file as a SplFileObject instance
|
||||
*
|
||||
* @param mode open mode
|
||||
* @param use_include_path whether to search include paths (don't use)
|
||||
* @param context resource context to pased to open function
|
||||
* @throw RuntimeException if file cannot be opened (e.g. insufficient
|
||||
* access rights).
|
||||
* @return The opened file as a FileObject instance
|
||||
* @return The opened file as a SplFileObject instance
|
||||
*
|
||||
* @see FileObject
|
||||
* @see SplFileObject
|
||||
* @see file()
|
||||
*/
|
||||
function DirectoryIterator::openFile($mode = 'r', $use_include_path = false, $context = NULL);
|
||||
|
|
|
@ -50,7 +50,7 @@ static zend_object_handlers spl_ce_dir_handlers;
|
|||
/* decalre the class entry */
|
||||
PHPAPI zend_class_entry *spl_ce_DirectoryIterator;
|
||||
PHPAPI zend_class_entry *spl_ce_RecursiveDirectoryIterator;
|
||||
PHPAPI zend_class_entry *spl_ce_FileObject;
|
||||
PHPAPI zend_class_entry *spl_ce_SplFileObject;
|
||||
|
||||
static zend_object_value spl_file_object_new_ex(zend_class_entry *class_type, spl_file_object **obj TSRMLS_DC);
|
||||
static int spl_file_object_open(spl_file_object *intern, int use_include_path, int silent TSRMLS_DC);
|
||||
|
@ -428,7 +428,7 @@ DirectoryFunction(isDir, FS_IS_DIR)
|
|||
DirectoryFunction(isLink, FS_IS_LINK)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto FileObject DirectoryIterator::openFile([string mode = 'r' [, bool use_include_path [, resource context]]])
|
||||
/* {{{ proto SplFileObject DirectoryIterator::openFile([string mode = 'r' [, bool use_include_path [, resource context]]])
|
||||
Open the current file */
|
||||
SPL_METHOD(DirectoryIterator, openFile)
|
||||
{
|
||||
|
@ -445,7 +445,7 @@ SPL_METHOD(DirectoryIterator, openFile)
|
|||
return;
|
||||
}
|
||||
|
||||
return_value->value.obj = spl_file_object_new_ex(spl_ce_FileObject, &intern TSRMLS_CC);
|
||||
return_value->value.obj = spl_file_object_new_ex(spl_ce_SplFileObject, &intern TSRMLS_CC);
|
||||
|
||||
spl_dir_get_path_name(dir_obj);
|
||||
intern->file_name = dir_obj->path_name;
|
||||
|
@ -979,7 +979,7 @@ static int spl_file_object_read_line(zval * this_ptr, spl_file_object *intern, i
|
|||
zval *retval;
|
||||
|
||||
/* if overloaded call the function, otherwise do it directly */
|
||||
if (intern->func_getCurr->common.scope != spl_ce_FileObject) {
|
||||
if (intern->func_getCurr->common.scope != spl_ce_SplFileObject) {
|
||||
if (php_stream_eof(intern->stream)) {
|
||||
if (!silent) {
|
||||
zend_throw_exception_ex(U_CLASS_ENTRY(spl_ce_RuntimeException), 0 TSRMLS_CC, "Cannot read from file %s", intern->file_name);
|
||||
|
@ -1047,9 +1047,9 @@ static int spl_file_object_open(spl_file_object *intern, int use_include_path, i
|
|||
return SUCCESS;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto void FileObject::__construct(string filename [, string mode = 'r' [, bool use_include_path [, resource context]]]])
|
||||
/* {{{ proto void SplFileObject::__construct(string filename [, string mode = 'r' [, bool use_include_path [, resource context]]]])
|
||||
Construct a new file reader */
|
||||
SPL_METHOD(FileObject, __construct)
|
||||
SPL_METHOD(SplFileObject, __construct)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
zend_bool use_include_path = 0;
|
||||
|
@ -1072,45 +1072,45 @@ SPL_METHOD(FileObject, __construct)
|
|||
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto void FileObject::rewind()
|
||||
/* {{{ proto void SplFileObject::rewind()
|
||||
Rewind the file and read the first line */
|
||||
SPL_METHOD(FileObject, rewind)
|
||||
SPL_METHOD(SplFileObject, rewind)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
spl_file_object_rewind(intern TSRMLS_CC);
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto string FileObject::getFilename()
|
||||
/* {{{ proto string SplFileObject::getFilename()
|
||||
Return the filename */
|
||||
SPL_METHOD(FileObject, getFilename)
|
||||
SPL_METHOD(SplFileObject, getFilename)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
RETURN_STRINGL(intern->file_name, intern->file_name_len, 1);
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto void FileObject::eof()
|
||||
/* {{{ proto void SplFileObject::eof()
|
||||
Return whether end of file is reached */
|
||||
SPL_METHOD(FileObject, eof)
|
||||
SPL_METHOD(SplFileObject, eof)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
RETURN_BOOL(php_stream_eof(intern->stream));
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto void FileObject::valid()
|
||||
/* {{{ proto void SplFileObject::valid()
|
||||
Return !eof() */
|
||||
SPL_METHOD(FileObject, valid)
|
||||
SPL_METHOD(SplFileObject, valid)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
RETVAL_BOOL(!php_stream_eof(intern->stream));
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto string FileObject::fgets()
|
||||
/* {{{ proto string SplFileObject::fgets()
|
||||
Rturn next line from file */
|
||||
SPL_METHOD(FileObject, fgets)
|
||||
SPL_METHOD(SplFileObject, fgets)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
@ -1120,9 +1120,9 @@ SPL_METHOD(FileObject, fgets)
|
|||
RETURN_STRINGL(intern->current_line, intern->current_line_len, 1);
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto string FileObject::current()
|
||||
/* {{{ proto string SplFileObject::current()
|
||||
Return current line from file */
|
||||
SPL_METHOD(FileObject, current)
|
||||
SPL_METHOD(SplFileObject, current)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
@ -1137,9 +1137,9 @@ SPL_METHOD(FileObject, current)
|
|||
RETURN_FALSE;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto int FileObject::key()
|
||||
/* {{{ proto int SplFileObject::key()
|
||||
Return line number */
|
||||
SPL_METHOD(FileObject, key)
|
||||
SPL_METHOD(SplFileObject, key)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
@ -1150,9 +1150,9 @@ SPL_METHOD(FileObject, key)
|
|||
RETURN_LONG(intern->current_line_num);
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto void FileObject::next()
|
||||
/* {{{ proto void SplFileObject::next()
|
||||
Read next line */
|
||||
SPL_METHOD(FileObject, next)
|
||||
SPL_METHOD(SplFileObject, next)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
@ -1160,27 +1160,27 @@ SPL_METHOD(FileObject, next)
|
|||
intern->current_line_num++;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto void FileObject::setFlags(int flags)
|
||||
/* {{{ proto void SplFileObject::setFlags(int flags)
|
||||
Set file handling flags */
|
||||
SPL_METHOD(FileObject, setFlags)
|
||||
SPL_METHOD(SplFileObject, setFlags)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &intern->flags);
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto int FileObject::getFlags()
|
||||
/* {{{ proto int SplFileObject::getFlags()
|
||||
Get file handling flags */
|
||||
SPL_METHOD(FileObject, getFlags)
|
||||
SPL_METHOD(SplFileObject, getFlags)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
RETURN_LONG(intern->flags);
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto void FileObject::setMaxLineLen(int max_len)
|
||||
/* {{{ proto void SplFileObject::setMaxLineLen(int max_len)
|
||||
Set maximum line length */
|
||||
SPL_METHOD(FileObject, setMaxLineLen)
|
||||
SPL_METHOD(SplFileObject, setMaxLineLen)
|
||||
{
|
||||
long max_len;
|
||||
|
||||
|
@ -1198,25 +1198,25 @@ SPL_METHOD(FileObject, setMaxLineLen)
|
|||
intern->max_line_len = max_len;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto int FileObject::getMaxLineLen()
|
||||
/* {{{ proto int SplFileObject::getMaxLineLen()
|
||||
Get maximum line length */
|
||||
SPL_METHOD(FileObject, getMaxLineLen)
|
||||
SPL_METHOD(SplFileObject, getMaxLineLen)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
RETURN_LONG((long)intern->max_line_len);
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto bool hasChildren()
|
||||
/* {{{ proto bool SplFileObject>>hasChildren()
|
||||
Rturn false */
|
||||
SPL_METHOD(FileObject, hasChildren)
|
||||
SPL_METHOD(SplFileObject, hasChildren)
|
||||
{
|
||||
RETURN_FALSE;
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto bool FileObject::getChildren()
|
||||
/* {{{ proto bool SplFileObject::getChildren()
|
||||
Read NULL */
|
||||
SPL_METHOD(FileObject, getChildren)
|
||||
SPL_METHOD(SplFileObject, getChildren)
|
||||
{
|
||||
/* return NULL */
|
||||
} /* }}} */
|
||||
|
@ -1273,16 +1273,16 @@ static int spl_file_object_call(INTERNAL_FUNCTION_PARAMETERS, spl_file_object *i
|
|||
|
||||
/* {{{ FileFunction */
|
||||
#define FileFunction(func_name) \
|
||||
SPL_METHOD(FileObject, func_name) \
|
||||
SPL_METHOD(SplFileObject, func_name) \
|
||||
{ \
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC); \
|
||||
FileFunctionCall(func_name, NULL); \
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto array FileObject::fgetcsv([string delimiter [, string enclosure]])
|
||||
/* {{{ proto array SplFileObject::fgetcsv([string delimiter [, string enclosure]])
|
||||
Return current line as csv */
|
||||
SPL_METHOD(FileObject, fgetcsv)
|
||||
SPL_METHOD(SplFileObject, fgetcsv)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
zval *arg2 = NULL;
|
||||
|
@ -1298,14 +1298,14 @@ SPL_METHOD(FileObject, fgetcsv)
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool FileObject::flock(int operation [, int &wouldblock])
|
||||
/* {{{ proto bool SplFileObject::flock(int operation [, int &wouldblock])
|
||||
Portable file locking */
|
||||
FileFunction(flock)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool FileObject::fflush()
|
||||
/* {{{ proto bool SplFileObject::fflush()
|
||||
Flush the file */
|
||||
SPL_METHOD(FileObject, fflush)
|
||||
SPL_METHOD(SplFileObject, fflush)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
@ -1313,9 +1313,9 @@ SPL_METHOD(FileObject, fflush)
|
|||
} /* }}} */
|
||||
|
||||
|
||||
/* {{{ proto int FileObject::ftell()
|
||||
/* {{{ proto int SplFileObject::ftell()
|
||||
Return current file position */
|
||||
SPL_METHOD(FileObject, ftell)
|
||||
SPL_METHOD(SplFileObject, ftell)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
long ret = php_stream_tell(intern->stream);
|
||||
|
@ -1327,9 +1327,9 @@ SPL_METHOD(FileObject, ftell)
|
|||
}
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto int FileObject::fseek(int pos [, int whence = SEEK_SET])
|
||||
/* {{{ proto int SplFileObject::fseek(int pos [, int whence = SEEK_SET])
|
||||
Return current file position */
|
||||
SPL_METHOD(FileObject, fseek)
|
||||
SPL_METHOD(SplFileObject, fseek)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
long pos, whence = SEEK_SET;
|
||||
|
@ -1342,9 +1342,9 @@ SPL_METHOD(FileObject, fseek)
|
|||
RETURN_LONG(php_stream_seek(intern->stream, pos, whence));
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto int FileObject::fgetc()
|
||||
/* {{{ proto int SplFileObject::fgetc()
|
||||
Get a character form the file */
|
||||
SPL_METHOD(FileObject, fgetc)
|
||||
SPL_METHOD(SplFileObject, fgetc)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
char buf[2];
|
||||
|
@ -1367,9 +1367,9 @@ SPL_METHOD(FileObject, fgetc)
|
|||
}
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto string FileObject::fgetss([string allowable_tags])
|
||||
/* {{{ proto string SplFileObject::fgetss([string allowable_tags])
|
||||
Get a line from file pointer and strip HTML tags */
|
||||
SPL_METHOD(FileObject, fgetss)
|
||||
SPL_METHOD(SplFileObject, fgetss)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
zval *arg2 = NULL;
|
||||
|
@ -1384,18 +1384,18 @@ SPL_METHOD(FileObject, fgetss)
|
|||
zval_ptr_dtor(&arg2);
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto int FileObject::fpassthru()
|
||||
/* {{{ proto int SplFileObject::fpassthru()
|
||||
Output all remaining data from a file pointer */
|
||||
SPL_METHOD(FileObject, fpassthru)
|
||||
SPL_METHOD(SplFileObject, fpassthru)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
RETURN_LONG(php_stream_passthru(intern->stream));
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto bool FileObject::fscanf(string format [, string ...])
|
||||
/* {{{ proto bool SplFileObject::fscanf(string format [, string ...])
|
||||
Implements a mostly ANSI compatible fscanf() */
|
||||
SPL_METHOD(FileObject, fscanf)
|
||||
SPL_METHOD(SplFileObject, fscanf)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
|
@ -1406,9 +1406,9 @@ SPL_METHOD(FileObject, fscanf)
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto mixed FileObject::fwrite(string str [, int length])
|
||||
/* {{{ proto mixed SplFileObject::fwrite(string str [, int length])
|
||||
Binary-safe file write */
|
||||
SPL_METHOD(FileObject, fwrite)
|
||||
SPL_METHOD(SplFileObject, fwrite)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
char *str;
|
||||
|
@ -1438,14 +1438,14 @@ SPL_METHOD(FileObject, fwrite)
|
|||
RETURN_LONG(php_stream_write(intern->stream, str, str_len));
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto bool FileObject::fstat()
|
||||
/* {{{ proto bool SplFileObject::fstat()
|
||||
Stat() on a filehandle */
|
||||
FileFunction(fstat)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool FileObject::ftruncate(int size)
|
||||
/* {{{ proto bool SplFileObject::ftruncate(int size)
|
||||
Truncate file to 'size' length */
|
||||
SPL_METHOD(FileObject, ftruncate)
|
||||
SPL_METHOD(SplFileObject, ftruncate)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
long size;
|
||||
|
@ -1462,9 +1462,9 @@ SPL_METHOD(FileObject, ftruncate)
|
|||
RETURN_BOOL(0 == php_stream_truncate_set_size(intern->stream, size));
|
||||
} /* }}} */
|
||||
|
||||
/* {{{ proto void FileObject::seek(int line_pos)
|
||||
/* {{{ proto void SplFileObject::seek(int line_pos)
|
||||
Seek to specified line */
|
||||
SPL_METHOD(FileObject, seek)
|
||||
SPL_METHOD(SplFileObject, seek)
|
||||
{
|
||||
spl_file_object *intern = (spl_file_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
long line_pos;
|
||||
|
@ -1547,37 +1547,37 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_seek, 0, 0, 1)
|
|||
ZEND_END_ARG_INFO();
|
||||
|
||||
static zend_function_entry spl_file_object_class_functions[] = {
|
||||
SPL_ME(FileObject, __construct, arginfo_file_object___construct, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, getFilename, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, rewind, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, eof, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, valid, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, fgets, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, fgetcsv, arginfo_file_object_fgetcsv, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, flock, arginfo_file_object_flock, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, fflush, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, ftell, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, fseek, arginfo_file_object_fseek, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, fgetc, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, fpassthru, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, fgetss, arginfo_file_object_fgetss, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, fscanf, arginfo_file_object_fscanf, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, fwrite, arginfo_file_object_fwrite, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, fstat, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, ftruncate, arginfo_file_object_ftruncate, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, current, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, key, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, next, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, setFlags, arginfo_file_object_setFlags, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, getFlags, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, setMaxLineLen, arginfo_file_object_setMaxLineLen, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, getMaxLineLen, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, hasChildren, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, getChildren, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(FileObject, seek, arginfo_file_object_seek, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, __construct, arginfo_file_object___construct, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, getFilename, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, rewind, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, eof, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, valid, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, fgets, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, fgetcsv, arginfo_file_object_fgetcsv, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, flock, arginfo_file_object_flock, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, fflush, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, ftell, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, fseek, arginfo_file_object_fseek, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, fgetc, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, fpassthru, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, fgetss, arginfo_file_object_fgetss, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, fscanf, arginfo_file_object_fscanf, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, fwrite, arginfo_file_object_fwrite, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, fstat, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, ftruncate, arginfo_file_object_ftruncate, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, current, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, key, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, next, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, setFlags, arginfo_file_object_setFlags, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, getFlags, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, setMaxLineLen, arginfo_file_object_setMaxLineLen, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, getMaxLineLen, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, hasChildren, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, getChildren, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_ME(SplFileObject, seek, arginfo_file_object_seek, ZEND_ACC_PUBLIC)
|
||||
// mappings
|
||||
SPL_MA(FileObject, getCurrentLine, FileObject, fgets, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_MA(FileObject, __toString, FileObject, current, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_MA(SplFileObject, getCurrentLine, SplFileObject, fgets, NULL, ZEND_ACC_PUBLIC)
|
||||
SPL_MA(SplFileObject, __toString, SplFileObject, current, NULL, ZEND_ACC_PUBLIC)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
|
@ -1598,11 +1598,11 @@ PHP_MINIT_FUNCTION(spl_directory)
|
|||
|
||||
spl_ce_RecursiveDirectoryIterator->get_iterator = spl_ce_dir_tree_get_iterator;
|
||||
|
||||
REGISTER_SPL_STD_CLASS_EX(FileObject, spl_file_object_new, spl_file_object_class_functions);
|
||||
REGISTER_SPL_IMPLEMENTS(FileObject, RecursiveIterator);
|
||||
REGISTER_SPL_IMPLEMENTS(FileObject, SeekableIterator);
|
||||
REGISTER_SPL_STD_CLASS_EX(SplFileObject, spl_file_object_new, spl_file_object_class_functions);
|
||||
REGISTER_SPL_IMPLEMENTS(SplFileObject, RecursiveIterator);
|
||||
REGISTER_SPL_IMPLEMENTS(SplFileObject, SeekableIterator);
|
||||
|
||||
REGISTER_SPL_CLASS_CONST_LONG(FileObject, "DROP_NEW_LINE", SPL_FILE_OBJECT_DROP_NEW_LINE);
|
||||
REGISTER_SPL_CLASS_CONST_LONG(SplFileObject, "DROP_NEW_LINE", SPL_FILE_OBJECT_DROP_NEW_LINE);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
extern PHPAPI zend_class_entry *spl_ce_DirectoryIterator;
|
||||
extern PHPAPI zend_class_entry *spl_ce_RecursiveDirectoryIterator;
|
||||
extern PHPAPI zend_class_entry *spl_ce_FileObject;
|
||||
extern PHPAPI zend_class_entry *spl_ce_SplFileObject;
|
||||
|
||||
PHP_MINIT_FUNCTION(spl_directory);
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
--TEST--
|
||||
SPL: FileObject::seek'ing
|
||||
SPL: SplFileObject::seek'ing
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$o = new FileObject(dirname(__FILE__) . '/fileobject_001a.txt');
|
||||
$o = new SplFileObject(dirname(__FILE__) . '/fileobject_001a.txt');
|
||||
|
||||
var_dump($o->key());
|
||||
var_dump($o->current());
|
||||
$o->setFlags(FileObject::DROP_NEW_LINE);
|
||||
$o->setFlags(SplFileObject::DROP_NEW_LINE);
|
||||
var_dump($o->key());
|
||||
var_dump($o->current());
|
||||
var_dump($o->key());
|
||||
|
@ -31,8 +31,8 @@ foreach($o as $n => $l)
|
|||
}
|
||||
|
||||
echo "===B===\n";
|
||||
$o = new FileObject(dirname(__FILE__) . '/fileobject_001b.txt');
|
||||
$o->setFlags(FileObject::DROP_NEW_LINE);
|
||||
$o = new SplFileObject(dirname(__FILE__) . '/fileobject_001b.txt');
|
||||
$o->setFlags(SplFileObject::DROP_NEW_LINE);
|
||||
foreach($o as $n => $l)
|
||||
{
|
||||
var_dump($n, $l);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--TEST--
|
||||
SPL: FileObject::fgetc
|
||||
SPL: SplFileObject::fgetc
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
@ -7,7 +7,7 @@ function test($name)
|
|||
{
|
||||
echo "===$name===\n";
|
||||
|
||||
$o = new FileObject(dirname(__FILE__) . '/' . $name);
|
||||
$o = new SplFileObject(dirname(__FILE__) . '/' . $name);
|
||||
|
||||
var_dump($o->key());
|
||||
while(($c = $o->fgetc()) !== false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue