From 9df186180f25313d2182ef7a0bb807875888892c Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Thu, 13 Mar 2014 09:50:10 +0100 Subject: added serializable class (but not yet implemented it) --- include/classbase.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'include/classbase.h') diff --git a/include/classbase.h b/include/classbase.h index 814feaf..cc69a91 100644 --- a/include/classbase.h +++ b/include/classbase.h @@ -20,6 +20,8 @@ struct _zend_object_value; struct _zend_object_handlers; struct _zend_class_entry; +struct _zend_serialize_data; +struct _zend_unserialize_data; union _zend_function; /** @@ -131,6 +133,12 @@ public: */ virtual bool traversable() const = 0; + /** + * Is this a serializable class? + * @return bool + */ + virtual bool serializable() const = 0; + /** * Initialize the class, given its name * @@ -425,6 +433,18 @@ private: */ static int compare(struct _zval_struct *object1, struct _zval_struct *object2); + /** + * Methods that are called to serialize/unserialize an object + * @param object The object to be serialized + * @param entry The class entry to which the object belongs + * @param buffer Buffer in which to store the data + * @param buf_len Size of the bufffer + * @param data Structure describing the serialize/unserialize data + * @return int + */ + static int serialize(struct _zval_struct *object, unsigned char **buffer, zend_uint *buf_len, struct _zend_serialize_data *data); + static int unserialize(struct _zval_struct **object, struct _zend_class_entry *entry, const unsigned char *buffer, zend_uint buf_len, struct _zend_unserialize_data *data); + /** * Name of the class * @var string -- cgit v1.2.3