summaryrefslogtreecommitdiff
path: root/include/functions.h
blob: 49f38b7489eaa35c450db32725a9dd1063ef7045 (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
/**
 *  Functions.h
 *
 *  Internal helper class that parses the functions initializer list, and
 *  that converts it into a zend_function_entry array.
 *
 *  @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
 *  @copyright 2013 Copernica BV
 */

/**
 *  Set up namespace
 */
namespace PhpCpp {

/**
 *  Class definition
 */
class Functions
{
public:
    /**
     *  Constructor
     *  @param  functions   The functions to parse
     */
    Functions(const std::initializer_list<Function> &functions);

    /**
     *  Destructor
     */
    virtual ~Functions();

private:    
    /**
     *  Retrieve the internal data
     *  @return zend_function_entry*
     */
    zend_function_entry *internal() const
    {
        return _entries;
    }

    /**
     *  The internal entries
     *  @var zend_function_entry*
     */
    zend_function_entry *_entries;
    
    /**
     *  Vector of functions (we need this because the function objects must
     *  remain in memory, so that we can call the invoke methods on them)
     *  @var vector
     */
    std::vector<Function> _functions;
    
    /**
     *  The extension has access to the private elements
     */
    friend class Extension;
};

/**
 *  End of namespace
 */
}