Property proxy API
A facility to manage extension object properties tied to C-struct members
php_propro_api.h File Reference
#include "php_propro.h"
Include dependency graph for php_propro_api.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  php_property_proxy
 The internal property proxy. More...
 
struct  php_property_proxy_object
 The userland object. More...
 

Typedefs

typedef struct php_property_proxy php_property_proxy_t
 
typedef struct php_property_proxy_object php_property_proxy_object_t
 

Functions

php_property_proxy_tphp_property_proxy_init (zval *container, zend_string *member)
 Create a property proxy. More...
 
void php_property_proxy_free (php_property_proxy_t **proxy)
 Destroy and free a property proxy. More...
 
zend_class_entry * php_property_proxy_get_class_entry (void)
 Get the zend_class_entry of php\PropertyProxy. More...
 
zend_object * php_property_proxy_object_new (zend_class_entry *ce)
 Instantiate a new php\PropertyProxy. More...
 
php_property_proxy_object_tphp_property_proxy_object_new_ex (zend_class_entry *ce, php_property_proxy_t *proxy)
 Instantiate a new php\PropertyProxy with proxy. More...
 

Data Structure Documentation

struct php_property_proxy

The internal property proxy.

Container for the object/array holding the proxied property.

Data Fields
zval container The container holding the property.
zend_string * member The name of the proxied property.
struct php_property_proxy_object

The userland object.

Return an object instance of php\PropertyProxy to make your C-struct member accessible by reference from PHP userland.

Example:

static zval *my_read_prop(zval *object, zval *member, int type, void **cache_slot, zval *tmp)
{
zval *return_value;
zend_string *member_name = zval_get_string(member);
my_prophandler_t *handler = my_get_prophandler(member_name);
if (!handler || type == BP_VAR_R || type == BP_VAR_IS) {
return_value = zend_get_std_object_handlers()->read_property(object, member, type, cache_slot, tmp);
if (handler) {
handler->read(object, tmp);
zval_ptr_dtor(return_value);
ZVAL_COPY_VALUE(return_value, tmp);
}
} else {
return_value = php_property_proxy_zval(object, member_name);
}
zend_string_release(member_name);
return return_value;
}
Collaboration diagram for php_property_proxy_object:
Data Fields
zval parent Any parent property proxy object.
php_property_proxy_t * proxy The actual property proxy.
zend_object zo The std zend_object.

Typedef Documentation

Function Documentation

void php_property_proxy_free ( php_property_proxy_t **  proxy)

Destroy and free a property proxy.

The destruction of the property proxy object calls this.

Parameters
proxya pointer to the allocated property proxy
zend_class_entry* php_property_proxy_get_class_entry ( void  )

Get the zend_class_entry of php\PropertyProxy.

Returns
the class entry pointer
php_property_proxy_t* php_property_proxy_init ( zval *  container,
zend_string *  member 
)

Create a property proxy.

The property proxy will forward reads and writes to itself to the proxied property with name member_str of container.

Parameters
containerthe container holding the property
memberthe name of the proxied property
Returns
a new property proxy
zend_object* php_property_proxy_object_new ( zend_class_entry *  ce)

Instantiate a new php\PropertyProxy.

Parameters
cethe property proxy or derived class entry
Returns
the zend object

Here is the call graph for this function:

php_property_proxy_object_t* php_property_proxy_object_new_ex ( zend_class_entry *  ce,
php_property_proxy_t proxy 
)

Instantiate a new php\PropertyProxy with proxy.

Parameters
cethe property proxy or derived class entry
proxythe internal property proxy
Returns
the property proxy

Referenced by php_property_proxy_object_new().

Here is the caller graph for this function: