summaryrefslogtreecommitdiff
path: root/include/class.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-02 23:28:10 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-02 23:28:10 +0100
commit8f24af4c28e74ef1769aef6ab00c480e09be7453 (patch)
treec73b7de11abbdd8ed2d3f3fa5b63fdd2a1409cb8 /include/class.h
parentf7dcf5d81fa1e43533c786d9443e5222398dc8b9 (diff)
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
Diffstat (limited to 'include/class.h')
-rw-r--r--include/class.h27
1 files changed, 13 insertions, 14 deletions
diff --git a/include/class.h b/include/class.h
index 851de8d..8bfcad4 100644
--- a/include/class.h
+++ b/include/class.h
@@ -16,11 +16,6 @@
*/
/**
- * Forward declarations
- */
-struct _zend_class_entry;
-
-/**
* Set up namespace
*/
namespace Php {
@@ -40,7 +35,11 @@ public:
*
* @param name Name of the class
*/
- Class(const char *name) : ClassBase(name) {}
+ Class(const char *name) : ClassBase(name)
+ {
+ // check for special classes
+ if (std::is_base_of<Countable, T>::value) ClassBase::interface(Countable::implementation());
+ }
/**
* Copy constructor
@@ -74,14 +73,14 @@ public:
* @param flags Optional flags
* @param args Argument descriptions
*/
- void method(const char *name, void(T::*method)(), int flags, const Arguments &args = {}) { ClassBase::method(name, static_cast<method_callback_0>(method), flags, args); }
- void method(const char *name, void(T::*method)(Parameters &params), int flags, const Arguments &args = {}) { ClassBase::method(name, static_cast<method_callback_1>(method), flags, args); }
- void method(const char *name, bool(T::*method)(), int flags, const Arguments &args = {}) { ClassBase::method(name, static_cast<method_callback_2>(method), flags, args); }
- void method(const char *name, bool(T::*method)(Parameters &params), int flags, const Arguments &args = {}) { ClassBase::method(name, static_cast<method_callback_3>(method), flags, args); }
- void method(const char *name, void(T::*method)(), const Arguments &args = {}) { ClassBase::method(name, static_cast<method_callback_0>(method), Public, args); }
- void method(const char *name, void(T::*method)(Parameters &params), const Arguments &args = {}) { ClassBase::method(name, static_cast<method_callback_1>(method), Public, args); }
- void method(const char *name, bool(T::*method)(), const Arguments &args = {}) { ClassBase::method(name, static_cast<method_callback_2>(method), Public, args); }
- void method(const char *name, bool(T::*method)(Parameters &params), const Arguments &args = {}) { ClassBase::method(name, static_cast<method_callback_3>(method), Public, args); }
+ void method(const char *name, void (T::*method)(), int flags, const Arguments &args = {}) { ClassBase::method(name, static_cast<method_callback_0>(method), flags, args); }
+ void method(const char *name, void (T::*method)(Parameters &params), int flags, const Arguments &args = {}) { ClassBase::method(name, static_cast<method_callback_1>(method), flags, args); }
+ void method(const char *name, Value (T::*method)(), int flags, const Arguments &args = {}) { ClassBase::method(name, static_cast<method_callback_2>(method), flags, args); }
+ void method(const char *name, Value (T::*method)(Parameters &params), int flags, const Arguments &args = {}) { ClassBase::method(name, static_cast<method_callback_3>(method), flags, args); }
+ void method(const char *name, void (T::*method)(), const Arguments &args = {}) { ClassBase::method(name, static_cast<method_callback_0>(method), Public, args); }
+ void method(const char *name, void (T::*method)(Parameters &params), const Arguments &args = {}) { ClassBase::method(name, static_cast<method_callback_1>(method), Public, args); }
+ void method(const char *name, Value (T::*method)(), const Arguments &args = {}) { ClassBase::method(name, static_cast<method_callback_2>(method), Public, args); }
+ void method(const char *name, Value (T::*method)(Parameters &params), const Arguments &args = {}) { ClassBase::method(name, static_cast<method_callback_3>(method), Public, args); }
/**
* Add an abstract method to the class