diff options
Diffstat (limited to 'src/parametersimpl.h')
-rw-r--r-- | src/parametersimpl.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/parametersimpl.h b/src/parametersimpl.h new file mode 100644 index 0000000..fd14238 --- /dev/null +++ b/src/parametersimpl.h @@ -0,0 +1,53 @@ +/** + * ParametersImpl.h + * + * Extended parameters class that can be instantiated + * + * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com> + * @copyright 2013 Copernica BV + */ + +/** + * Set up namespace + */ +namespace Php { + +/** + * Class definition + */ +class ParametersImpl : public Parameters +{ +public: + /** + * Constructor + * @param this_ptr Pointer to the object + * @param argc Number of arguments + * @param tsrm_ls + */ + ParametersImpl(zval *this_ptr, int argc TSRMLS_DC) : Parameters(this_ptr ? ObjectImpl::find(this_ptr TSRMLS_CC)->object() : nullptr) + { + // 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)); + } + } + + /** + * Destructor + */ + virtual ~ParametersImpl() {} +}; + +/** + * End of namespace + */ +} + |