diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2013-08-28 16:09:22 +0200 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2013-08-28 16:09:22 +0200 |
commit | 06f99dc74625d1ce338abda0ab6e0b0194bf48b8 (patch) | |
tree | aae309028b9cf1222557d7158fb1e65e74582ba9 /include | |
parent | e72cd10803a020d762db6a7073420294241f690e (diff) |
renamed variable class to value class, and implemented most of the methods in it
Diffstat (limited to 'include')
-rw-r--r-- | include/function.h | 2 | ||||
-rw-r--r-- | include/value.h (renamed from include/variable.h) | 54 |
2 files changed, 33 insertions, 23 deletions
diff --git a/include/function.h b/include/function.h index 1a35671..a7dc9b0 100644 --- a/include/function.h +++ b/include/function.h @@ -91,7 +91,7 @@ public: * @param arguments The actual arguments that were passed * @return Variable Return value */ - virtual Variable invoke(const Request *request, const std::initializer_list<Variable> &arguments) + virtual Value invoke(const Request *request, const std::initializer_list<Value> &arguments) { } diff --git a/include/variable.h b/include/value.h index fccab9c..fe370dc 100644 --- a/include/variable.h +++ b/include/value.h @@ -1,7 +1,18 @@ /** - * Variable.h + * Value.h * - * Base class for variables that are stored in the Zend engine. + * Base class for values that are stored in the Zend engine. One instance + * of the value class represents a variable that exists in user space in + * the PHP environment, for example as global variable, local variable + * inside a function or as a member of an object or an array. + * + * A value can be a scalar or a more complicated structure like an object + * or an array. + * + * Internally, the Zend engine works with "zval" objects for this. These "zval" + * object hold a reference counter and a reference setting. The PHP-CPP Value + * class takes care of doing this, so all you need to do is use objects of + * this class. * * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com> * @copyright 2013 Copernica BV @@ -20,89 +31,89 @@ namespace PhpCpp { /** * Class definition */ -class Variable +class Value { public: /** * Empty constructor (value = NULL) */ - Variable(); + Value(); /** * Constructor based on integer value * @param value */ - Variable(int value); + Value(int value); /** * Constructor based on boolean value * @param value */ - Variable(bool value); + Value(bool value); /** * Constructor based on string value * @param value */ - Variable(const std::string &value); + Value(const std::string &value); /** * Constructor based on decimal value * @param value */ - Variable(double value); + Value(double value); /** * Wrap object around zval * @param zval */ - Variable(struct _zval_struct *zval); + Value(struct _zval_struct *zval); /** * Copy constructor * @param value */ - Variable(const Variable &that); + Value(const Value &that); /** * Destructor */ - virtual ~Variable(); + virtual ~Value(); /** * Assignment operator * @param value - * @return Variable + * @return Value */ - virtual Variable &operator=(const Variable &value); + virtual Value &operator=(const Value &value); /** * Assignment operator * @param value - * @return Variable + * @return Value */ - Variable &operator=(int value); + Value &operator=(int value); /** * Assignment operator * @param value - * @return Variable + * @return Value */ - Variable &operator=(bool value); + Value &operator=(bool value); /** * Assignment operator * @param value - * @return Variable + * @return Value */ - Variable &operator=(const std::string &value); + Value &operator=(const std::string &value); /** * Assignment operator * @param value - * @return Variable + * @return Value */ - Variable &operator=(double value); + Value &operator=(double value); /** * The type of object @@ -224,7 +235,6 @@ protected: * @var struct zval */ struct _zval_struct *_val; - }; /** |