diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-13 09:45:02 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-13 09:45:02 +0100 |
commit | 01fa31d24d6669ee30ccb897a0a7f438bcbe59f0 (patch) | |
tree | 27d79fae4c47bd6524f8b482039e78a696d98795 /include | |
parent | 5ecddd36d9428042383b977851837208af6ea80b (diff) |
introduced serializable interface, and first setup for callback methods
Diffstat (limited to 'include')
-rw-r--r-- | include/serializable.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/include/serializable.h b/include/serializable.h new file mode 100644 index 0000000..67934a9 --- /dev/null +++ b/include/serializable.h @@ -0,0 +1,51 @@ +/** + * Serializable interface + * + * This interface can be implemented to make an object that can be passed to + * the PHP serialize() and unserialize() methods. + * + * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com> + * @copyright 2014 Copernica BV + */ + +/** + * Set up namespace + */ +namespace Php { + +/** + * Class definition + */ +class Serializable +{ +public: + /** + * Method to serialize the object + * + * This method should return a string representation of the object that + * can be passed to the serialize() method and that will revive the object + * + * @return Php::Value + */ + virtual Php::Value serialize() = 0; + + /** + * Unserialize the object + * + * This method is called as an alternative __construct() method to initialize + * the object. The passed in string parameter in in the format earlier returned + * by a call to serialize() + * + * @param input String to parse + * @param size Size of the string + */ + virtual void unserialize(const char *input, size_t size) = 0; +}; + +/** + * End namespace + */ +} + + +
\ No newline at end of file |