summaryrefslogtreecommitdiff
path: root/tests/cpp/include/class_obj/004-static-funct.h
blob: d6816ab037bc40573c8c45af47086e8bab0e2727 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/**
 *
 *  Test Classes and objects
 *	004-static-funct.phpt
 *	test static functions
 *
 */




/**
 *  Set up namespace
 */
namespace TestBaseClass {

   
    /**
     *  Regular function
     *
     *  Because a regular function does not have a 'this' pointer,
     *  it has the same signature as static methods
     *
     *  @param  params      Parameters passed to the function
     */
    void testStaticRegFunc(Php::Parameters &params)
    {
        Php::out << "testStatic regular function"<< std::endl;
    }

    /**
     *  A very simple class that will not be exported to PHP
     */
    class testStaticPrivClass
    {
    public:
        /**
         *  C++ constructor and destructor
         */
        testStaticPrivClass() {}
        virtual ~testStaticPrivClass() {}

        /** 
         *  Static method
         *
         *  A static method also has no 'this' pointer and has
         *  therefore a signature identical to regular functions
         *
         *  @param  params      Parameters passed to the method
         */
        static void staticMethod(Php::Parameters &params)
        {
            Php::out << "testStaticPrivClass::staticMethod()"<< std::endl;
        }
    };

    /**
     *  A very simple class that will be exported to PHP
     */
    class  testStaticPubClass : public Php::Base
    {
    public:
        /**
         *  C++ constructor and destructor
         */
        testStaticPubClass() {}
        virtual ~testStaticPubClass() {}

        /** 
         *  Another static method
         *
         *  This static has exactly the same signature as the
         *  regular function and static method that were mentioned
         *  before
         *
         *  @param  params      Parameters passed to the method
         */
        static void staticMethod(Php::Parameters &params)
        {
            Php::out << "testStaticPubClass::staticMethod()"<< std::endl;
        }
    };



/**
 *  End of namespace
 */
}