summaryrefslogtreecommitdiff
path: root/qpid/cpp/include
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2013-09-05 20:38:15 +0000
committerGordon Sim <gsim@apache.org>2013-09-05 20:38:15 +0000
commit1f7c48655eed7f9cd5c16a9c4de047e8cd68f6fe (patch)
tree3b4704b88ac30c27388aea0fd48635b40fff9f70 /qpid/cpp/include
parentb77cf451426f3b9712f1ae41e57e09f9d2edf403 (diff)
downloadqpid-python-1f7c48655eed7f9cd5c16a9c4de047e8cd68f6fe.tar.gz
QPID-5104: make handling of properties in swigged impl match the pure python impl more closely
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1520416 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/include')
-rw-r--r--qpid/cpp/include/qpid/messaging/Message.h1
-rw-r--r--qpid/cpp/include/qpid/swig_python_typemaps.i10
2 files changed, 10 insertions, 1 deletions
diff --git a/qpid/cpp/include/qpid/messaging/Message.h b/qpid/cpp/include/qpid/messaging/Message.h
index 10569eb006..6315d3e86f 100644
--- a/qpid/cpp/include/qpid/messaging/Message.h
+++ b/qpid/cpp/include/qpid/messaging/Message.h
@@ -149,6 +149,7 @@ class QPID_MESSAGING_CLASS_EXTERN Message
*/
QPID_MESSAGING_EXTERN const qpid::types::Variant::Map& getProperties() const;
QPID_MESSAGING_EXTERN qpid::types::Variant::Map& getProperties();
+ QPID_MESSAGING_EXTERN void setProperties(const qpid::types::Variant::Map&);
/**
* Set the content to the data held in the string parameter. Note:
diff --git a/qpid/cpp/include/qpid/swig_python_typemaps.i b/qpid/cpp/include/qpid/swig_python_typemaps.i
index 25a4e46b18..ef32012693 100644
--- a/qpid/cpp/include/qpid/swig_python_typemaps.i
+++ b/qpid/cpp/include/qpid/swig_python_typemaps.i
@@ -61,6 +61,11 @@ typedef int Py_ssize_t;
if (PyInt_Check(value)) return qpid::types::Variant(int64_t(PyInt_AS_LONG(value)));
if (PyLong_Check(value)) return qpid::types::Variant(int64_t(PyLong_AsLongLong(value)));
if (PyString_Check(value)) return qpid::types::Variant(std::string(PyString_AS_STRING(value)));
+ if (PyUnicode_Check(value)) {
+ qpid::types::Variant v(std::string(PyUnicode_AS_DATA(value)));
+ v.setEncoding("utf8");
+ return v;
+ }
if (PyDict_Check(value)) {
qpid::types::Variant::Map map;
PyToMap(value, &map);
@@ -116,7 +121,10 @@ typedef int Py_ssize_t;
}
case qpid::types::VAR_STRING : {
const std::string val(v->asString());
- result = PyString_FromStringAndSize(val.c_str(), val.size());
+ if (v->getEncoding() == "utf8")
+ result = PyUnicode_FromStringAndSize(val.c_str(), val.size());
+ else
+ result = PyString_FromStringAndSize(val.c_str(), val.size());
break;
}
case qpid::types::VAR_MAP : {