summaryrefslogtreecommitdiff
path: root/zend/value.cpp
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-06-11 18:02:25 +0200
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-06-11 18:02:25 +0200
commit104cc016c84ece1d5d28aef921bb39f1f2f1e8f7 (patch)
tree9f51b15fe009eb4a3516969e1a6d90d3db8ad172 /zend/value.cpp
parentb17b09c3b482f51a842f5272e88a7ed2820a1925 (diff)
parent4f3769855dd65a8ef0b647c7e98860b8aa747c26 (diff)
Merge pull request #95 from valmat/FixCompareOp
Comparison operators for hardcoded Php::Value
Diffstat (limited to 'zend/value.cpp')
-rw-r--r--zend/value.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/zend/value.cpp b/zend/value.cpp
index 7592f57..6458bd5 100644
--- a/zend/value.cpp
+++ b/zend/value.cpp
@@ -1312,6 +1312,36 @@ Value Value::exec(const char *name, int argc, struct _zval_struct ***params)
}
/**
+ * Comparison operators== for hardcoded Value
+ * @param value
+ */
+bool Value::operator==(const Value &value) const
+{
+ zval result;
+ if(SUCCESS != compare_function(&result, _val, value._val TSRMLS_CC) )
+ {
+ throw Php::Exception("Not comparable");
+ return false;
+ }
+ return (0 == result.value.lval);
+}
+
+/**
+ * Comparison operators< for hardcoded Value
+ * @param value
+ */
+bool Value::operator< (const Value &value) const
+{
+ zval result;
+ if(SUCCESS != compare_function(&result, _val, value._val TSRMLS_CC) )
+ {
+ throw Php::Exception("Not comparable");
+ return false;
+ }
+ return (-1 == result.value.lval);
+}
+
+/**
* The type of object
* @return Type
*/