summaryrefslogtreecommitdiff
path: root/include/classbase.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-04 18:21:58 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-04 18:21:58 +0100
commitc028e8f932cc4206ab8446409693fba8dfe18ffb (patch)
tree4ffe8a5d77888cff291eb7dd412bbd03e51c6f29 /include/classbase.h
parent200952ad4004f6ee5527598622505adbe84df8af (diff)
Php::Value and Php::Object classes can now be used to wrap around Php::Base objects
Diffstat (limited to 'include/classbase.h')
-rw-r--r--include/classbase.h60
1 files changed, 21 insertions, 39 deletions
diff --git a/include/classbase.h b/include/classbase.h
index a380840..8a691fa 100644
--- a/include/classbase.h
+++ b/include/classbase.h
@@ -15,6 +15,11 @@
*/
/**
+ * Forward declarations
+ */
+struct _zend_object_value;
+
+/**
* Set up namespace
*/
namespace Php {
@@ -82,45 +87,6 @@ public:
/**
* Construct a new instance of the object
- * @param value
- * @return Base
- */
- Base* construct(const struct _zend_object_value &value)
- {
- // construct the base
- auto *result = construct();
- if (!result) return nullptr;
-
- // assign the zend object to it
- // @todo fix this
-// result->assign(value);
-
- // done
- return result;
- }
-
- /**
- * Construct a clone of the object
- * @param orig
- * @param value
- * @return Base
- */
- Base* clone(Base *orig, const struct _zend_object_value &value)
- {
- // construct the base
- auto *result = clone(orig);
- if (!result) return nullptr;
-
- // assign the zend object to it
- // @todo fix this
-// result->assign(value);
-
- // done
- return result;
- }
-
- /**
- * Construct a new instance of the object
* @return Base
*/
virtual Base* construct() = 0;
@@ -144,6 +110,7 @@ public:
* @param ns Namespace name
*/
void initialize(const std::string &ns);
+
protected:
/**
@@ -232,6 +199,21 @@ private:
const struct _zend_function_entry *entries();
/**
+ * Static member functions to clone objects based on this class
+ * @param val The object to be cloned
+ * @return zend_object_value Object info
+ */
+ static struct _zend_object_value cloneObject(struct _zval_struct *val);
+
+ /**
+ * Function that is called when an instance of the class needs to be created.
+ * This function will create the C++ class, and the PHP object
+ * @param entry Pointer to the class information
+ * @return zend_object_value The newly created object
+ */
+ static struct _zend_object_value createObject(struct _zend_class_entry *entry);
+
+ /**
* Name of the class
* @var string
*/