summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker/SelectorValue.cpp
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2013-03-18 18:43:07 +0000
committerAndrew Stitcher <astitcher@apache.org>2013-03-18 18:43:07 +0000
commit0014f3a7ff29f0fade054cfe5630afd0b8efd856 (patch)
tree15ee76abbd33fbd2138190ba32428c50c2c04f1e /cpp/src/qpid/broker/SelectorValue.cpp
parent06cfc6f506b2683837fe1fdccaaa5dac02b6de80 (diff)
downloadqpid-python-0014f3a7ff29f0fade054cfe5630afd0b8efd856.tar.gz
QPID-4621: Arithmetic operations for C++ broker selectors
- Rearranged Syntax and parser to support arithmetic - Implemented arithmetic syntax - Implemented arithmetic operators - Added some tests for arithmetic operations - Added explicit lexical tokens for all the comparison and arithmetic operations - Added the missing ',' token for us in the 'IN' comparison - Rearranged the lexer so that everything is not uniformly inside the hand crafted state machine. - Moved a bunch of testing code from the tokeniser to the unit test (much of this code might actually not be very useful anymore) git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1457912 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/SelectorValue.cpp')
-rw-r--r--cpp/src/qpid/broker/SelectorValue.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/cpp/src/qpid/broker/SelectorValue.cpp b/cpp/src/qpid/broker/SelectorValue.cpp
index 83a9240dcb..de097b8969 100644
--- a/cpp/src/qpid/broker/SelectorValue.cpp
+++ b/cpp/src/qpid/broker/SelectorValue.cpp
@@ -194,4 +194,17 @@ Value operator/(const Value& v1, const Value& v2)
return Value();
}
+Value operator-(const Value& v)
+{
+ switch (v.type) {
+ case Value::T_EXACT:
+ return -v.i;
+ case Value::T_INEXACT:
+ return -v.x;
+ default:
+ break;
+ }
+ return Value();
+}
+
}}