summaryrefslogtreecommitdiff
path: root/include/arguments.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-09-08 16:26:11 -0700
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-09-08 16:26:11 -0700
commitdf2520e4b2c87e2302ee4c6cec1e672091efebfb (patch)
treef3bcd4fa7c4d0c6ee601268ceca4d6841ed90d0d /include/arguments.h
parenteb86ac350756afeffa0e2db8be87876d35bc40a8 (diff)
Refactoring function class, and making it even more easy to directly enable native C functions in PHP
Diffstat (limited to 'include/arguments.h')
-rw-r--r--include/arguments.h69
1 files changed, 64 insertions, 5 deletions
diff --git a/include/arguments.h b/include/arguments.h
index 65476c3..e57903f 100644
--- a/include/arguments.h
+++ b/include/arguments.h
@@ -9,26 +9,85 @@
*/
/**
+ * Forward declaration
+ */
+struct _zend_arg_info;
+
+/**
* Set up namespace
*/
-namespace PhpCpp {
+namespace Php {
/**
* Class definition
*/
-class Arguments : public std::vector<Value>
+class Arguments
{
public:
/**
* Constructor
- * @param argc The number of arguments
+ * @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(int argc);
+ Arguments(const Arguments &arguments) = delete;
+ Arguments(Arguments &&arguments) = delete;
/**
* Destructor
*/
- virtual ~Arguments() {}
+ 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;
};