diff options
| author | Alan Conway <aconway@apache.org> | 2013-12-20 02:01:56 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2013-12-20 02:01:56 +0000 |
| commit | 3d3057235cb58c78aa35c985e7d13bce163a4ae8 (patch) | |
| tree | 045bdeb144aad4d2b1733b5c8fa8c011d3591910 /qpid/cpp/src | |
| parent | 4af75997444193adc0947cb8ec367ce1887ceb2d (diff) | |
| download | qpid-python-3d3057235cb58c78aa35c985e7d13bce163a4ae8.tar.gz | |
NO-JIRA: Added ostream operator for qpid::Messaging::Message
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1552476 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
| -rw-r--r-- | qpid/cpp/src/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | qpid/cpp/src/qpid/messaging/Message_ostream.cpp | 45 |
2 files changed, 46 insertions, 0 deletions
diff --git a/qpid/cpp/src/CMakeLists.txt b/qpid/cpp/src/CMakeLists.txt index 9780343ecf..43037ee2bf 100644 --- a/qpid/cpp/src/CMakeLists.txt +++ b/qpid/cpp/src/CMakeLists.txt @@ -1064,6 +1064,7 @@ set (qpidmessaging_SOURCES qpid/messaging/ConnectionOptions.cpp qpid/messaging/MessageImpl.h qpid/messaging/MessageImpl.cpp + qpid/messaging/Message_ostream.cpp qpid/messaging/ProtocolRegistry.cpp qpid/messaging/amqp/EncodedMessage.h qpid/messaging/amqp/EncodedMessage.cpp diff --git a/qpid/cpp/src/qpid/messaging/Message_ostream.cpp b/qpid/cpp/src/qpid/messaging/Message_ostream.cpp new file mode 100644 index 0000000000..6adae12315 --- /dev/null +++ b/qpid/cpp/src/qpid/messaging/Message_ostream.cpp @@ -0,0 +1,45 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +#include "qpid/messaging/Message_ostream.h" +#include <ostream> + +namespace qpid { +namespace messaging { + +using namespace std; +ostream& operator<<(ostream& o, const Message& message) { + o << "Message(properties=" << message.getProperties(); + if (!message.getSubject().empty()) { + o << ", subject='" << message.getSubject() << "'"; + } + if (!message.getContentObject().isVoid()) { + o << ", content='"; + if (message.getContentType() == "amqp/map") { + o << message.getContentObject().asMap(); + } else { + o << message.getContentObject(); + } + } + o << "')"; + return o; +} + +}} // namespace qpid::messaging |
