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 | 8a47e2ca2d735ef54dc0be6cb4d8c21c60a8e5fa (patch) | |
tree | b6f38cbabc54d22702ec11873a4656d1f044c866 /cpp | |
parent | 0bb03d6ee3ef1f277b9aaee9ad64417669f04e95 (diff) | |
download | qpid-python-8a47e2ca2d735ef54dc0be6cb4d8c21c60a8e5fa.tar.gz |
NO-JIRA: make qpid-send send as string not binary
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1679556 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/tests/qpid-send.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/cpp/src/tests/qpid-send.cpp b/cpp/src/tests/qpid-send.cpp index 970944f8d0..bc0ad78601 100644 --- a/cpp/src/tests/qpid-send.cpp +++ b/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: |