xref: /PHP-7.4/ext/xmlwriter/php_xmlwriter.h (revision 92ac598a)
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: Rob Richards <rrichards@php.net>                             |
16   |         Pierre-A. Joye <pajoye@php.net>                              |
17   +----------------------------------------------------------------------+
18 */
19 
20 #ifndef PHP_XMLWRITER_H
21 #define PHP_XMLWRITER_H
22 
23 extern zend_module_entry xmlwriter_module_entry;
24 #define phpext_xmlwriter_ptr &xmlwriter_module_entry
25 
26 #include "php_version.h"
27 #define PHP_XMLWRITER_VERSION PHP_VERSION
28 
29 #ifdef ZTS
30 #include "TSRM.h"
31 #endif
32 
33 #include <libxml/tree.h>
34 #include <libxml/xmlwriter.h>
35 #include <libxml/uri.h>
36 
37 /* Resource struct, not the object :) */
38 typedef struct _xmlwriter_object {
39 	xmlTextWriterPtr ptr;
40 	xmlBufferPtr output;
41 } xmlwriter_object;
42 
43 
44 /* Extends zend object */
45 typedef struct _ze_xmlwriter_object {
46 	xmlwriter_object *xmlwriter_ptr;
47 	zend_object std;
48 } ze_xmlwriter_object;
49 
php_xmlwriter_fetch_object(zend_object * obj)50 static inline ze_xmlwriter_object *php_xmlwriter_fetch_object(zend_object *obj) {
51 	return (ze_xmlwriter_object *)((char*)(obj) - XtOffsetOf(ze_xmlwriter_object, std));
52 }
53 
54 #define Z_XMLWRITER_P(zv) php_xmlwriter_fetch_object(Z_OBJ_P((zv)))
55 
56 #endif	/* PHP_XMLWRITER_H */
57