summaryrefslogtreecommitdiff
path: root/zend
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-11-21 11:23:05 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-11-21 11:23:05 +0100
commitd0ee242b3a617fa8676e56388ce01a8a676bf7d1 (patch)
tree398c35f97acde6b4417578c01bf0c08f3786c722 /zend
parent069beaa49325728e0eff0ba13fa480604ce43a84 (diff)
fixed issue 107, casting a value to a std::map was not working correctly
Diffstat (limited to 'zend')
-rw-r--r--zend/value.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/zend/value.cpp b/zend/value.cpp
index dfea847..544926a 100644
--- a/zend/value.cpp
+++ b/zend/value.cpp
@@ -1738,7 +1738,7 @@ ValueIterator Value::createIterator(bool begin) const
// check type
if (isArray()) return ValueIterator(new HashIterator(Z_ARRVAL_P(_val), begin, true));
- // get access to the hast table
+ // get access to the hash table
if (isObject())
{
// we need the TSRMLS_CC variable
@@ -1786,6 +1786,20 @@ ValueIterator Value::end() const
}
/**
+ * Iterate over key value pairs
+ * @param callback
+ */
+void Value::iterate(const std::function<void(const Php::Value &,const Php::Value &)> &callback) const
+{
+ // iterate over the object
+ for (const auto &iter : *this)
+ {
+ // call the callback
+ callback(iter.first, iter.second);
+ }
+}
+
+/**
* Does the array contain a certain index?
* @param index
* @return bool