diff options
author | Gordon Sim <gsim@apache.org> | 2015-05-15 12:54:49 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2015-05-15 12:54:49 +0000 |
commit | ef6d477272d66bbd7d7bd68eb0a89af81e9d42a8 (patch) | |
tree | cfa6cc8043e28b24dd1066ad0075a3628b1f0d05 | |
parent | 83618bbe72936e8c358dd20be48bca483cc69d3a (diff) | |
download | qpid-python-ef6d477272d66bbd7d7bd68eb0a89af81e9d42a8.tar.gz |
NO-JIRA: make qpid-send send as string not binary
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1679556 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/tests/qpid-send.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/qpid/cpp/src/tests/qpid-send.cpp b/qpid/cpp/src/tests/qpid-send.cpp index 970944f8d0..bc0ad78601 100644 --- a/qpid/cpp/src/tests/qpid-send.cpp +++ b/qpid/cpp/src/tests/qpid-send.cpp @@ -234,14 +234,23 @@ class ContentGenerator { public: virtual ~ContentGenerator() {} virtual bool setContent(Message& msg) = 0; + void setContentObject(Message& msg, const std::string& content, const std::string& encoding=std::string("utf8")) + { + Variant& obj = msg.getContentObject(); + obj = content; + obj.setEncoding(encoding); + } }; + class GetlineContentGenerator : public ContentGenerator { public: virtual bool setContent(Message& msg) { string content; bool got = !!getline(std::cin, content); - if (got) msg.setContentObject(content); + if (got) { + setContentObject(msg, content); + } return got; } }; @@ -250,7 +259,7 @@ class FixedContentGenerator : public ContentGenerator { public: FixedContentGenerator(const string& s) : content(s) {} virtual bool setContent(Message& msg) { - msg.setContentObject(content); + setContentObject(msg, content); return true; } private: |