Skip to content

Commit 73435ab

Browse files
author
mikhail_beris
committed
Implement 'source' directive and wrapper.
NOTE: tested and written in Mac OSX (darwin)
1 parent 8c542d2 commit 73435ab

File tree

5 files changed

+17
-1
lines changed

5 files changed

+17
-1
lines changed

boost/network/message.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ namespace boost { namespace network {
4949
std::string & body() const {
5050
return _body;
5151
};
52+
53+
std::string & source() const {
54+
return _source;
55+
};
5256

5357
private:
5458

@@ -57,6 +61,7 @@ namespace boost { namespace network {
5761

5862
mutable headers_container_type _headers;
5963
mutable std::string _body;
64+
mutable std::string _source;
6065
};
6166

6267
typedef basic_message<> message; // default message type

boost/network/message/directives.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <boost/network/message/directives/header.hpp>
1414
#include <boost/network/message/directives/body.hpp>
15+
#include <boost/network/message/directives/source.hpp>
1516

1617
namespace boost { namespace network {
1718

boost/network/message/wrappers.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
*/
1414
#include <boost/network/message/wrappers/headers.hpp>
1515
#include <boost/network/message/wrappers/body.hpp>
16+
#include <boost/network/message/wrappers/source.hpp>
1617

1718
#endif // __NETWORK_MESSAGE_WRAPPERS_HPP__

libs/network/test/Jamfile.v2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ project network_test :
88
requirements
99
<include>../../../
1010
<source>/boost//unit_test_framework
11+
<link>static
1112
;
1213

1314
unit-test message_test : message_test.cpp ;

libs/network/test/message_test.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ BOOST_AUTO_TEST_CASE(header_directives_test) {
2929
message msg;
3030
msg << header("SOME_HEADER", "SOME_CONTENT") ;
3131

32-
BOOST_CHECK_EQUAL( headers(msg).count("SOME_HEADER") , 1 );
32+
BOOST_CHECK_EQUAL( headers(msg).count("SOME_HEADER") , (size_t) 1 );
3333
headers_range<message>::type range = headers(msg)["SOME_HEADER"];
3434
BOOST_CHECK( range.first != range.second );
3535
}
@@ -41,3 +41,11 @@ BOOST_AUTO_TEST_CASE(body_directive_test) {
4141

4242
BOOST_CHECK_EQUAL( body(msg), "The quick brown fox jumps over the lazy dog.");
4343
}
44+
45+
BOOST_AUTO_TEST_CASE(source_directive_test) {
46+
using namespace boost::network;
47+
message msg;
48+
msg << source("Somewhere Out There") ;
49+
50+
BOOST_CHECK_EQUAL( source(msg), "Somewhere Out There");
51+
}

0 commit comments

Comments
 (0)