summaryrefslogtreecommitdiff
path: root/src/methodmember.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-10-15 05:54:52 -0700
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-10-15 05:54:52 -0700
commit61ba30d716dab670a5f2ed0ee2f6650375b2058d (patch)
tree711db9359015de260071088ef027b020cd95d4b3 /src/methodmember.h
parentb2042dbd58c043ab49e9b0dbb51bf8516fe8cea8 (diff)
Calling custom member methods is now functional
Diffstat (limited to 'src/methodmember.h')
-rw-r--r--src/methodmember.h44
1 files changed, 17 insertions, 27 deletions
diff --git a/src/methodmember.h b/src/methodmember.h
index 16f0dd0..20f2749 100644
--- a/src/methodmember.h
+++ b/src/methodmember.h
@@ -24,14 +24,7 @@ public:
* @param method
* @param arguments
*/
- MethodMember(const char *name, method_callback_0 method, const std::initializer_list<Argument> &arguments = {}) : Function(name, arguments), _type(0) { _method.m0 = method; }
- MethodMember(const char *name, method_callback_1 method, const std::initializer_list<Argument> &arguments = {}) : Function(name, arguments), _type(1) { _method.m1 = method; }
- MethodMember(const char *name, method_callback_2 method, const std::initializer_list<Argument> &arguments = {}) : Function(name, arguments), _type(2) { _method.m2 = method; }
- MethodMember(const char *name, method_callback_3 method, const std::initializer_list<Argument> &arguments = {}) : Function(name, arguments), _type(3) { _method.m3 = method; }
- MethodMember(const char *name, method_callback_4 method, const std::initializer_list<Argument> &arguments = {}) : Function(name, arguments), _type(4) { _method.m4 = method; }
- MethodMember(const char *name, method_callback_5 method, const std::initializer_list<Argument> &arguments = {}) : Function(name, arguments), _type(5) { _method.m5 = method; }
- MethodMember(const char *name, method_callback_6 method, const std::initializer_list<Argument> &arguments = {}) : Function(name, arguments), _type(6) { _method.m6 = method; }
- MethodMember(const char *name, method_callback_7 method, const std::initializer_list<Argument> &arguments = {}) : Function(name, arguments), _type(7) { _method.m7 = method; }
+ MethodMember(const char *name, const _Method &method, const std::initializer_list<Argument> &arguments = {}) : Function(name, arguments), _method(method) {}
/**
* Destructor
@@ -48,34 +41,31 @@ public:
* Fill a function entry object
* @param entry Function entry
* @param classname Name of the class
+ * @param pub Is this a public entry
*/
- virtual void fill(struct _zend_function_entry *entry, const char *classname)
+ virtual void fill(struct _zend_function_entry *entry, const char *classname, bool pub)
{
// call function object
- Function::fill(entry, classname);
+ Function::fill(entry, classname, pub);
}
-private:
/**
- * Union of supported callbacks
- * One of the callbacks will be set
+ * Method that gets called every time the function is executed
+ * @param environment Environment object
+ * @param params The parameters that were passed
+ * @return Variable Return value
*/
- union {
- method_callback_0 m0;
- method_callback_1 m1;
- method_callback_2 m2;
- method_callback_3 m3;
- method_callback_4 m4;
- method_callback_5 m5;
- method_callback_6 m6;
- method_callback_7 m7;
- } _method;
-
+ virtual Value invoke(Environment &environment, Parameters &params)
+ {
+ return _method.invoke(environment, params);
+ }
+
+private:
/**
- * The method type that is set
- * @var integer
+ * The method pointer
+ * @var _Method
*/
- int _type;
+ _Method _method;
};
/**