Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET
Apache Qpid Documentation
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
qpid
Msg.h
Go to the documentation of this file.
1
#ifndef QPID_MSG_H
2
#define QPID_MSG_H
3
4
/*
5
*
6
* Licensed to the Apache Software Foundation (ASF) under one
7
* or more contributor license agreements. See the NOTICE file
8
* distributed with this work for additional information
9
* regarding copyright ownership. The ASF licenses this file
10
* to you under the Apache License, Version 2.0 (the
11
* "License"); you may not use this file except in compliance
12
* with the License. You may obtain a copy of the License at
13
*
14
* http://www.apache.org/licenses/LICENSE-2.0
15
*
16
* Unless required by applicable law or agreed to in writing,
17
* software distributed under the License is distributed on an
18
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19
* KIND, either express or implied. See the License for the
20
* specific language governing permissions and limitations
21
* under the License.
22
*
23
*/
24
25
#include <sstream>
26
#include <iostream>
27
#include "
qpid/types/ImportExport.h
"
28
29
namespace
qpid {
30
41
struct
Msg
{
42
std::ostringstream
os
;
43
Msg
() {}
44
Msg
(
const
Msg
& m) :
os
(m.
str
()) {}
45
std::string
str
()
const
{
return
os
.str(); }
46
operator
std::string()
const
{
return
str
(); }
47
48
Msg
&
operator<<
(
long
n) {
os
<< n;
return
*
this
; }
49
Msg
&
operator<<
(
unsigned
long
n) {
os
<< n;
return
*
this
; }
50
Msg
&
operator<<
(
bool
n) {
os
<< n;
return
*
this
; }
51
Msg
&
operator<<
(
short
n) {
os
<< n;
return
*
this
; }
52
Msg
&
operator<<
(
unsigned
short
n) {
os
<< n;
return
*
this
; }
53
Msg
&
operator<<
(
int
n) {
os
<< n;
return
*
this
; }
54
Msg
&
operator<<
(
unsigned
int
n) {
os
<< n;
return
*
this
; }
55
#ifdef _GLIBCXX_USE_LONG_LONG
56
Msg
&
operator<<
(
long
long
n) {
os
<< n;
return
*
this
; }
57
Msg
&
operator<<
(
unsigned
long
long
n) {
os
<< n;
return
*
this
; }
58
#endif
59
Msg
&
operator<<
(
double
n) {
os
<< n;
return
*
this
; }
60
Msg
&
operator<<
(
float
n) {
os
<< n;
return
*
this
; }
61
Msg
&
operator<<
(
long
double
n) {
os
<< n;
return
*
this
; }
62
63
template
<
class
T>
Msg
&
operator<<
(
const
T& t) {
os
<<t;
return
*
this
; }
64
};
65
66
67
68
inline
std::ostream&
operator<<
(std::ostream& o,
const
Msg
& m) {
69
return
o << m.
str
();
70
}
71
73
#define QUOTE_(x) #x
74
#define QUOTE(x) QUOTE_(x)
75
#define QPID_MSG(message) (::qpid::Msg() << message << " (" __FILE__ ":" QUOTE(__LINE__) ")")
76
77
}
// namespace qpid
78
79
#endif
Qpid C++ API Reference
Generated on Tue Jul 2 2013 for Qpid C++ Client API by
1.8.1.1