From 29ea3a29642f5cec612f102683e6d43aba226148 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Tue, 4 Mar 2014 22:01:44 +0100 Subject: fixed some examples --- Examples/CallPhpFunctions/callphpfunction.cpp | 4 ++-- .../FunctionWithParameters/functionwithparameters.cpp | 8 ++++---- Examples/simple/simple.cpp | 18 +++++++++--------- 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'Examples') 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 x(&MyCustomClass::myMethod); - // define classes - extension.add("my_class", Php::Class({ - Php::Public("myMethod", Php::Method(&MyCustomClass::myMethod)), - Php::Public("__construct", Php::Method(&MyCustomClass::__construct)) - })); + Php::Class 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(); -- cgit v1.2.3