From 8f24af4c28e74ef1769aef6ab00c480e09be7453 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Sun, 2 Mar 2014 23:28:10 +0100 Subject: work in progress to support implementing SPL interfaces, disabled the _self variable in Php::Base because by having each object keeping a reference to itself, the refcounter never reached zero and the object was thus never destructed, checking if we can get a new implementation one way or another --- include/base.h | 108 +++++++++++++++++++++++---------------------------------- 1 file changed, 43 insertions(+), 65 deletions(-) (limited to 'include/base.h') diff --git a/include/base.h b/include/base.h index 7d7be98..46f5678 100644 --- a/include/base.h +++ b/include/base.h @@ -22,6 +22,11 @@ protected: Base() {} public: + + // @todo should we delete the copy and move operators because we do not + // allow the CPP code to make copies of itself? + + /** * Virtual destructor */ @@ -31,122 +36,95 @@ public: * Convert the object to a Php::Value object (how it is used externally) * @return Object */ - Object &value() - { - return _self; - } +// Object value(); /** * Convert the object to a Php::Value object (how it is used externally) * @return Object */ - const Object &value() const - { - return _self; - } +// Object value() const; /** * Get access to a property by name using the [] operator * @param string - * @return Value + * @return HashMember */ - Value operator[](const char *name) - { - return _self[name]; - } +// HashMember operator[](const char *name) +// { +// return value()[name]; +// } /** * Alternative way to access a property using the [] operator * @param string - * @return Value + * @return HashMember */ - Value operator[](const std::string &name) - { - return _self[name]; - } +// HashMember operator[](const std::string &name) +// { +// return value()[name]; +// } /** * Retrieve a property by name * @param string - * @return Value + * @return HashMember */ - Value property(const char *name) - { - return _self[name]; - } +// HashMember property(const char *name) +// { +// return value()[name]; +// } /** * Retrieve a property by name * @param string - * @return Value + * @return HashMember */ - Value property(const std::string &name) - { - return _self[name]; - } +// HashMember property(const std::string &name) +// { +// return value()[name]; +// } /** * Get access to a property by name using the [] operator * @param string * @return Value */ - Value operator[](const char *name) const - { - return _self[name]; - } +// Value operator[](const char *name) const +// { +// return value()[name]; +// } /** * Alternative way to access a property using the [] operator * @param string * @return Value */ - Value operator[](const std::string &name) const - { - return _self[name]; - } +// Value operator[](const std::string &name) const +// { +// return value()[name]; +// } /** * Retrieve a property by name * @param string * @return Value */ - Value property(const char *name) const - { - return _self[name]; - } +// Value property(const char *name) const +// { +// return value()[name]; +// } /** * Retrieve a property by name * @param string * @return Value */ - Value property(const std::string &name) const - { - return _self[name]; - } +// Value property(const std::string &name) const +// { +// return value()[name]; +// } -protected: - /** - * The zend_object - * @var Value - */ - Object _self; - private: - /** - * Private method to assign the zend object - * @param zend_object - */ - void assign(Value &&object) - { - // copy pointer - _self = std::move(object); - } - - /** - * ClassBase has access to private data - */ - friend class ClassBase; }; -- cgit v1.2.3