From 03a2749a311c75e0f34070b2d6f991855f329fc9 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Sun, 16 Mar 2014 15:22:00 +0100 Subject: [PATCH] removed Value constructor that wraps around a hash table --- include/value.h | 8 ++------ src/value.cpp | 18 ------------------ 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/include/value.h b/include/value.h index 94cc1cf0..d49ce4a6 100644 --- a/include/value.h +++ b/include/value.h @@ -112,12 +112,6 @@ class Value */ 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 @@ -445,6 +439,8 @@ class Value template std::vector vectorValue() const { + + // only works for arrays, other types return an empty vector if (!isArray()) return std::vector(); diff --git a/src/value.cpp b/src/value.cpp index a041967d..356df4a5 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -169,22 +169,6 @@ Value::Value(struct _zval_struct *val, bool ref) Z_SET_ISREF_P(_val); } -/** - * Wrap around a hash table - * @param ht Hashtable to wrap - */ -Value::Value(HashTable *ht) -{ - // construct a zval - MAKE_STD_ZVAL(_val); - Z_ARRVAL_P(_val) = ht; - Z_TYPE_P(_val) = IS_ARRAY; - - // add a reference - // @todo this may be wrong - Z_ADDREF_P(_val); -} - /** * Wrap around an object * @param object @@ -1572,8 +1556,6 @@ ValueIterator Value::begin() const if (isObject()) return ValueIterator(Z_OBJ_HT_P(_val)->get_properties(_val), true); // invalid - // @todo fix iterators without a hashtable - // @todo test Php::empty() function return ValueIterator(nullptr,true); }