diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2015-01-15 16:34:14 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2015-01-15 16:34:14 +0100 |
commit | d87b3ca8f1dbcb395f2dfd6540483da7a0e5e15c (patch) | |
tree | 6dd3179162d5cecc474fc9028039bd757f6df04b /zend/namespace.cpp | |
parent | d8fe9239959dfeae11daa5de70126e30119d3b75 (diff) |
Added the Php::Function class. This is an extension to the Php::Value class that can be used if you want to assign a std::function object to a Value. This is useful if you want to pass a C++ lambda to a PHP userspace function
Diffstat (limited to 'zend/namespace.cpp')
-rw-r--r-- | zend/namespace.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/zend/namespace.cpp b/zend/namespace.cpp index 9274bf0..893f2f0 100644 --- a/zend/namespace.cpp +++ b/zend/namespace.cpp @@ -26,7 +26,7 @@ Namespace &Namespace::add(const char *name, const native_callback_0 &function, c if (locked()) return *this; // add a function - _functions.push_back(std::make_shared<Function>(name, function, arguments)); + _functions.push_back(std::make_shared<NativeFunction>(name, function, arguments)); // allow chaining return *this; @@ -45,7 +45,7 @@ Namespace &Namespace::add(const char *name, const native_callback_1 &function, c if (locked()) return *this; // add a function - _functions.push_back(std::make_shared<Function>(name, function, arguments)); + _functions.push_back(std::make_shared<NativeFunction>(name, function, arguments)); // allow chaining return *this; @@ -64,7 +64,7 @@ Namespace &Namespace::add(const char *name, const native_callback_2 &function, c if (locked()) return *this; // add a function - _functions.push_back(std::make_shared<Function>(name, function, arguments)); + _functions.push_back(std::make_shared<NativeFunction>(name, function, arguments)); // allow chaining return *this; @@ -83,7 +83,7 @@ Namespace &Namespace::add(const char *name, const native_callback_3 &function, c if (locked()) return *this; // add a function - _functions.push_back(std::make_shared<Function>(name, function, arguments)); + _functions.push_back(std::make_shared<NativeFunction>(name, function, arguments)); // allow chaining return *this; @@ -97,13 +97,13 @@ Namespace &Namespace::add(const char *name, const native_callback_3 &function, c * * @param callback */ -void Namespace::functions(const std::function<void(const std::string &ns, Function &func)> &callback) +void Namespace::functions(const std::function<void(const std::string &ns, NativeFunction &func)> &callback) { // loop through the functions, and apply the callback for (auto &function : _functions) callback(_name, *function); // loop through the other namespaces - for (auto &ns : _namespaces) ns->functions([this, callback](const std::string &ns, Function &func) { + for (auto &ns : _namespaces) ns->functions([this, callback](const std::string &ns, NativeFunction &func) { // if this is the root namespace, we don't have to change the prefix if (_name.size() == 0) return callback(ns, func); |