summaryrefslogtreecommitdiff
path: root/qpid/cpp/include
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/cpp/include')
-rw-r--r--qpid/cpp/include/qpid/qpid.i25
1 files changed, 25 insertions, 0 deletions
diff --git a/qpid/cpp/include/qpid/qpid.i b/qpid/cpp/include/qpid/qpid.i
index 7b3e898082..28a9064ebb 100644
--- a/qpid/cpp/include/qpid/qpid.i
+++ b/qpid/cpp/include/qpid/qpid.i
@@ -17,8 +17,33 @@
* under the License.
*/
+/*
+ * Need some magic to wrap getContentPtr, otherwise it could return char *
+ * containing NULL, which would be incorrectly interpreted as end of string
+ */
+%extend qpid::messaging::Message
+{
+ mystr getContentPtr()
+ {
+ mystr s;
+ s.ptr = self->getContentPtr();
+ s.len = self->getContentSize();
+ return s;
+ }
+}
+%ignore qpid::messaging::Message::getContentPtr;
+%typemap(out,fragment="SWIG_FromCharPtrAndSize") (mystr) {
+ %append_output(SWIG_FromCharPtrAndSize($1.ptr, $1.len));
+}
+
%{
+struct mystr
+{
+ size_t len;
+ const char *ptr;
+};
+
#include <qpid/messaging/exceptions.h>
#include <qpid/messaging/Address.h>
#include <qpid/messaging/Connection.h>