summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorAndrew Stitcher <astitcher@apache.org>2013-03-05 19:48:32 +0000
committerAndrew Stitcher <astitcher@apache.org>2013-03-05 19:48:32 +0000
commit2519ee6e5cf827c76d382341dac2e826c8ff352b (patch)
tree477a753912038b252fde908452aad7e135117436 /cpp/src
parentdfada942aa6795a44bcf6988fc300d0767c994e8 (diff)
downloadqpid-python-2519ee6e5cf827c76d382341dac2e826c8ff352b.tar.gz
QPID-4558: Selectors for C++ broker
- Small fixes: * Missing include file (accidentally included under gcc) * Workaround some strange VS 2008 issue. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1452960 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/broker/SelectorToken.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/cpp/src/qpid/broker/SelectorToken.cpp b/cpp/src/qpid/broker/SelectorToken.cpp
index 509d56af4b..3fd4abbc49 100644
--- a/cpp/src/qpid/broker/SelectorToken.cpp
+++ b/cpp/src/qpid/broker/SelectorToken.cpp
@@ -25,6 +25,7 @@
#include <algorithm>
#include <iostream>
#include <cassert>
+#include <cctype>
namespace qpid {
namespace broker {
@@ -93,7 +94,7 @@ struct RWEntry {
TokenType type;
};
-bool caseless(const char* s1, const char* s2)
+inline bool caseless(const char* s1, const char* s2)
{
do {
char ls1 = std::tolower(*s1);
@@ -107,12 +108,8 @@ bool caseless(const char* s1, const char* s2)
return false;
}
-bool operator<(const RWEntry& r, const char* rhs) {
- return caseless(r.word, rhs);
-}
-
-bool operator<(const char* rhs, const RWEntry& r) {
- return caseless(rhs, r.word);
+inline bool operator<(const RWEntry& lhs, const RWEntry& rhs) {
+ return caseless(lhs.word, rhs.word);
}
}
@@ -138,7 +135,9 @@ bool tokeniseReservedWord(Token& tok)
if ( tok.type != T_IDENTIFIER ) return false;
- std::pair<const RWEntry*, const RWEntry*> entry = std::equal_range(&reserved[0], &reserved[reserved_size], tok.val.c_str());
+ RWEntry rw;
+ rw.word = tok.val.c_str();
+ std::pair<const RWEntry*, const RWEntry*> entry = std::equal_range(&reserved[0], &reserved[reserved_size], rw);
if ( entry.first==entry.second ) return false;