diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/array.h | 7 | ||||
-rw-r--r-- | include/globals.h | 2 | ||||
-rw-r--r-- | include/hashmember.h | 30 | ||||
-rw-r--r-- | include/value.h | 19 |
4 files changed, 36 insertions, 22 deletions
diff --git a/include/array.h b/include/array.h index dcd5e5f..26fec24 100644 --- a/include/array.h +++ b/include/array.h @@ -12,7 +12,7 @@ * Set up namespace */ namespace Php { - + /** * Class definition */ @@ -124,11 +124,6 @@ public: }; /** - * Define for arrays and objects - */ -using Array = Array; - -/** * End of namespace */ } diff --git a/include/globals.h b/include/globals.h index 0278c88..b996131 100644 --- a/include/globals.h +++ b/include/globals.h @@ -68,7 +68,7 @@ public: }; /** - * We always have one instance + * We always have one instance of the GLOBALS instance * @var Globals */ extern Globals &GLOBALS; diff --git a/include/hashmember.h b/include/hashmember.h index 65ca23d..41c40d3 100644 --- a/include/hashmember.h +++ b/include/hashmember.h @@ -43,7 +43,7 @@ public: HashMember &operator=(const Value &value) { // set property in parent array - _base.set(_index, value); + _base->set(_index, value); // if there is a parent, it should sets its value too if (_parent) _parent->operator=(_base); @@ -58,7 +58,7 @@ public: */ Value value() const { - return _base.get(_index); + return _base->get(_index); } /** @@ -67,7 +67,7 @@ public: */ operator Value () const { - return _base.get(_index); + return _base->get(_index); } /** @@ -76,7 +76,7 @@ public: */ operator int16_t () const { - return _base.get(_index).numericValue(); + return _base->get(_index).numericValue(); } /** @@ -85,7 +85,7 @@ public: */ operator int32_t () const { - return _base.get(_index).numericValue(); + return _base->get(_index).numericValue(); } /** @@ -94,7 +94,7 @@ public: */ operator int64_t () const { - return _base.get(_index).numericValue(); + return _base->get(_index).numericValue(); } /** @@ -103,7 +103,7 @@ public: */ operator bool () const { - return _base.get(_index).boolValue(); + return _base->get(_index).boolValue(); } /** @@ -112,7 +112,7 @@ public: */ operator std::string () const { - return _base.get(_index).stringValue(); + return _base->get(_index).stringValue(); } /** @@ -121,7 +121,7 @@ public: */ operator const char * () const { - return _base.get(_index).rawValue(); + return _base->get(_index).rawValue(); } /** @@ -130,7 +130,7 @@ public: */ operator double () const { - return _base.get(_index).decimalValue(); + return _base->get(_index).decimalValue(); } /** @@ -141,7 +141,7 @@ public: */ HashMember operator[](int index) { - return _base.get(_index)[index].add(this); + return _base->get(_index)[index].add(this); } /** @@ -152,7 +152,7 @@ public: */ HashMember operator[](const std::string &key) { - return _base.get(_index)[key].add(this); + return _base->get(_index)[key].add(this); } /** @@ -163,7 +163,7 @@ public: */ HashMember operator[](const char *key) { - return _base.get(_index)[key].add(this); + return _base->get(_index)[key].add(this); } /** @@ -359,7 +359,7 @@ private: * @param base Base value * @param index Index in the array */ - HashMember(const Value *base, Type index) : _base(*base), _index(index) {} + HashMember(Value *base, Type index) : _base(base), _index(index) {} // @todo add move constructor @@ -390,7 +390,7 @@ private: * Base value * @var Value */ - Value _base; + Value *_base; /** * Parent member (in case of nested members) diff --git a/include/value.h b/include/value.h index f2850c9..9c48f1f 100644 --- a/include/value.h +++ b/include/value.h @@ -112,6 +112,12 @@ public: Value(struct _zval_struct *zval, bool ref = false); /** + * Wrap around a hash table + * @param ht Hashtable to wrap + */ + Value(struct _hashtable *ht); + + /** * Wrap around an object implemented by us * @param object Object to be wrapped */ @@ -846,6 +852,18 @@ protected: struct _zval_struct *detach(); /** + * Attach a different zval + * + * This will first detach the current zval, and link the Value object to + * a different zval. Versions exist to attach to a zval and to an entire + * hash table + * + * @param val + */ + void attach(struct _zval_struct *val); + void attach(struct _hashtable *hashtable); + + /** * Set a certain property without running any checks (you must already know * for sure that this is an array, and that the index is not yet in use) * @@ -874,6 +892,7 @@ protected: friend class Member; friend class ClassBase; friend class Iterator; + friend class Extension; }; /** |