root/ext/spl/spl_functions.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2    +----------------------------------------------------------------------+
   3    | PHP Version 7                                                        |
   4    +----------------------------------------------------------------------+
   5    | Copyright (c) 1997-2016 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    | Authors: Marcus Boerger <helly@php.net>                              |
  16    +----------------------------------------------------------------------+
  17  */
  18 
  19 /* $Id$ */
  20 
  21 #ifndef PHP_FUNCTIONS_H
  22 #define PHP_FUNCTIONS_H
  23 
  24 #include "php.h"
  25 
  26 typedef zend_object* (*create_object_func_t)(zend_class_entry *class_type);
  27 
  28 #define REGISTER_SPL_STD_CLASS(class_name, obj_ctor) \
  29         spl_register_std_class(&spl_ce_ ## class_name, # class_name, obj_ctor, NULL);
  30 
  31 #define REGISTER_SPL_STD_CLASS_EX(class_name, obj_ctor, funcs) \
  32         spl_register_std_class(&spl_ce_ ## class_name, # class_name, obj_ctor, funcs);
  33 
  34 #define REGISTER_SPL_SUB_CLASS_EX(class_name, parent_class_name, obj_ctor, funcs) \
  35         spl_register_sub_class(&spl_ce_ ## class_name, spl_ce_ ## parent_class_name, # class_name, obj_ctor, funcs);
  36 
  37 #define REGISTER_SPL_INTERFACE(class_name) \
  38         spl_register_interface(&spl_ce_ ## class_name, # class_name, spl_funcs_ ## class_name);
  39 
  40 #define REGISTER_SPL_IMPLEMENTS(class_name, interface_name) \
  41         zend_class_implements(spl_ce_ ## class_name, 1, spl_ce_ ## interface_name);
  42 
  43 #define REGISTER_SPL_ITERATOR(class_name) \
  44         zend_class_implements(spl_ce_ ## class_name, 1, zend_ce_iterator);
  45 
  46 #define REGISTER_SPL_PROPERTY(class_name, prop_name, prop_flags) \
  47         spl_register_property(spl_ce_ ## class_name, prop_name, sizeof(prop_name)-1, prop_flags);
  48 
  49 #define REGISTER_SPL_CLASS_CONST_LONG(class_name, const_name, value) \
  50         zend_declare_class_constant_long(spl_ce_ ## class_name, const_name, sizeof(const_name)-1, (zend_long)value);
  51 
  52 void spl_register_std_class(zend_class_entry ** ppce, char * class_name, create_object_func_t ctor, const zend_function_entry * function_list);
  53 void spl_register_sub_class(zend_class_entry ** ppce, zend_class_entry * parent_ce, char * class_name, create_object_func_t ctor, const zend_function_entry * function_list);
  54 void spl_register_interface(zend_class_entry ** ppce, char * class_name, const zend_function_entry *functions);
  55 
  56 void spl_register_property( zend_class_entry * class_entry, char *prop_name, int prop_name_len, int prop_flags);
  57 
  58 /* sub: whether to allow subclasses/interfaces
  59    allow = 0: allow all classes and interfaces
  60    allow > 0: allow all that match and mask ce_flags
  61    allow < 0: disallow all that match and mask ce_flags
  62  */
  63 void spl_add_class_name(zval * list, zend_class_entry * pce, int allow, int ce_flags);
  64 void spl_add_interfaces(zval * list, zend_class_entry * pce, int allow, int ce_flags);
  65 void spl_add_traits(zval * list, zend_class_entry * pce, int allow, int ce_flags);
  66 int spl_add_classes(zend_class_entry *pce, zval *list, int sub, int allow, int ce_flags);
  67 
  68 /* caller must efree(return) */
  69 zend_string *spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, int prop_len);
  70 
  71 #define SPL_ME(class_name, function_name, arg_info, flags) \
  72         PHP_ME( spl_ ## class_name, function_name, arg_info, flags)
  73 
  74 #define SPL_ABSTRACT_ME(class_name, function_name, arg_info) \
  75         ZEND_ABSTRACT_ME( spl_ ## class_name, function_name, arg_info)
  76 
  77 #define SPL_METHOD(class_name, function_name) \
  78         PHP_METHOD(spl_ ## class_name, function_name)
  79 
  80 #define SPL_MA(class_name, function_name, alias_class, alias_function, arg_info, flags) \
  81         PHP_MALIAS(spl_ ## alias_class, function_name, alias_function, arg_info, flags)
  82 #endif /* PHP_FUNCTIONS_H */
  83 
  84 /*
  85  * Local Variables:
  86  * c-basic-offset: 4
  87  * tab-width: 4
  88  * End:
  89  * vim600: fdm=marker
  90  * vim: noet sw=4 ts=4
  91  */

/* [<][>][^][v][top][bottom][index][help] */