diff options
author | Martijn Otto <martijn.otto@copernica.com> | 2014-02-06 16:06:43 +0100 |
---|---|---|
committer | Martijn Otto <martijn.otto@copernica.com> | 2014-02-06 16:06:43 +0100 |
commit | 7c3c6cb385543dd5a3730f6cce8337ae3c1307f7 (patch) | |
tree | 4204ea8c98041ed11e870f76067da5f6b17febb3 /include | |
parent | 30aeb60818c9d4b0318848d7dc83062f9c78b804 (diff) |
Added the call() method for Value objects, allowing calling of member functions of PHP objects
Diffstat (limited to 'include')
-rw-r--r-- | include/value.h | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/include/value.h b/include/value.h index 6b764a2..0990e82 100644 --- a/include/value.h +++ b/include/value.h @@ -565,7 +565,6 @@ public: * Call the function in PHP * We have ten variants of this function, depending on the number of parameters * This call operator is only useful when the variable represents a callable - * @param name Name of the function * @return Value */ Value operator()(); @@ -580,6 +579,25 @@ public: Value operator()(Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6, Value p7, Value p8); Value operator()(Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6, Value p7, Value p8, Value p9); + /** + * Call a method + * We have ten variants of this function, depending on the number of parameters + * This is only applicable when the Value contains PHP object + * @param name Name of the function + * @return Value + */ + Value call(const std::string &name); + Value call(const std::string &name, Value p0); + Value call(const std::string &name, Value p0, Value p1); + Value call(const std::string &name, Value p0, Value p1, Value p2); + Value call(const std::string &name, Value p0, Value p1, Value p2, Value p3); + Value call(const std::string &name, Value p0, Value p1, Value p2, Value p3, Value p4); + Value call(const std::string &name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5); + Value call(const std::string &name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6); + Value call(const std::string &name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6, Value p7); + Value call(const std::string &name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6, Value p7, Value p8); + Value call(const std::string &name, Value p0, Value p1, Value p2, Value p3, Value p4, Value p5, Value p6, Value p7, Value p8, Value p9); + private: /** * Call function with a number of parameters @@ -589,6 +607,15 @@ private: */ Value exec(int argc, struct _zval_struct ***params); + /** + * Call method with a number of parameters + * @param name Name of method to call + * @param argc Number of parameters + * @param argv The parameters + * @return Value + */ + Value exec(const std::string &name, int argc, struct _zval_struct ***params); + protected: /** * The wrapped zval |