summaryrefslogtreecommitdiff
path: root/include/arguments.h
blob: e57903ff0cfd390cc1e99d1600b791369840ebbf (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
91
92
93
94
95
96
97
98
/**
 *  Arguments.h
 *
 *  When a function is invoked, it is passed a vector of arguments. This
 *  arguments class, that overrides from vector, takes care of that.
 *
 *  @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
 *  @copyright 2013 Copernica BV
 */

/**
 *  Forward declaration
 */
struct _zend_arg_info;

/**
 *  Set up namespace
 */
namespace Php {

/**
 *  Class definition
 */
class Arguments
{
public:
    /**
     *  Constructor
     *  @param  min     The min number of arguments
     *  @param  max     The max number of arguments
     */
    Arguments(int min, int max);
    
    /**
     *  No copy or move operations
     *  @param  arguments
     */
    Arguments(const Arguments &arguments) = delete;
    Arguments(Arguments &&arguments) = delete;
    
    /**
     *  Destructor
     */
    virtual ~Arguments();
    
    /**
     *  Number of arguments
     *  @return int
     */
    int argc()
    {
        return _max;
    }
    
    /**
     *  Number of required arguments
     *  @return int
     */
    int required()
    {
        return _min;
    }
    
    /**
     *  Get access to internal data
     *  @return zend_arg_info*
     */
    struct _zend_arg_info *internal()
    {
        return _argv;
    }

private:
    /**
     *  Min number of arguments
     *  @var integer
     */
    int _min;
    
    /**
     *  Max number of arguments
     *  @var integer
     */
    int _max;
    
    /**
     *  The arguments
     *  @var zend_arg_info[]
     */
    struct _zend_arg_info *_argv;

};

/**
 *  End of namespace
 */
}