summaryrefslogtreecommitdiff
path: root/include/base.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-02 15:49:55 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-02 15:49:55 +0100
commit51f4788b2b51a21894ae49821abc67c2fab4a68a (patch)
treef7942b5dd9d33f511fb8d09df23519c51fb2e515 /include/base.h
parent41bd759f31d625b5f73dd3a31d76a91efbde8ad7 (diff)
fixed settings Base::_self variable to a valid, editable value object
Diffstat (limited to 'include/base.h')
-rw-r--r--include/base.h95
1 files changed, 84 insertions, 11 deletions
diff --git a/include/base.h b/include/base.h
index 04f0c0e..7d7be98 100644
--- a/include/base.h
+++ b/include/base.h
@@ -29,45 +29,118 @@ public:
/**
* Convert the object to a Php::Value object (how it is used externally)
+ * @return Object
+ */
+ Object &value()
+ {
+ return _self;
+ }
+
+ /**
+ * Convert the object to a Php::Value object (how it is used externally)
+ * @return Object
+ */
+ const Object &value() const
+ {
+ return _self;
+ }
+
+ /**
+ * Get access to a property by name using the [] operator
+ * @param string
* @return Value
*/
- Value value() const;
+ Value operator[](const char *name)
+ {
+ return _self[name];
+ }
+
+ /**
+ * Alternative way to access a property using the [] operator
+ * @param string
+ * @return Value
+ */
+ Value operator[](const std::string &name)
+ {
+ return _self[name];
+ }
/**
- * Get access to a property by name
+ * Retrieve a property by name
+ * @param string
+ * @return Value
+ */
+ Value property(const char *name)
+ {
+ return _self[name];
+ }
+
+ /**
+ * Retrieve a property by name
+ * @param string
+ * @return Value
+ */
+ Value property(const std::string &name)
+ {
+ return _self[name];
+ }
+
+ /**
+ * Get access to a property by name using the [] operator
* @param string
* @return Value
*/
Value operator[](const char *name) const
{
- return value()[name];
+ return _self[name];
}
/**
- * Alternative way to access a property
+ * Alternative way to access a property using the [] operator
* @param string
* @return Value
*/
Value operator[](const std::string &name) const
{
- return value()[name];
+ return _self[name];
}
-private:
/**
- * The zend_object
- * @var zend_object
+ * Retrieve a property by name
+ * @param string
+ * @return Value
+ */
+ Value property(const char *name) const
+ {
+ return _self[name];
+ }
+
+ /**
+ * Retrieve a property by name
+ * @param string
+ * @return Value
*/
- struct _zend_object *_object = nullptr;
+ Value property(const std::string &name) const
+ {
+ return _self[name];
+ }
+protected:
+ /**
+ * The zend_object
+ * @var Value
+ */
+ Object _self;
+
+private:
/**
* Private method to assign the zend object
* @param zend_object
*/
- void assign(struct _zend_object *object)
+ void assign(Value &&object)
{
// copy pointer
- _object = object;
+ _self = std::move(object);
}
/**