You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2009/08/04 21:27:57 UTC
svn commit: r800931 - /qpid/trunk/qpid/cpp/include/qpid/Msg.h
Author: aconway
Date: Tue Aug 4 19:27:57 2009
New Revision: 800931
URL: http://svn.apache.org/viewvc?rev=800931&view=rev
Log:
Explicit Msg::op<< overrides for integral types, fixes a store compile problem.
Modified:
qpid/trunk/qpid/cpp/include/qpid/Msg.h
Modified: qpid/trunk/qpid/cpp/include/qpid/Msg.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/Msg.h?rev=800931&r1=800930&r2=800931&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/Msg.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/Msg.h Tue Aug 4 19:27:57 2009
@@ -43,14 +43,29 @@
Msg(const Msg& m) : os(m.str()) {}
std::string str() const { return os.str(); }
operator std::string() const { return str(); }
+
+ Msg& operator<<(long n) { os << n; return *this; }
+ Msg& operator<<(unsigned long n) { os << n; return *this; }
+ Msg& operator<<(bool n) { os << n; return *this; }
+ Msg& operator<<(short n) { os << n; return *this; }
+ Msg& operator<<(unsigned short n) { os << n; return *this; }
+ Msg& operator<<(int n) { os << n; return *this; }
+ Msg& operator<<(unsigned int n) { os << n; return *this; }
+#ifdef _GLIBCXX_USE_LONG_LONG
+ Msg& operator<<(long long n) { os << n; return *this; }
+ Msg& operator<<(unsigned long long n) { os << n; return *this; }
+#endif
+ Msg& operator<<(double n) { os << n; return *this; }
+ Msg& operator<<(float n) { os << n; return *this; }
+ Msg& operator<<(long double n) { os << n; return *this; }
+
+ template <class T> Msg& operator<<(const T& t) { os <<t; return *this; }
};
-template <class T> const Msg& operator<<(const Msg& m, const T& t) {
- const_cast<std::ostringstream&>(m.os)<<t; return m;
-}
+
inline std::ostream& operator<<(std::ostream& o, const Msg& m) {
- return o<<m.str();
+ return o << m.str();
}
/** Construct a message using operator << and append (file:line) */
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org