1 /*
2   +----------------------------------------------------------------------+
3   | PHP Version 7                                                        |
4   +----------------------------------------------------------------------+
5   | Copyright (c) The PHP Group                                          |
6   +----------------------------------------------------------------------+
7   | This source file is subject to version 3.01 of the PHP license,      |
8   | that is bundled with this package in the file LICENSE, and is        |
9   | available through the world-wide-web at the following url:           |
10   | http://www.php.net/license/3_01.txt                                  |
11   | If you did not receive a copy of the PHP license and are unable to   |
12   | obtain it through the world-wide-web, please send a note to          |
13   | license@php.net so we can mail you a copy immediately.               |
14   +----------------------------------------------------------------------+
15   | Author: Sterling Hughes <sterling@php.net>                           |
16   |         Marcus Boerger <helly@php.net>                               |
17   |         Rob Richards <rrichards@php.net>                             |
18   +----------------------------------------------------------------------+
19 */
20 
21 #ifndef PHP_SIMPLEXML_EXPORTS_H
22 #define PHP_SIMPLEXML_EXPORTS_H
23 
24 #include "php_simplexml.h"
25 
26 #define SKIP_TEXT(__p) \
27 	if ((__p)->type == XML_TEXT_NODE) { \
28 		goto next_iter; \
29 	}
30 
31 #define GET_NODE(__s, __n) { \
32 	if ((__s)->node && (__s)->node->node) { \
33 		__n = (__s)->node->node; \
34 	} else { \
35 		__n = NULL; \
36 		php_error_docref(NULL, E_WARNING, "Node no longer exists"); \
37 	} \
38 }
39 
40 PHP_SXE_API zend_object *sxe_object_new(zend_class_entry *ce);
41 
php_sxe_fetch_object(zend_object * obj)42 static inline php_sxe_object *php_sxe_fetch_object(zend_object *obj) /* {{{ */ {
43 	return (php_sxe_object *)((char*)(obj) - XtOffsetOf(php_sxe_object, zo));
44 }
45 /* }}} */
46 
47 #define Z_SXEOBJ_P(zv) php_sxe_fetch_object(Z_OBJ_P((zv)))
48 
49 typedef struct {
50 	zend_object_iterator  intern;
51 	php_sxe_object        *sxe;
52 } php_sxe_iterator;
53 
54 PHP_SXE_API void php_sxe_rewind_iterator(php_sxe_object *sxe);
55 PHP_SXE_API void php_sxe_move_forward_iterator(php_sxe_object *sxe);
56 
57 #endif /* PHP_SIMPLEXML_EXPORTS_H */
58