diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-04-05 18:17:09 +0200 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-04-05 18:17:09 +0200 |
commit | 5d84ff5483f2db57762311714ff3c779db1e0f96 (patch) | |
tree | 0691e7395a292b152af3525b1e65a11b15bad46f /include | |
parent | 5973954b7428aa95ec8f0b2424b5725d2815049f (diff) |
removed zend code from the argument.h header file
Diffstat (limited to 'include')
-rw-r--r-- | include/argument.h | 111 |
1 files changed, 79 insertions, 32 deletions
diff --git a/include/argument.h b/include/argument.h index 68ac7df..81b1bf4 100644 --- a/include/argument.h +++ b/include/argument.h @@ -8,15 +8,10 @@ * classes instead. * * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com> - * @copyright 2013 Copernica BV + * @copyright 2013, 2014 Copernica BV */ /** - * Forward declaration - */ -struct _zend_arg_info; - -/** * Set up namespace */ namespace Php { @@ -28,21 +23,9 @@ class Argument { public: /** - * Copy constructor - * @param argument - */ - Argument(const Argument &argument); - - /** - * Move constructor - * @param argument - */ - Argument(Argument &&argument); - - /** * Destructor */ - virtual ~Argument(); + virtual ~Argument() {} protected: /** @@ -52,7 +35,8 @@ protected: * @param required Is this argument required? * @param byref Is this a reference argument */ - Argument(const char *name, Type type, bool required = true, bool byref = false); + Argument(const char *name, Type type, bool required = true, bool byref = false) : + _name(name), _type(type), _required(required), _byReference(byref) {} /** * Constructor @@ -62,17 +46,11 @@ protected: * @param required Is this argument required? * @param byref Is this a reference argument? */ - Argument(const char *name, const char *classname, bool nullable = true, bool required = true, bool byref = false); + Argument(const char *name, const char *classname, bool nullable = true, bool required = true, bool byref = false) : + _name(name), _type(Type::Object), _classname(classname), _nullable(nullable), _required(required), _byReference(byref) {} public: /** - * Fill an arg_info structure with data - * @param info - * @internal - */ - void fill(struct _zend_arg_info *info) const; - - /** * Is this a required argument? * @return bool * @internal @@ -81,19 +59,88 @@ public: { return _required; } - + + /** + * Name of the argument + * @return std::string + */ + const std::string &name() const + { + return _name; + } + + /** + * Type-hint for the argument + * @return Type + */ + Type type() const + { + return _type; + } + + /** + * If the type is a class, the name of the class + * @return std::string + */ + const std::string &classname() const + { + return _classname; + } + + /** + * Is it allowed to pass parameter with a null value? + * @return bool + */ + bool allowNull() const + { + return _nullable; + } + + /** + * Is this a parameter-by-reference? + * @return bool + */ + bool byReference() const + { + return _byReference; + } + private: /** - * The argument info - * @var zend_arg_info + * Name of the argument + * @var std::string */ - struct _zend_arg_info *_info; + std::string _name; /** + * Type of argument + * @var Type + */ + Type _type; + + /** + * Classname, if this is a parameter that is supposed to be an instance of a class + * @var std::string + */ + std::string _classname; + + /** + * May the parameter be null? + * @var bool + */ + bool _nullable; + + /** * Is this a required argument * @var bool */ bool _required; + + /** + * Is this a 'by-reference' parameter? + * @var bool + */ + bool _byReference; }; /** |