blob: 53f030b2e3d334bf0374b9cfff62ae182a9051da (
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
|
/**
* Arguments.cpp
*
* Implementation of the arguments class
*
* @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
* @copyright 2013 Copernica BV
*/
#include "includes.h"
/**
* Set up namespace
*/
namespace Php {
/**
* Constructor
* @param min The min number of arguments
* @param max The max number of arguments
*/
Arguments::Arguments(int min, int max)
{
// copy arguments
_min = min;
_max = max;
// max should be appropriate
if (_max < _min) _max = _min;
// allocate memory for the arguments, with one extra record to hold information
_argv = new zend_arg_info[_max + 1];
// initialize the arguments
for (int i=1; i<_max+1; i++)
{
// initialize the argument
_argv[i].name = NULL;
_argv[i].name_len = 0;
_argv[i].class_name = NULL;
_argv[i].class_name_len = 0;
_argv[i].type_hint = nullType;
_argv[i].allow_null = false;
_argv[i].pass_by_reference = false;
}
}
/**
* Destructor
*/
Arguments::~Arguments()
{
// deallocate arguments
delete[] _argv;
}
/**
* Constructor
* @param argc Number of arguments
* @param tsrm_ls
*/
/*
Arguments::Arguments(int argc TSRMLS_DC)
{
// reserve plenty of space
reserve(argc);
// loop through the arguments
for (int i=0; i<argc; i++)
{
// get the argument
zval **arg = (zval **) (zend_vm_stack_top(TSRMLS_C) - 1 - (argc-i));
// append value
push_back(Value(*arg));
}
}
*
*/
/**
* End of namespace
*/
}
|