summaryrefslogtreecommitdiff
path: root/zend/objectimpl.h
diff options
context:
space:
mode:
Diffstat (limited to 'zend/objectimpl.h')
-rw-r--r--zend/objectimpl.h50
1 files changed, 25 insertions, 25 deletions
diff --git a/zend/objectimpl.h b/zend/objectimpl.h
index 4d20f3c..110491b 100644
--- a/zend/objectimpl.h
+++ b/zend/objectimpl.h
@@ -32,16 +32,16 @@ private:
* @var zend_object
*/
zend_object php;
-
+
/**
* Pointer to ourselves
* @var ObjectImpl
*/
ObjectImpl *self;
-
-
+
+
} *_mixed;
-
+
/**
* Pointer to the C++ implementation
* @var Base
@@ -69,22 +69,22 @@ public:
{
// allocate a mixed object (for some reason this does not have to be deallocated)
_mixed = (MixedObject *)emalloc(sizeof(MixedObject));
-
+
// copy properties to the mixed object
_mixed->php.ce = entry;
_mixed->self = this;
-
+
// store the c++ object
_object = base;
-
+
// initialize the object
zend_object_std_init(&_mixed->php, entry TSRMLS_CC);
-
+
#if PHP_VERSION_ID < 50399
// tmp variable
zval *tmp;
-
+
// initialize the properties, php 5.3 way
zend_hash_copy(_mixed->php.properties, &entry->default_properties, (copy_ctor_func_t) zval_property_ctor, &tmp, sizeof(zval*));
@@ -93,7 +93,7 @@ public:
// version higher than 5.3 have an easier way to initialize
object_properties_init(&_mixed->php, entry);
-#endif
+#endif
#ifdef ZTS
@@ -101,15 +101,15 @@ public:
// an extra parameter holding thread information
using DestructType = void(*)(zend_object*,unsigned int,void***);
using FreeType = void(*)(zend_object*,void***);
-
+
#else
// not in thread mode: no special parameter for the tsrm_ls variable
using DestructType = void(*)(zend_object*, unsigned int);
using FreeType = void(*)(zend_object*);
-
+
#endif
-
+
// store the two destruct methods in temporary vars
DestructType destructMethod = &ClassImpl::destructObject;
FreeType freeMethod = &ClassImpl::freeObject;
@@ -117,10 +117,10 @@ public:
// the destructor and clone handlers are set to NULL. I dont know why, but they do not
// seem to be necessary...
_handle = zend_objects_store_put(php(), (zend_objects_store_dtor_t)destructMethod, (zend_objects_free_object_storage_t)freeMethod, NULL TSRMLS_CC);
-
+
// set the initial refcount (if it is different than one, because one is the default)
if (refcount != 1) EG(objects_store).object_buckets[_handle].bucket.obj.refcount = refcount;
-
+
// the object may remember that we are its implementation object
base->_impl = this;
}
@@ -142,11 +142,11 @@ public:
{
// pass on to the default destructor
zend_objects_free_object_storage(php() TSRMLS_CC);
-
+
// destruct the object
delete this;
}
-
+
/**
* Find the object based on a zval
* @param val Zval object
@@ -157,7 +157,7 @@ public:
{
// retrieve the old object, which we are going to copy
MixedObject *object = (MixedObject *)zend_object_store_get_object(val TSRMLS_CC);
-
+
// done
return object->self;
}
@@ -170,30 +170,30 @@ public:
static ObjectImpl *find(const zend_object *object)
{
// retrieve the old object, which we are going to copy
- const MixedObject *mixed = (MixedObject *)object;
-
+ const MixedObject *mixed = (const MixedObject *)object;
+
// done
return mixed->self;
}
-
+
/**
* Retrieve the base class of the original C++ object
* @return Base
*/
- Base *object()
+ Base *object() const
{
return _object;
}
-
+
/**
* Pointer to the PHP object
* @return zend_object
*/
- zend_object *php()
+ zend_object *php() const
{
return &_mixed->php;
}
-
+
/**
* Retrieve the handle object
* @return int