xref: /PHP-8.1/ext/spl/spl_functions.h (revision 01b3fc03)
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    | https://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    | Authors: Marcus Boerger <helly@php.net>                              |
14    +----------------------------------------------------------------------+
15  */
16 
17 #ifndef PHP_FUNCTIONS_H
18 #define PHP_FUNCTIONS_H
19 
20 #include "php.h"
21 
22 typedef zend_object* (*create_object_func_t)(zend_class_entry *class_type);
23 
24 #define REGISTER_SPL_CLASS_CONST_LONG(class_name, const_name, value) \
25 	zend_declare_class_constant_long(spl_ce_ ## class_name, const_name, sizeof(const_name)-1, (zend_long)value);
26 
27 /* sub: whether to allow subclasses/interfaces
28    allow = 0: allow all classes and interfaces
29    allow > 0: allow all that match and mask ce_flags
30    allow < 0: disallow all that match and mask ce_flags
31  */
32 void spl_add_class_name(zval * list, zend_class_entry * pce, int allow, int ce_flags);
33 void spl_add_interfaces(zval * list, zend_class_entry * pce, int allow, int ce_flags);
34 void spl_add_traits(zval * list, zend_class_entry * pce, int allow, int ce_flags);
35 int spl_add_classes(zend_class_entry *pce, zval *list, int sub, int allow, int ce_flags);
36 
37 /* caller must efree(return) */
38 zend_string *spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, int prop_len);
39 
40 #endif /* PHP_FUNCTIONS_H */
41