Last change
on this file since 10767 was 10653, checked in by Michael Tänzer, 12 years ago |
Merge the ASIO branch back into trunk
|
File size:
827 bytes
|
Rev | Line | |
---|
| 1 | //-----------------------------------------------------------------------------
|
---|
| 2 | // Part of reboost (http://reboost.org). Released under the
|
---|
| 3 | // BSD 2-clause license (http://www.opensource.org/licenses/bsd-license.php).
|
---|
| 4 | // Copyright 2012, Sebastian Mies <mies@reboost.org> --- All rights reserved.
|
---|
| 5 | //-----------------------------------------------------------------------------
|
---|
| 6 |
|
---|
| 7 | #include "message.hpp"
|
---|
| 8 | #include<iostream>
|
---|
| 9 |
|
---|
| 10 | namespace reboost {
|
---|
| 11 |
|
---|
| 12 | struct to_stream {
|
---|
| 13 | std::ostream& os;
|
---|
| 14 | int i;
|
---|
| 15 | inline void operator()(buffer_t buf) {
|
---|
| 16 | if (i!=0) os <<",";
|
---|
| 17 | os << buf;
|
---|
| 18 | i++;
|
---|
| 19 | }
|
---|
| 20 | };
|
---|
| 21 |
|
---|
| 22 | std::ostream& operator<<(std::ostream& os, const message_t m) {
|
---|
| 23 | struct to_stream ts = { os, 0 };
|
---|
| 24 | os << "message({size=" << m.size() << ",buffers=" << (int) m.length()
|
---|
| 25 | << ",hash=" << m.hash() << "},";
|
---|
| 26 | m.foreach(ts);
|
---|
| 27 | os << ")";
|
---|
| 28 | return os;
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.