diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-12 15:45:19 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-12 15:45:19 +0100 |
commit | 21edee4d584dbf757b006349e903ff7a3b398a1d (patch) | |
tree | 2532ec92649726a2ff59ba440c4090e80c679d9d /src/classbase.cpp | |
parent | 4415b472ae57e367e1fcece4c04355b55a868a1b (diff) |
support for static methods
Diffstat (limited to 'src/classbase.cpp')
-rw-r--r-- | src/classbase.cpp | 70 |
1 files changed, 62 insertions, 8 deletions
diff --git a/src/classbase.cpp b/src/classbase.cpp index f7d8d94..03c5512 100644 --- a/src/classbase.cpp +++ b/src/classbase.cpp @@ -1133,7 +1133,7 @@ void ClassBase::initialize(const std::string &prefix) * @param flags Optional flags * @param args Description of the supported arguments */ -void ClassBase::method(const char *name, method_callback_0 callback, int flags, const Arguments &args) +void ClassBase::method(const char *name, const method_callback_0 &callback, int flags, const Arguments &args) { // add the method _methods.push_back(std::make_shared<Method>(name, callback, flags, args)); @@ -1146,7 +1146,7 @@ void ClassBase::method(const char *name, method_callback_0 callback, int flags, * @param flags Optional flags * @param args Description of the supported arguments */ -void ClassBase::method(const char *name, method_callback_1 callback, int flags, const Arguments &args) +void ClassBase::method(const char *name, const method_callback_1 &callback, int flags, const Arguments &args) { // add the method _methods.push_back(std::make_shared<Method>(name, callback, flags, args)); @@ -1159,7 +1159,7 @@ void ClassBase::method(const char *name, method_callback_1 callback, int flags, * @param flags Optional flags * @param args Description of the supported arguments */ -void ClassBase::method(const char *name, method_callback_2 callback, int flags, const Arguments &args) +void ClassBase::method(const char *name, const method_callback_2 &callback, int flags, const Arguments &args) { // add the method _methods.push_back(std::make_shared<Method>(name, callback, flags, args)); @@ -1172,7 +1172,7 @@ void ClassBase::method(const char *name, method_callback_2 callback, int flags, * @param flags Optional flags * @param args Description of the supported arguments */ -void ClassBase::method(const char *name, method_callback_3 callback, int flags, const Arguments &args) +void ClassBase::method(const char *name, const method_callback_3 &callback, int flags, const Arguments &args) { // add the method _methods.push_back(std::make_shared<Method>(name, callback, flags, args)); @@ -1185,7 +1185,7 @@ void ClassBase::method(const char *name, method_callback_3 callback, int flags, * @param flags Optional flags * @param args Description of the supported arguments */ -void ClassBase::method(const char *name, method_callback_4 callback, int flags, const Arguments &args) +void ClassBase::method(const char *name, const method_callback_4 &callback, int flags, const Arguments &args) { // add the method _methods.push_back(std::make_shared<Method>(name, callback, flags, args)); @@ -1198,7 +1198,7 @@ void ClassBase::method(const char *name, method_callback_4 callback, int flags, * @param flags Optional flags * @param args Description of the supported arguments */ -void ClassBase::method(const char *name, method_callback_5 callback, int flags, const Arguments &args) +void ClassBase::method(const char *name, const method_callback_5 &callback, int flags, const Arguments &args) { // add the method _methods.push_back(std::make_shared<Method>(name, callback, flags, args)); @@ -1211,7 +1211,7 @@ void ClassBase::method(const char *name, method_callback_5 callback, int flags, * @param flags Optional flags * @param args Description of the supported arguments */ -void ClassBase::method(const char *name, method_callback_6 callback, int flags, const Arguments &args) +void ClassBase::method(const char *name, const method_callback_6 &callback, int flags, const Arguments &args) { // add the method _methods.push_back(std::make_shared<Method>(name, callback, flags, args)); @@ -1224,13 +1224,65 @@ void ClassBase::method(const char *name, method_callback_6 callback, int flags, * @param flags Optional flags * @param args Description of the supported arguments */ -void ClassBase::method(const char *name, method_callback_7 callback, int flags, const Arguments &args) +void ClassBase::method(const char *name, const method_callback_7 &callback, int flags, const Arguments &args) { // add the method _methods.push_back(std::make_shared<Method>(name, callback, flags, args)); } /** + * Add a static method to the class + * @param name Name of the method + * @param method The actual method + * @param flags Optional flags + * @param args Description of the supported arguments + */ +void ClassBase::method(const char *name, const native_callback_0 &method, int flags, const Arguments &args) +{ + // add the method + _methods.push_back(std::make_shared<Method>(name, method, flags | ZEND_ACC_STATIC, args)); +} + +/** + * Add a static method to the class + * @param name Name of the method + * @param method The actual method + * @param flags Optional flags + * @param args Description of the supported arguments + */ +void ClassBase::method(const char *name, const native_callback_1 &method, int flags, const Arguments &args) +{ + // add the method + _methods.push_back(std::make_shared<Method>(name, method, flags | ZEND_ACC_STATIC, args)); +} + +/** + * Add a static method to the class + * @param name Name of the method + * @param method The actual method + * @param flags Optional flags + * @param args Description of the supported arguments + */ +void ClassBase::method(const char *name, const native_callback_2 &method, int flags, const Arguments &args) +{ + // add the method + _methods.push_back(std::make_shared<Method>(name, method, flags | ZEND_ACC_STATIC, args)); +} + +/** + * Add a static method to the class + * @param name Name of the method + * @param method The actual method + * @param flags Optional flags + * @param args Description of the supported arguments + */ +void ClassBase::method(const char *name, const native_callback_3 &method, int flags, const Arguments &args) +{ + // add the method + _methods.push_back(std::make_shared<Method>(name, method, flags | ZEND_ACC_STATIC, args)); +} + +/** * Add an abstract method to the class * @param name Name of the method * @param flags Optional flags (like public or protected) @@ -1242,6 +1294,8 @@ void ClassBase::method(const char *name, int flags, const Arguments &args) _methods.push_back(std::make_shared<Method>(name, Abstract | flags, args)); } + + /** * Add a property to the class * @param name Name of the property |