Back to index

php5  5.3.10
Functions | Variables
sxe.c File Reference
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "zend_interfaces.h"
#include "ext/spl/php_spl.h"
#include "ext/spl/spl_iterators.h"
#include "sxe.h"
#include "php_simplexml_exports.h"

Go to the source code of this file.

Functions

 PHP_METHOD (ce_SimpleXMLIterator, rewind)
 PHP_METHOD (ce_SimpleXMLIterator, valid)
 PHP_METHOD (ce_SimpleXMLIterator, current)
 PHP_METHOD (ce_SimpleXMLIterator, key)
 PHP_METHOD (ce_SimpleXMLIterator, next)
 PHP_METHOD (ce_SimpleXMLIterator, hasChildren)
 PHP_METHOD (ce_SimpleXMLIterator, getChildren)
 PHP_MINIT_FUNCTION (sxe)

Variables

zend_class_entry * ce_SimpleXMLIterator = NULL
zend_class_entry * ce_SimpleXMLElement
static const zend_function_entry funcs_SimpleXMLIterator []

Function Documentation

PHP_METHOD ( ce_SimpleXMLIterator  ,
rewind   
)

Definition at line 41 of file sxe.c.

{
       php_sxe_iterator iter;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       iter.sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
       ce_SimpleXMLElement->iterator_funcs.funcs->rewind((zend_object_iterator*)&iter TSRMLS_CC);
}

Here is the call graph for this function:

PHP_METHOD ( ce_SimpleXMLIterator  ,
valid   
)

Definition at line 56 of file sxe.c.

Here is the call graph for this function:

PHP_METHOD ( ce_SimpleXMLIterator  ,
current   
)

Definition at line 70 of file sxe.c.

{
       php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       if (!sxe->iter.data) {
              return; /* return NULL */
       }

       RETURN_ZVAL(sxe->iter.data, 1, 0);
}

Here is the call graph for this function:

PHP_METHOD ( ce_SimpleXMLIterator  ,
key   
)

Definition at line 88 of file sxe.c.

{
       xmlNodePtr curnode;
       php_sxe_object *intern;
       php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       if (!sxe->iter.data) {
              RETURN_FALSE;
       }

       intern = (php_sxe_object *)zend_object_store_get_object(sxe->iter.data TSRMLS_CC);
       if (intern != NULL && intern->node != NULL) {
              curnode = (xmlNodePtr)((php_libxml_node_ptr *)intern->node)->node;
              RETURN_STRINGL((char*)curnode->name, xmlStrlen(curnode->name), 1);
       }
    
       RETURN_FALSE;
}

Here is the call graph for this function:

PHP_METHOD ( ce_SimpleXMLIterator  ,
next   
)

Definition at line 114 of file sxe.c.

{
       php_sxe_iterator iter;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       iter.sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
       ce_SimpleXMLElement->iterator_funcs.funcs->move_forward((zend_object_iterator*)&iter TSRMLS_CC);
}

Here is the call graph for this function:

PHP_METHOD ( ce_SimpleXMLIterator  ,
hasChildren   
)

Definition at line 129 of file sxe.c.

{
       php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
       php_sxe_object *child;
       xmlNodePtr      node;
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       if (!sxe->iter.data || sxe->iter.type == SXE_ITER_ATTRLIST) {
              RETURN_FALSE;
       }
       child = php_sxe_fetch_object(sxe->iter.data TSRMLS_CC);

       GET_NODE(child, node);
       if (node) {
              node = node->children;
       }
       while (node && node->type != XML_ELEMENT_NODE) {
              node = node->next;
       }
       RETURN_BOOL(node ? 1 : 0);
}

Here is the call graph for this function:

PHP_METHOD ( ce_SimpleXMLIterator  ,
getChildren   
)

Definition at line 157 of file sxe.c.

{
       php_sxe_object *sxe = php_sxe_fetch_object(getThis() TSRMLS_CC);
       
       if (zend_parse_parameters_none() == FAILURE) {
              return;
       }

       if (!sxe->iter.data || sxe->iter.type == SXE_ITER_ATTRLIST) {
              return; /* return NULL */
       }
       RETURN_ZVAL(sxe->iter.data, 1, 0);
}

Here is the call graph for this function:

PHP_MINIT_FUNCTION ( sxe  )

Definition at line 188 of file sxe.c.

{
       zend_class_entry **pce;
       zend_class_entry sxi;

       if (zend_hash_find(CG(class_table), "simplexmlelement", sizeof("SimpleXMLElement"), (void **) &pce) == FAILURE) {
              ce_SimpleXMLElement  = NULL;
              ce_SimpleXMLIterator = NULL;
              return SUCCESS; /* SimpleXML must be initialized before */
       }

       ce_SimpleXMLElement = *pce;

       INIT_CLASS_ENTRY_EX(sxi, "SimpleXMLIterator", strlen("SimpleXMLIterator"), funcs_SimpleXMLIterator);
       ce_SimpleXMLIterator = zend_register_internal_class_ex(&sxi, ce_SimpleXMLElement, NULL TSRMLS_CC);
       ce_SimpleXMLIterator->create_object = ce_SimpleXMLElement->create_object;

       zend_class_implements(ce_SimpleXMLIterator TSRMLS_CC, 1, spl_ce_RecursiveIterator);
       zend_class_implements(ce_SimpleXMLIterator TSRMLS_CC, 1, spl_ce_Countable);

       return SUCCESS;
}

Here is the call graph for this function:


Variable Documentation

zend_class_entry* ce_SimpleXMLElement

Definition at line 35 of file sxe.c.

zend_class_entry* ce_SimpleXMLIterator = NULL

Definition at line 34 of file sxe.c.

Initial value:
 {






       PHP_ME(ce_SimpleXMLIterator, getChildren,            arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
       {NULL, NULL, NULL}
}

Definition at line 176 of file sxe.c.