diff options
Diffstat (limited to 'src/arguments.cpp')
-rw-r--r-- | src/arguments.cpp | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/src/arguments.cpp b/src/arguments.cpp index e5e7ae5..53f030b 100644 --- a/src/arguments.cpp +++ b/src/arguments.cpp @@ -11,13 +11,55 @@ /** * Set up namespace */ -namespace PhpCpp { +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 @@ -33,6 +75,8 @@ Arguments::Arguments(int argc TSRMLS_DC) push_back(Value(*arg)); } } +* +*/ /** * End of namespace |