diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-04 22:01:44 +0100 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-03-04 22:01:44 +0100 |
commit | 29ea3a29642f5cec612f102683e6d43aba226148 (patch) | |
tree | ae9e268f5db60c79ee9f00c0294ca6865beb60ac /Examples | |
parent | 5aaeb88d8b753a3b51e81c36dba6293dd436148b (diff) |
fixed some examples
Diffstat (limited to 'Examples')
-rw-r--r-- | Examples/CallPhpFunctions/callphpfunction.cpp | 4 | ||||
-rw-r--r-- | Examples/FunctionWithParameters/functionwithparameters.cpp | 8 | ||||
-rw-r--r-- | Examples/simple/simple.cpp | 18 |
3 files changed, 15 insertions, 15 deletions
diff --git a/Examples/CallPhpFunctions/callphpfunction.cpp b/Examples/CallPhpFunctions/callphpfunction.cpp index 9932a3e..9190065 100644 --- a/Examples/CallPhpFunctions/callphpfunction.cpp +++ b/Examples/CallPhpFunctions/callphpfunction.cpp @@ -43,8 +43,8 @@ extern "C" // add function to extension extension.add("call_php_function", call_php_function, { - Php::ByVal("addFunc", Php::callableType), - Php::ByVal("x", Php::numericType) + Php::ByVal("addFunc", Php::Type::Callable), + Php::ByVal("x", Php::Type::Numeric) }); // return the extension module diff --git a/Examples/FunctionWithParameters/functionwithparameters.cpp b/Examples/FunctionWithParameters/functionwithparameters.cpp index dd7bb9f..2600bad 100644 --- a/Examples/FunctionWithParameters/functionwithparameters.cpp +++ b/Examples/FunctionWithParameters/functionwithparameters.cpp @@ -99,18 +99,18 @@ extern "C" // add function, with defined numeric parameters, to extension extension.add("my_with_defined_parameters_function", my_with_defined_parameters_function, { - Php::ByVal("x", Php::numericType), - Php::ByVal("y", Php::numericType) + Php::ByVal("x", Php::Type::Numeric), + Php::ByVal("y", Php::Type::Numeric) }); // add function, with defined parameter by reference, to extension extension.add("my_with_defined_parameters_reference_function", my_with_defined_parameters_reference_function, { - Php::ByRef("string", Php::stringType) + Php::ByRef("string", Php::Type::String) }); // add function, with defined array parameter, to extension extension.add("my_with_defined_array_parameters_function", my_with_defined_array_parameters_function, { - Php::ByVal("array", Php::arrayType) + Php::ByVal("array", Php::Type::Array) }); // add function, with defined object parameter, to extension diff --git a/Examples/simple/simple.cpp b/Examples/simple/simple.cpp index 3a93bdc..bfbcfab 100644 --- a/Examples/simple/simple.cpp +++ b/Examples/simple/simple.cpp @@ -161,21 +161,21 @@ extern "C" // define the functions extension.add("my_plus", my_plus, { - Php::ByVal("a", Php::numericType), - Php::ByVal("b", Php::numericType), + Php::ByVal("a", Php::Type::Numeric), + Php::ByVal("b", Php::Type::Numeric), Php::ByVal("c", "MyClass"), - Php::ByRef("d", Php::stringType) + Php::ByRef("d", Php::Type::String) }); extension.add("bubblesort", bubblesort); - Php::Method<MyCustomClass> x(&MyCustomClass::myMethod); - // define classes - extension.add("my_class", Php::Class<MyCustomClass>({ - Php::Public("myMethod", Php::Method<MyCustomClass>(&MyCustomClass::myMethod)), - Php::Public("__construct", Php::Method<MyCustomClass>(&MyCustomClass::__construct)) - })); + Php::Class<MyCustomClass> myCustomClass("my_class"); + myCustomClass.method("mymethod", &MyCustomClass::myMethod); + myCustomClass.method("__construct", &MyCustomClass::__construct); + + // add to extension + extension.add(myCustomClass); // return the module entry return extension.module(); |