summaryrefslogtreecommitdiff
path: root/src/function.cpp
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-10-14 07:42:37 -0700
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-10-14 07:42:37 -0700
commitb2042dbd58c043ab49e9b0dbb51bf8516fe8cea8 (patch)
tree25c7806d4c9d5fb237c0995b4bd12c4664bf853a /src/function.cpp
parent53272534a76a9d8cbee4ee887e1f360c4a99728b (diff)
Initial attempt to register native C++ class methods directly to PHP
Diffstat (limited to 'src/function.cpp')
-rw-r--r--src/function.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/function.cpp b/src/function.cpp
index 79117e5..d255518 100644
--- a/src/function.cpp
+++ b/src/function.cpp
@@ -82,8 +82,9 @@ Function::~Function()
* function or method introces himself
*
* @param entry Entry to be filled
+ * @param classname Optional class name
*/
-void Function::fill(zend_function_entry *entry) const
+void Function::fill(zend_function_entry *entry, const char *classname) const
{
// fill the members of the entity, and hide a pointer to the current object in the name
entry->fname = _ptr;
@@ -95,21 +96,22 @@ void Function::fill(zend_function_entry *entry) const
entry->flags = 0;
// we should fill the first argument as well
- fill((zend_internal_function_info *)entry->arg_info);
+ fill((zend_internal_function_info *)entry->arg_info, classname);
}
/**
* Fill a function entry
* @param info Info to be filled
+ * @param classname Optional classname
*/
-void Function::fill(zend_internal_function_info *info) const
+void Function::fill(zend_internal_function_info *info, const char *classname) const
{
// fill in all the members, note that return reference is false by default,
- // because we do want to return references, inside the name we hide a pointer
- // to the current object
+ // because we do not support returning references in PHP-CPP, although Zend
+ // engine allows it. Inside the name we hide a pointer to the current object
info->_name = _ptr;
info->_name_len = _ptr.length();
- info->_class_name = NULL;
+ info->_class_name = classname;
// number of required arguments, and the expected return type
info->required_num_args = _required;