Skip to content

Commit 7d72d18

Browse files
committed
Replaced boost::function with std::function.
1 parent 21adf36 commit 7d72d18

18 files changed

+67
-62
lines changed

boost/network/protocol/http/client/async_impl.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
#include <thread>
1212
#include <memory>
13+
#include <functional>
1314
#include <boost/asio/io_service.hpp>
1415
#include <boost/asio/strand.hpp>
15-
#include <boost/bind.hpp>
1616
#include <boost/network/protocol/http/traits/connection_policy.hpp>
1717

1818
namespace boost {
@@ -31,10 +31,10 @@ struct async_client
3131
typedef typename resolver<Tag>::type resolver_type;
3232
typedef typename string<Tag>::type string_type;
3333

34-
typedef function<void(boost::iterator_range<char const*> const&,
34+
typedef std::function<void(boost::iterator_range<char const*> const&,
3535
system::error_code const&)> body_callback_function_type;
3636

37-
typedef function<bool(string_type&)> body_generator_function_type;
37+
typedef std::function<bool(string_type&)> body_generator_function_type;
3838

3939
async_client(bool cache_resolved, bool follow_redirect,
4040
bool always_verify_peer, int timeout,

boost/network/protocol/http/client/connection/async_base.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// (See accompanying file LICENSE_1_0.txt or copy at
99
// http://www.boost.org/LICENSE_1_0.txt)
1010

11+
#include <functional>
1112
#include <boost/network/protocol/http/client/connection/connection_delegate_factory.hpp>
1213
#include <boost/network/protocol/http/response.hpp>
1314
#include <boost/network/protocol/http/traits/delegate_factory.hpp>
@@ -29,9 +30,9 @@ struct async_connection_base {
2930
typedef basic_request<Tag> request;
3031
typedef basic_response<Tag> response;
3132
typedef iterator_range<char const *> char_const_range;
32-
typedef function<void(char_const_range const &, system::error_code const &)>
33+
typedef std::function<void(char_const_range const &, system::error_code const &)>
3334
body_callback_function_type;
34-
typedef function<bool(string_type &)> body_generator_function_type;
35+
typedef std::function<bool(string_type &)> body_generator_function_type;
3536
typedef std::shared_ptr<this_type> connection_ptr;
3637

3738
// This is the factory function which constructs the appropriate async

boost/network/protocol/http/client/connection/connection_delegate.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
// http://www.boost.org/LICENSE_1_0.txt)
99

1010
#include <cstdint>
11+
#include <functional>
1112
#include <boost/asio/ip/tcp.hpp>
1213
#include <boost/asio/streambuf.hpp>
13-
#include <boost/function.hpp>
1414

1515
namespace boost {
1616
namespace network {
@@ -20,13 +20,13 @@ namespace impl {
2020
struct connection_delegate {
2121
virtual void connect(asio::ip::tcp::endpoint &endpoint, std::string host,
2222
std::uint16_t source_port,
23-
function<void(system::error_code const &)> handler) = 0;
23+
std::function<void(system::error_code const &)> handler) = 0;
2424
virtual void write(
2525
asio::streambuf &command_streambuf,
26-
function<void(system::error_code const &, size_t)> handler) = 0;
26+
std::function<void(system::error_code const &, size_t)> handler) = 0;
2727
virtual void read_some(
2828
asio::mutable_buffers_1 const &read_buffer,
29-
function<void(system::error_code const &, size_t)> handler) = 0;
29+
std::function<void(system::error_code const &, size_t)> handler) = 0;
3030
virtual void disconnect() = 0;
3131
virtual ~connection_delegate() = default;
3232
};

boost/network/protocol/http/client/connection/normal_delegate.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99

1010
#include <memory>
1111
#include <cstdint>
12+
#include <functional>
1213
#include <boost/asio/ip/tcp.hpp>
1314
#include <boost/asio/placeholders.hpp>
1415
#include <boost/asio/streambuf.hpp>
1516
#include <boost/network/protocol/http/client/connection/connection_delegate.hpp>
16-
#include <boost/function.hpp>
1717

1818
namespace boost {
1919
namespace network {
@@ -25,12 +25,12 @@ struct normal_delegate : connection_delegate {
2525

2626
void connect(asio::ip::tcp::endpoint &endpoint, std::string host,
2727
std::uint16_t source_port,
28-
function<void(system::error_code const &)> handler) override;
28+
std::function<void(system::error_code const &)> handler) override;
2929
void write(asio::streambuf &command_streambuf,
30-
function<void(system::error_code const &, size_t)> handler)
30+
std::function<void(system::error_code const &, size_t)> handler)
3131
override;
3232
void read_some(asio::mutable_buffers_1 const &read_buffer,
33-
function<void(system::error_code const &, size_t)> handler)
33+
std::function<void(system::error_code const &, size_t)> handler)
3434
override;
3535
void disconnect() override;
3636
~normal_delegate() override = default;

boost/network/protocol/http/client/connection/normal_delegate.ipp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
// http://www.boost.org/LICENSE_1_0.txt)
99

1010
#include <cstdint>
11+
#include <functional>
1112
#include <boost/asio/ip/tcp.hpp>
1213
#include <boost/asio/streambuf.hpp>
1314
#include <boost/asio/write.hpp>
14-
#include <boost/function.hpp>
1515
#include <boost/asio/buffer.hpp>
1616
#include <boost/network/protocol/http/client/connection/normal_delegate.hpp>
1717

@@ -22,7 +22,7 @@ boost::network::http::impl::normal_delegate::normal_delegate(
2222
void boost::network::http::impl::normal_delegate::connect(
2323
asio::ip::tcp::endpoint &endpoint, std::string host,
2424
std::uint16_t source_port,
25-
function<void(system::error_code const &)> handler) {
25+
std::function<void(system::error_code const &)> handler) {
2626

2727
// TODO(dberris): review parameter necessity.
2828
(void)host;
@@ -35,13 +35,13 @@ void boost::network::http::impl::normal_delegate::connect(
3535

3636
void boost::network::http::impl::normal_delegate::write(
3737
asio::streambuf &command_streambuf,
38-
function<void(system::error_code const &, size_t)> handler) {
38+
std::function<void(system::error_code const &, size_t)> handler) {
3939
asio::async_write(*socket_, command_streambuf, handler);
4040
}
4141

4242
void boost::network::http::impl::normal_delegate::read_some(
4343
asio::mutable_buffers_1 const &read_buffer,
44-
function<void(system::error_code const &, size_t)> handler) {
44+
std::function<void(system::error_code const &, size_t)> handler) {
4545
socket_->async_read_some(read_buffer, handler);
4646
}
4747

boost/network/protocol/http/client/connection/ssl_delegate.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <memory>
1111
#include <cstdint>
12+
#include <functional>
1213
#include <boost/asio/io_service.hpp>
1314
#include <boost/asio/ssl.hpp>
1415
#include <boost/network/protocol/http/client/connection/connection_delegate.hpp>
@@ -32,12 +33,12 @@ struct ssl_delegate : connection_delegate,
3233

3334
void connect(asio::ip::tcp::endpoint &endpoint, std::string host,
3435
std::uint16_t source_port,
35-
function<void(system::error_code const &)> handler) override;
36+
std::function<void(system::error_code const &)> handler) override;
3637
void write(asio::streambuf &command_streambuf,
37-
function<void(system::error_code const &, size_t)> handler)
38+
std::function<void(system::error_code const &, size_t)> handler)
3839
override;
3940
void read_some(asio::mutable_buffers_1 const &read_buffer,
40-
function<void(system::error_code const &, size_t)> handler)
41+
std::function<void(system::error_code const &, size_t)> handler)
4142
override;
4243
void disconnect() override;
4344
~ssl_delegate() override;
@@ -59,7 +60,7 @@ struct ssl_delegate : connection_delegate,
5960
ssl_delegate &operator=(ssl_delegate); // = delete
6061

6162
void handle_connected(system::error_code const &ec,
62-
function<void(system::error_code const &)> handler);
63+
std::function<void(system::error_code const &)> handler);
6364
};
6465

6566
} // namespace impl

boost/network/protocol/http/client/connection/ssl_delegate.ipp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// http://www.boost.org/LICENSE_1_0.txt)
99

1010
#include <cstdint>
11+
#include <functional>
1112
#include <boost/asio/ssl.hpp>
1213
#include <boost/network/protocol/http/client/connection/ssl_delegate.hpp>
1314

@@ -29,7 +30,7 @@ boost::network::http::impl::ssl_delegate::ssl_delegate(
2930
void boost::network::http::impl::ssl_delegate::connect(
3031
asio::ip::tcp::endpoint &endpoint, std::string host,
3132
std::uint16_t source_port,
32-
function<void(system::error_code const &)> handler) {
33+
std::function<void(system::error_code const &)> handler) {
3334
context_.reset(
3435
new asio::ssl::context(asio::ssl::context::method::sslv23_client));
3536
if (ciphers_) {
@@ -80,7 +81,7 @@ void boost::network::http::impl::ssl_delegate::connect(
8081

8182
void boost::network::http::impl::ssl_delegate::handle_connected(
8283
system::error_code const &ec,
83-
function<void(system::error_code const &)> handler) {
84+
std::function<void(system::error_code const &)> handler) {
8485
if (!ec) {
8586
socket_->async_handshake(asio::ssl::stream_base::client, handler);
8687
} else {
@@ -90,13 +91,13 @@ void boost::network::http::impl::ssl_delegate::handle_connected(
9091

9192
void boost::network::http::impl::ssl_delegate::write(
9293
asio::streambuf &command_streambuf,
93-
function<void(system::error_code const &, size_t)> handler) {
94+
std::function<void(system::error_code const &, size_t)> handler) {
9495
asio::async_write(*socket_, command_streambuf, handler);
9596
}
9697

9798
void boost::network::http::impl::ssl_delegate::read_some(
9899
asio::mutable_buffers_1 const &read_buffer,
99-
function<void(system::error_code const &, size_t)> handler) {
100+
std::function<void(system::error_code const &, size_t)> handler) {
100101
socket_->async_read_some(read_buffer, handler);
101102
}
102103

boost/network/protocol/http/client/connection/sync_base.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// (See accompanying file LICENSE_1_0.txt or copy at
88
// http://www.boost.org/LICENSE_1_0.txt)
99

10+
#include <functional>
1011
#include <boost/network/protocol/http/traits/resolver_policy.hpp>
1112
#include <boost/network/traits/istringstream.hpp>
1213
#include <boost/network/traits/ostringstream.hpp>
@@ -33,7 +34,7 @@ struct sync_connection_base_impl {
3334
typedef typename resolver_policy<Tag>::type resolver_base;
3435
typedef typename resolver_base::resolver_type resolver_type;
3536
typedef typename string<Tag>::type string_type;
36-
typedef function<typename resolver_base::resolver_iterator_pair(
37+
typedef std::function<typename resolver_base::resolver_iterator_pair(
3738
resolver_type&, string_type const&, string_type const&)>
3839
resolver_function_type;
3940

@@ -237,10 +238,10 @@ struct sync_connection_base {
237238
typedef typename resolver_policy<Tag>::type resolver_base;
238239
typedef typename resolver_base::resolver_type resolver_type;
239240
typedef typename string<Tag>::type string_type;
240-
typedef function<typename resolver_base::resolver_iterator_pair(
241+
typedef std::function<typename resolver_base::resolver_iterator_pair(
241242
resolver_type&, string_type const&, string_type const&)>
242243
resolver_function_type;
243-
typedef function<bool(string_type&)> body_generator_function_type;
244+
typedef std::function<bool(string_type&)> body_generator_function_type;
244245

245246
// FIXME make the certificate filename and verify path parameters be
246247
// optional

boost/network/protocol/http/client/connection/sync_normal.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88
// (See accompanying file LICENSE_1_0.txt or copy at
99
// http://www.boost.org/LICENSE_1_0.txt)
1010

11+
#include <iterator>
12+
#include <functional>
1113
#include <boost/asio/deadline_timer.hpp>
1214
#include <boost/asio/streambuf.hpp>
1315
#include <boost/network/protocol/http/algorithms/linearize.hpp>
1416
#include <boost/network/protocol/http/response.hpp>
1517
#include <boost/network/protocol/http/traits/resolver_policy.hpp>
1618
#include <boost/network/traits/string.hpp>
17-
#include <iterator>
1819

1920
namespace boost {
2021
namespace network {
@@ -36,13 +37,13 @@ struct http_sync_connection
3637
typedef typename resolver_policy<Tag>::type resolver_base;
3738
typedef typename resolver_base::resolver_type resolver_type;
3839
typedef typename string<Tag>::type string_type;
39-
typedef function<typename resolver_base::resolver_iterator_pair(
40+
typedef std::function<typename resolver_base::resolver_iterator_pair(
4041
resolver_type&, string_type const&, string_type const&)>
4142
resolver_function_type;
4243
typedef http_sync_connection<Tag, version_major, version_minor> this_type;
4344
typedef sync_connection_base_impl<Tag, version_major, version_minor>
4445
connection_base;
45-
typedef function<bool(string_type&)> body_generator_function_type;
46+
typedef std::function<bool(string_type&)> body_generator_function_type;
4647

4748
http_sync_connection(resolver_type& resolver, resolver_function_type resolve,
4849
int timeout)

boost/network/protocol/http/client/connection/sync_ssl.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
// (See accompanying file LICENSE_1_0.txt or copy at
99
// http://www.boost.org/LICENSE_1_0.txt)
1010

11+
#include <functional>
1112
#include <boost/asio/ssl.hpp>
1213
#include <boost/asio/ssl/context.hpp>
1314
#include <boost/asio/ssl/context_base.hpp>
1415
#include <boost/asio/streambuf.hpp>
15-
#include <boost/function.hpp>
1616
#include <boost/algorithm/string/predicate.hpp>
1717
#include <boost/network/protocol/http/request.hpp>
1818
#include <boost/network/protocol/http/traits/resolver_policy.hpp>
@@ -37,13 +37,13 @@ struct https_sync_connection
3737
typedef typename resolver_policy<Tag>::type resolver_base;
3838
typedef typename resolver_base::resolver_type resolver_type;
3939
typedef typename string<Tag>::type string_type;
40-
typedef function<typename resolver_base::resolver_iterator_pair(
40+
typedef std::function<typename resolver_base::resolver_iterator_pair(
4141
resolver_type&, string_type const&, string_type const&)>
4242
resolver_function_type;
4343
typedef https_sync_connection<Tag, version_major, version_minor> this_type;
4444
typedef sync_connection_base_impl<Tag, version_major, version_minor>
4545
connection_base;
46-
typedef function<bool(string_type&)> body_generator_function_type;
46+
typedef std::function<bool(string_type&)> body_generator_function_type;
4747

4848
// FIXME make the certificate filename and verify path parameters be
4949
// optional ranges

0 commit comments

Comments
 (0)