summaryrefslogtreecommitdiff
path: root/src/base.cpp
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-02 11:33:53 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-02 11:33:53 +0100
commit52fe0c39457421e075959179ee6b64a20b96f0d9 (patch)
treee6dd000114d104bf6286d74682feb694b3cb97a3 /src/base.cpp
parentfa02aa127d2c4261d15123829e44f6d997444abc (diff)
types are not a C++11 class, introduced FixedValue class that can not change type, and implemented both Object and Array to make use of that type, implemented - but not yet tested - Base::value() method
Diffstat (limited to 'src/base.cpp')
-rw-r--r--src/base.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/base.cpp b/src/base.cpp
index 60e8c2d..b5f2f86 100644
--- a/src/base.cpp
+++ b/src/base.cpp
@@ -13,6 +13,20 @@
namespace Php {
/**
+ * Convert the object to a Php::Value object (how it is used externally)
+ * @return Value
+ */
+Value Base::value() const
+{
+ // because the object is stored in a MixedObject, we know that the zend_object
+ // structure is right in front of the this pointer
+ zend_object *object = (zend_object *)this - sizeof(zend_object);
+
+ // wrap the properties table, as a reference
+ return Object(*object->properties_table, true);
+}
+
+/**
* End of namespace
*/
}