Skip to content

Commit 6565e06

Browse files
committed
Adding missing files.
1 parent 78363fc commit 6565e06

File tree

11 files changed

+566
-0
lines changed

11 files changed

+566
-0
lines changed

boost/network/constants.hpp

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
#ifndef BOOST_NETWORK_CONSTANTS_HPP_20100808
2+
#define BOOST_NETWORK_CONSTANTS_HPP_20100808
3+
4+
// Copyright 2010 (C) Dean Michael Berris
5+
// Distributed under the Boost Software License, Version 1.0.
6+
// (See accompanying file LICENSE_1_0.txt or copy at
7+
// http://www.boost.org/LICENSE_1_0.txt)
8+
9+
#include <boost/network/support/is_default_string.hpp>
10+
#include <boost/network/support/is_default_wstring.hpp>
11+
#include <boost/mpl/if.hpp>
12+
13+
namespace boost { namespace network {
14+
15+
namespace impl {
16+
template <class Tag>
17+
struct constants_narrow {
18+
19+
static char const * crlf() {
20+
static char crlf_[] = { '\r', '\n', 0 };
21+
return crlf_;
22+
}
23+
24+
static char const * dot() {
25+
static char dot_[] = { '.', 0 };
26+
return dot_;
27+
}
28+
29+
static char const * http_slash() {
30+
static char http_slash_[] = { 'H', 'T', 'T', 'P', '/', 0 };
31+
return http_slash_;
32+
}
33+
34+
static char const * space() {
35+
static char space_[] = {' ', 0};
36+
return space_;
37+
}
38+
39+
static char const * slash() {
40+
static char slash_[] = {'/', 0};
41+
return slash_;
42+
}
43+
44+
static char const * host() {
45+
static char host_[] = {'H', 'o', 's', 't', 0};
46+
return host_;
47+
}
48+
49+
static char const * colon() {
50+
static char colon_[] = {':', 0};
51+
return colon_;
52+
}
53+
54+
static char const * accept() {
55+
static char accept_[] = {'A', 'c', 'c', 'e', 'p', 't', 0};
56+
return accept_;
57+
}
58+
59+
static char const * default_accept_mime() {
60+
static char mime_[] = {
61+
'*', '/', '*', 0
62+
};
63+
return mime_;
64+
}
65+
66+
static char const * accept_encoding() {
67+
static char accept_encoding_[] = {
68+
'A','c','c','e','p','t','-','E','n','c','o','d','i','n','g',0
69+
};
70+
return accept_encoding_;
71+
}
72+
73+
static char const * default_accept_encoding() {
74+
static char default_accept_encoding_[] = {
75+
'i','d','e','n','t','i','t','y',';','q','=','1','.','0',',',' ','*',';','q','=','0',0
76+
};
77+
return default_accept_encoding_;
78+
}
79+
80+
static char const * user_agent() {
81+
static char user_agent_[] = {
82+
'U','s','e','r','-','A','g','e','n','t',0
83+
};
84+
return user_agent_;
85+
}
86+
87+
static char const * cpp_netlib_slash() {
88+
static char cpp_netlib_slash_[] = {
89+
'c','p','p','-','n','e','t','l','i','b','/',0
90+
};
91+
return cpp_netlib_slash_;
92+
}
93+
94+
};
95+
96+
template <class Tag>
97+
struct constants_wide {
98+
};
99+
}
100+
101+
template <class Tag>
102+
struct constants :
103+
mpl::if_<
104+
is_default_string<Tag>,
105+
impl::constants_narrow<Tag>,
106+
typename mpl::if_<
107+
is_default_wstring<Tag>,
108+
impl::constants_wide<Tag>,
109+
unsupported_tag<Tag>
110+
>::type
111+
>::type
112+
{};
113+
114+
} // namespace network
115+
116+
} // namespace boost
117+
118+
#endif // BOOST_NETWORK_CONSTANTS_HPP_20100808
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
#ifndef BOOST_NETWORK_MESSAGE_MODIFIER_ADD_HEADER_HPP_20100824
3+
#define BOOST_NETWORK_MESSAGE_MODIFIER_ADD_HEADER_HPP_20100824
4+
5+
// Copyright 2010 (c) Dean Michael Berris
6+
// Distributed under the Boost Software License, Version 1.0.
7+
// (See accompanying file LICENSE_1_0.txt or copy at
8+
// http://www.boost.org/LICENSE_1_0.txt)
9+
10+
#include <boost/network/support/is_async.hpp>
11+
12+
namespace boost { namespace network {
13+
14+
namespace impl {
15+
template <class Message, class KeyType, class ValueType>
16+
inline void add_header(Message const & message, KeyType const & key, ValueType const & value, tags::default_string const &, mpl::false_ const &) {
17+
message.headers().insert(std::make_pair(key, value));
18+
}
19+
20+
template <class Message, class KeyType, class ValueType>
21+
inline void add_header(Message const & message, KeyType const & key, ValueType const & value, tags::default_wstring const &, mpl::false_ const &) {
22+
message.headers().insert(std::make_pair(key, value));
23+
}
24+
25+
template <class Message, class KeyType, class ValueType>
26+
inline void add_header(Message const & message, KeyType const & key, ValueType const & value, tags::async const &, mpl::true_ const &) {
27+
message.add_header(std::make_pair(key, value));
28+
}
29+
30+
}
31+
32+
template <class Tag, template <class> class Message, class KeyType, class ValueType>
33+
inline void add_header(Message<Tag> const & message, KeyType const & key, ValueType const & value) {
34+
impl::add_header(message, key, value, Tag(), is_async<Tag>());
35+
}
36+
37+
} // namespace network
38+
39+
} // namespace boost
40+
41+
#endif // BOOST_NETWORK_MESSAGE_MODIFIER_ADD_HEADER_HPP_20100824
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#ifndef BOOST_NETWORK_MODIFIERS_BODY_HPP_20100824
2+
#define BOOST_NETWORK_MODIFIERS_BODY_HPP_20100824
3+
4+
// Copyright 2010 (c) Dean Michael Berris
5+
// Distributed under the Boost Software License, Version 1.0.
6+
// (See accompanying file LICENSE_1_0.txt or copy at
7+
// http://www.boost.org/LICENSE_1_0.txt)
8+
9+
#include <boost/network/support/is_async.hpp>
10+
#include <boost/thread/future.hpp>
11+
12+
namespace boost { namespace network {
13+
14+
namespace impl {
15+
16+
template <class Message, class ValueType, class Tag>
17+
inline void body(Message const & message, ValueType const & body_, Tag const &, mpl::false_ const &) {
18+
message.body(body_);
19+
}
20+
21+
template <class Message, class ValueType, class Tag>
22+
inline void body(Message const & message, ValueType const & body_, Tag const &, mpl::true_ const &) {
23+
message.body(body_);
24+
}
25+
26+
} // namespace impl
27+
28+
template <class Tag, template <class> class Message, class ValueType>
29+
inline void body(Message<Tag> const & message, ValueType const & body_) {
30+
impl::body(message, body_, Tag(), is_async<Tag>());
31+
}
32+
33+
} // namespace network
34+
35+
} // namespace boost
36+
37+
#endif // BOOST_NETWORK_MODIFIERS_BODY_HPP_20100824
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#ifndef BOOST_NETWORK_MESSAGE_MODIFIER_CLEAR_HEADERS_HPP_20100824
2+
#define BOOST_NETWORK_MESSAGE_MODIFIER_CLEAR_HEADERS_HPP_20100824
3+
4+
// Copyright 2010 (c) Dean Michael Berris
5+
// Distributed under the Boost Software License, Version 1.0.
6+
// (See accompanying file LICENSE_1_0.txt or copy at
7+
// http://www.boost.org/LICENSE_1_0.txt)
8+
9+
#include <boost/network/support/is_async.hpp>
10+
#include <boost/thread/future.hpp>
11+
12+
namespace boost { namespace network {
13+
14+
namespace impl {
15+
template <class Message>
16+
inline void clear_headers(Message const & message, mpl::false_ const &) {
17+
(typename Message::headers_container_type()).swap(message.headers());
18+
}
19+
20+
template <class Message>
21+
inline void clear_headers(Message const & message, mpl::true_ const &) {
22+
boost::promise<typename Message::headers_container_type> header_promise;
23+
boost::shared_future<typename Message::headers_container_type> headers_future = header_promise.get_future();
24+
message.headers(headers_future);
25+
header_promise.set_value(typename Message::headers_container_type());
26+
}
27+
28+
} // namespace impl
29+
30+
template <class Tag, template <class> class Message>
31+
inline void clear_headers(Message<Tag> const & message) {
32+
impl::clear_headers(message, is_async<Tag>());
33+
}
34+
35+
} // namespace network
36+
37+
} // namespace boost
38+
39+
#endif // BOOST_NETWORK_MESSAGE_MODIFIER_CLEAR_HEADERS_HPP_20100824
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
#ifndef BOOST_NETWORK_MESSAGE_MODIFIER_DESTINATION_HPP_20100824
3+
#define BOOST_NETWORK_MESSAGE_MODIFIER_DESTINATION_HPP_20100824
4+
5+
// Copyright 2010 (c) Dean Michael Berris
6+
// Distributed under the Boost Software License, Version 1.0.
7+
// (See accompanying file LICENSE_1_0.txt or copy at
8+
// http://www.boost.org/LICENSE_1_0.txt)
9+
10+
#include <boost/network/support/is_async.hpp>
11+
#include <boost/thread/future.hpp>
12+
13+
namespace boost { namespace network {
14+
15+
namespace impl {
16+
17+
template <class Message, class ValueType, class Tag>
18+
inline void destination(Message const & message, ValueType const & destination_, Tag const &, mpl::false_ const &){
19+
message.destination(destination_);
20+
}
21+
22+
template <class Message, class ValueType, class Tag>
23+
inline void destination(Message const & message, ValueType const & destination_, Tag const &, mpl::true_ const &) {
24+
message.destination(destination_);
25+
}
26+
}
27+
28+
template <class Tag, template<class> class Message, class ValueType>
29+
inline void destination(Message<Tag> const & message, ValueType const & destination_) {
30+
impl::destination(message, destination_, Tag(), is_async<Tag>());
31+
}
32+
33+
} // namespace network
34+
35+
} // namespace boost
36+
37+
#endif // BOOST_NETWORK_MESSAGE_MODIFIER_DESTINATION_HPP_20100824
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
#ifndef BOOST_NETWORK_MESSAGE_MODIFIER_REMOVE_HEADER_HPP_20100824
3+
#define BOOST_NETWORK_MESSAGE_MODIFIER_REMOVE_HEADER_HPP_20100824
4+
5+
// Copyright 2010 (c) Dean Michael Berris
6+
// Distributed under the Boost Software License, Version 1.0.
7+
// (See accompanying file LICENSE_1_0.txt or copy at
8+
// http://www.boost.org/LICENSE_1_0.txt)
9+
10+
#include <boost/network/support/is_async.hpp>
11+
12+
namespace boost { namespace network {
13+
14+
namespace impl {
15+
16+
template <class Message, class KeyType>
17+
inline void remove_header(Message const & message, KeyType const & key, tags::default_string const &, mpl::false_ const &) {
18+
message.headers().erase(key);
19+
}
20+
21+
template <class Message, class KeyType>
22+
inline void remove_header(Message const & message, KeyType const & key, tags::default_wstring const &, mpl::false_ const &) {
23+
message.headers().erase(key);
24+
}
25+
26+
template <class Message, class KeyType, class Tag>
27+
inline void remove_header(Message const & message, KeyType const & key, Tag const &, mpl::true_ const &) {
28+
message.remove_header(key);
29+
}
30+
31+
} // namespace impl
32+
33+
template <class Tag, template <class> class Message, class KeyType>
34+
inline void remove_header(Message<Tag> const & message, KeyType const & key) {
35+
impl::remove_header(message, key, Tag(), is_async<Tag>());
36+
}
37+
38+
} // namespace network
39+
40+
} // namespace boost
41+
42+
#endif // BOOST_NETWORK_MESSAGE_MODIFIER_REMOVE_HEADER_HPP_20100824
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
#ifndef BOOST_NETWORK_MESSAGE_MODIFIER_SOURCE_HPP_20100824
3+
#define BOOST_NETWORK_MESSAGE_MODIFIER_SOURCE_HPP_20100824
4+
5+
// Copyright 2010 (c) Dean Michael Berris
6+
// Distributed under the Boost Software License, Version 1.0.
7+
// (See accompanying file LICENSE_1_0.txt or copy at
8+
// http://www.boost.org/LICENSE_1_0.txt)
9+
10+
#include <boost/network/support/is_async.hpp>
11+
12+
namespace boost { namespace network {
13+
14+
namespace impl {
15+
16+
template <class Message, class ValueType, class Tag>
17+
inline void source(Message const & message, ValueType const & source_, Tag const &, mpl::false_ const &) {
18+
message.source(source_);
19+
}
20+
21+
template <class Message, class ValueType, class Tag>
22+
inline void source(Message const & message, ValueType const & source_, Tag const &, mpl::true_ const &) {
23+
message.source(source_);
24+
}
25+
26+
} // namespace impl
27+
28+
template <class Tag, template <class> class Message, class ValueType>
29+
inline void source(Message<Tag> const & message, ValueType const & source_) {
30+
impl::source(message, source_, Tag(), is_async<Tag>());
31+
}
32+
33+
} // namespace network
34+
35+
} // namespace boost
36+
37+
#endif // BOOST_NETWORK_MESSAGE_MODIFIER_SOURCE_HPP_20100824

0 commit comments

Comments
 (0)