summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-09-25 05:23:34 -0700
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-09-25 05:23:34 -0700
commit49ac629257835426c311fb7b92b23a9138a9d77b (patch)
treed7f8d6d843206ecdf29b3877a5e7faf7815f3f24 /tests
parent9e1ecc534bace7d00a265a49018c0148a56361ae (diff)
Work in progress on implementing classes
Diffstat (limited to 'tests')
-rw-r--r--tests/simple/simple.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/tests/simple/simple.cpp b/tests/simple/simple.cpp
index fbc29d4..f2a5207 100644
--- a/tests/simple/simple.cpp
+++ b/tests/simple/simple.cpp
@@ -15,6 +15,12 @@
*/
using namespace std;
+/**
+ * Our own "my_plus" function that will be available in PHP
+ * @param environment
+ * @param params
+ * @return Value
+ */
static Php::Value my_plus(Php::Environment &env, Php::Parameters &params)
{
string p1 = params[0];
@@ -34,20 +40,14 @@ static Php::Value my_plus(Php::Environment &env, Php::Parameters &params)
return p1 + p2;
}
-class MyCustomFunction : public Php::Function
+/**
+ * Custom class that will be available in PHP
+ */
+class MyCustomClass : public Php::Base
{
public:
- MyCustomFunction(const char *name) : Function(name) {}
-
-
-
};
-
-
-
-
-
// symbols are exported according to the "C" language
extern "C"
{
@@ -65,11 +65,8 @@ extern "C"
Php::ByRef("d", Php::stringType)
});
-// extension.add("my_concat", my_concat);
- extension.add(new MyCustomFunction("my_custom"));
-
// define classes
-// extension.add("my_class", MyCustomClass());
+ extension.add("my_class", Php::Class<MyCustomClass>());
// return the module entry
return extension.module();