diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-04-09 10:24:13 +0200 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2014-04-09 10:24:13 +0200 |
commit | 882e5243767bd4cc143aceaae4133f92a762c6af (patch) | |
tree | 9d395f7c1f12752982bbade94f898cec8a794bc7 /include | |
parent | 3953d8833e070fa1d6cc7b264dd19ed56c909f02 (diff) |
added unset function (request from issue #71)
Diffstat (limited to 'include')
-rw-r--r-- | include/call.h | 8 | ||||
-rw-r--r-- | include/hashmember.h | 3 |
2 files changed, 7 insertions, 4 deletions
diff --git a/include/call.h b/include/call.h index 6c5dd8f..1fb1462 100644 --- a/include/call.h +++ b/include/call.h @@ -50,6 +50,7 @@ inline Value array_key_exists(const char *key, const Value &array) { return arra inline Value array_key_exists(const std::string &key, const Value &array) { return array.contains(key); } inline Value array_keys(const Value &value) { return call("array_keys", value); } inline Value array_values(const Value &value) { return call("array_values", value); } +inline Value count(const Value &value) { return call("count", value); } inline Value echo(const char *input) { out << input; return nullptr; } inline Value echo(const std::string &input) { out << input; return nullptr; } inline Value empty(const Value &value) { return value.isNull() || !value.boolValue(); } @@ -57,9 +58,10 @@ inline Value empty(const HashMember<std::string> &member) { return !member.exist inline Value empty(const HashMember<int> &member) { return !member.exists() || empty(member.value()); } inline Value ini_get(const Value &value) { return call("ini_get", value); } inline Value is_array(const Value &value) { return value.isArray(); } -inline void unset(HashMember<std::string> &member) { member.unset(); } -inline void unset(HashMember<int> &member) { member.unset(); } -inline void unset(HashMember<Value> &member) { member.unset(); } +inline Value strlen(const Value &value) { return call("strlen", value); } +inline void unset(const HashMember<std::string> &member) { member.unset(); } +inline void unset(const HashMember<int> &member) { member.unset(); } +inline void unset(const HashMember<Value> &member) { member.unset(); } /** * The isset function conflicts with the 'isset' macro defined by the Zend engine diff --git a/include/hashmember.h b/include/hashmember.h index 1a29548..6853228 100644 --- a/include/hashmember.h +++ b/include/hashmember.h @@ -497,7 +497,7 @@ public: /** * Unset the member */ - void unset() + void unset() const { _parent->unset(_index); } @@ -599,6 +599,7 @@ private: * Friend classes */ friend class HashMember<std::string>; + friend class HashMember<Value>; friend class HashMember<int>; friend class Base; friend class Value; |