import source from 1.3.40
[external/swig.git] / Examples / test-suite / php / director_stl_runme.php
1 <?php
2
3 require "tests.php";
4 require "director_stl.php";
5
6 // No new functions
7 check::functions(array(foo_bar,foo_ping,foo_pong,foo_tping,foo_tpong,foo_pident,foo_vident,foo_vsecond,foo_tpident,foo_tvident,foo_tvsecond,foo_vidents,foo_tvidents));
8 // No new classes
9 check::classes(array(Foo));
10 // now new vars
11 check::globals(array());
12
13 class MyFoo extends Foo {
14   function ping($s) {
15     return "MyFoo::ping():" . $s;
16   }
17
18   function pident($arg) {
19     return $arg;
20   }
21
22   function vident($v) {
23     return $v;
24   }
25
26   function vidents($v) {
27     return $v;
28   }
29
30   function vsecond($v1, $v2) {
31     return $v2;
32   }
33 }
34
35 $a = new MyFoo();
36
37 $a->tping("hello");
38 $a->tpong("hello");
39
40 # TODO: automatic conversion between PHP arrays and std::pair or 
41 # std::vector is not yet implemented.
42 /*$p = array(1, 2);
43 $a->pident($p);
44 $v = array(3, 4);
45 $a->vident($v);
46
47 $a->tpident($p);
48 $a->tvident($v);
49
50 $v1 = array(3, 4);
51 $v2 = array(5, 6);
52
53 $a->tvsecond($v1, $v2);
54
55 $vs = array("hi", "hello");
56 $vs;
57 $a->tvidents($vs);*/
58
59 check::done();
60 ?>