X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=v1.0.x%2Fphp__propro__api_8h.html;h=3158939905f0e0f11cb450bdfb4667dbe5c41028;hb=ea5470824da8c22c682a187bdc62a906af18e33d;hp=d0cf0c3aa2bd26bd9710b62ed1f3180277dcf497;hpb=1aa3f240d380d32770b6f1018a2f0903583a06c2;p=m6w6%2Fext-propro diff --git a/v1.0.x/php__propro__api_8h.html b/v1.0.x/php__propro__api_8h.html index d0cf0c3..3158939 100644 --- a/v1.0.x/php__propro__api_8h.html +++ b/v1.0.x/php__propro__api_8h.html @@ -213,17 +213,42 @@ The name of the proxied property.
The userland object.
Return an object instance of php\PropertyProxy to make your C-struct member accessible by reference from PHP userland.
-Example:
~~~~~~~~~~{.c} static zval *my_read_prop(zval *object, zval *member, int type, zend_literal *key TSRMLS_DC) { my_object_t *obj = zend_object_store_get_object(object TSRMLS_CC); my_prophandler_t *handler; zval *return_value, *copy = my_cast(IS_STRING, member);
-if (SUCCESS == my_get_prophandler(Z_STRVAL_P(copy), Z_STRLEN_P(copy), &handler)) { ALLOC_ZVAL(return_value); Z_SET_REFCOUNT_P(return_value, 0); Z_UNSET_ISREF_P(return_value);
-if (type == BP_VAR_R) { handler->read(obj, return_value TSRMLS_CC); } else { // // This is the interesting part // php_property_proxy_t *proxy; zend_object_value proxy_ov; zend_class_entry *proxy_ce;
-proxy = php_property_proxy_init(object, Z_STRVAL_P(copy), Z_STRLEN_P(copy) TSRMLS_CC); proxy_ce = php_property_proxy_get_class_entry(); proxy_ov = php_property_proxy_object_new_ex(proxy_ce, proxy, NULL TSRMLS_CC); RETVAL_OBJVAL(proxy_ov, 0); } } else { zend_object_handlers *oh = zend_get_std_object_handlers(); return_value = oh->read_property(object, member, type, key TSRMLS_CC); }
-zval_ptr_dtor(©);
-return return_value; }
-Example: