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