summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/xml/XmlExchange.cpp
diff options
context:
space:
mode:
authorJonathan Robie <jonathan@apache.org>2010-11-26 17:42:53 +0000
committerJonathan Robie <jonathan@apache.org>2010-11-26 17:42:53 +0000
commitff04bf79f43b19094d757f78c036ff07ea50e0ce (patch)
tree0267f3c11bee0b3eac0b675629a4240704a0e127 /cpp/src/qpid/xml/XmlExchange.cpp
parent395d3a13a48897a3289ec60b08c6cd9167103cc9 (diff)
downloadqpid-python-ff04bf79f43b19094d757f78c036ff07ea50e0ce.tar.gz
Binds integer, floating point, or string-typed headers using appropriate datatypes.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1039478 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/xml/XmlExchange.cpp')
-rw-r--r--cpp/src/qpid/xml/XmlExchange.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/cpp/src/qpid/xml/XmlExchange.cpp b/cpp/src/qpid/xml/XmlExchange.cpp
index 85a6cb4f57..b7ff5d211d 100644
--- a/cpp/src/qpid/xml/XmlExchange.cpp
+++ b/cpp/src/qpid/xml/XmlExchange.cpp
@@ -234,12 +234,23 @@ bool XmlExchange::matches(Query& query, Deliverable& msg, const qpid::framing::F
if (args) {
FieldTable::ValueMap::const_iterator v = args->begin();
for(; v != args->end(); ++v) {
- // ### TODO: Do types properly
- if (v->second->convertsTo<std::string>()) {
- QPID_LOG(trace, "XmlExchange, external variable: " << v->first << " = " << v->second->getData().getString().c_str());
- Item::Ptr value = context->getItemFactory()->createString(X(v->second->getData().getString().c_str()), context.get());
+
+ if (v->second->convertsTo<double>()) {
+ QPID_LOG(trace, "XmlExchange, external variable (double): " << v->first << " = " << v->second->get<double>());
+ Item::Ptr value = context->getItemFactory()->createDouble(v->second->get<double>(), context.get());
+ context->setExternalVariable(X(v->first.c_str()), value);
+ }
+ else if (v->second->convertsTo<int>()) {
+ QPID_LOG(trace, "XmlExchange, external variable (int):" << v->first << " = " << v->second->getData().getInt());
+ Item::Ptr value = context->getItemFactory()->createInteger(v->second->get<int>(), context.get());
context->setExternalVariable(X(v->first.c_str()), value);
}
+ else if (v->second->convertsTo<std::string>()) {
+ QPID_LOG(trace, "XmlExchange, external variable (string):" << v->first << " = " << v->second->getData().getString().c_str());
+ Item::Ptr value = context->getItemFactory()->createString(X(v->second->get<std::string>().c_str()), context.get());
+ context->setExternalVariable(X(v->first.c_str()), value);
+ }
+
}
}