Skip to content

Commit 5117105

Browse files
committed
Continuation of std'ification.
I've run into some issues with Boost.Test ToT with Apple's Clang compiler (4.5). It seems that the way Boost.Test is using preprocessor programming is undesirable to Clang.
1 parent 50f49a7 commit 5117105

26 files changed

+359
-361
lines changed

include/network/protocol/http/client.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <network/version.hpp>
1111
#include <network/protocol/http/client/options.hpp>
1212

13-
#include <asio/io_service.hpp>
13+
#include <boost/asio/io_service.hpp>
1414
#include <network/protocol/http/client/facade.hpp>
1515
#include <network/protocol/http/client/macros.hpp>
1616
#include <network/protocol/http/request.hpp>

include/network/protocol/http/client/base.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class client_options;
2323

2424
struct client_base {
2525
typedef
26-
std::function<void(boost::iterator_range<char const *> const &, asio::error_code const &)>
26+
std::function<void(boost::iterator_range<char const *> const &, boost::system::error_code const &)>
2727
body_callback_function_type;
2828

2929
client_base();

include/network/protocol/http/client/base.ipp

+14-14
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#include <functional>
1212
#include <network/protocol/http/client/base.hpp>
1313
#include <network/protocol/http/client/options.hpp>
14-
#include <asio/io_service.hpp>
15-
#include <asio/strand.hpp>
14+
#include <boost/asio/io_service.hpp>
15+
#include <boost/asio/strand.hpp>
1616
#include <network/protocol/http/client/connection_manager.hpp>
1717
#include <network/protocol/http/client/simple_connection_manager.hpp>
1818
#include <network/protocol/http/request.hpp>
@@ -22,7 +22,7 @@ namespace network { namespace http {
2222

2323
struct client_base_pimpl {
2424
typedef
25-
std::function<void(boost::iterator_range<char const *> const &, asio::error_code const &)>
25+
std::function<void(boost::iterator_range<char const *> const &, boost::system::error_code const &)>
2626
body_callback_function_type;
2727
client_base_pimpl(client_options const &options);
2828
response const request_skeleton(request const & request_,
@@ -34,20 +34,20 @@ struct client_base_pimpl {
3434
~client_base_pimpl();
3535
private:
3636
client_options options_;
37-
asio::io_service * service_ptr;
38-
boost::shared_ptr<asio::io_service::work> sentinel_;
39-
boost::shared_ptr<std::thread> lifetime_thread_;
40-
boost::shared_ptr<connection_manager> connection_manager_;
37+
boost::asio::io_service * service_ptr;
38+
std::shared_ptr<boost::asio::io_service::work> sentinel_;
39+
std::shared_ptr<std::thread> lifetime_thread_;
40+
std::shared_ptr<connection_manager> connection_manager_;
4141
bool owned_service_;
4242
};
4343

4444
client_base::client_base()
45-
: pimpl(new (std::nothrow) client_base_pimpl(client_options())) {
45+
: pimpl(new client_base_pimpl(client_options())) {
4646
NETWORK_MESSAGE("client_base::client_base()");
4747
}
4848

4949
client_base::client_base(client_options const &options)
50-
: pimpl(new (std::nothrow) client_base_pimpl(options)) {
50+
: pimpl(new client_base_pimpl(options)) {
5151
NETWORK_MESSAGE("client_base::client_base(client_options const &)");
5252
}
5353

@@ -78,17 +78,17 @@ client_base_pimpl::client_base_pimpl(client_options const &options)
7878
NETWORK_MESSAGE("client_base_pimpl::client_base_pimpl(client_options const &)");
7979
if (service_ptr == 0) {
8080
NETWORK_MESSAGE("creating owned io_service.");
81-
service_ptr = new(std::nothrow) asio::io_service;
81+
service_ptr = new boost::asio::io_service;
8282
owned_service_ = true;
8383
}
8484
if (!connection_manager_.get()) {
8585
NETWORK_MESSAGE("creating owned simple_connection_manager");
8686
connection_manager_.reset(
87-
new (std::nothrow) simple_connection_manager(options));
87+
new simple_connection_manager(options));
8888
}
89-
sentinel_.reset(new (std::nothrow) asio::io_service::work(*service_ptr));
89+
sentinel_.reset(new boost::asio::io_service::work(*service_ptr));
9090
auto local_ptr = service_ptr;
91-
lifetime_thread_.reset(new (std::nothrow) std::thread([local_ptr]() { local_ptr->run(); }));
91+
lifetime_thread_.reset(new std::thread([local_ptr]() { local_ptr->run(); }));
9292
if (!lifetime_thread_.get())
9393
BOOST_THROW_EXCEPTION(std::runtime_error("Cannot allocate client lifetime thread; not enough memory."));
9494
}
@@ -114,7 +114,7 @@ response const client_base_pimpl::request_skeleton(
114114
)
115115
{
116116
NETWORK_MESSAGE("client_base_pimpl::request_skeleton(...)");
117-
boost::shared_ptr<client_connection> connection_;
117+
std::shared_ptr<client_connection> connection_;
118118
connection_ = connection_manager_->get_connection(*service_ptr, request_, options_);
119119
return connection_->send_request(method, request_, get_body, callback, options);
120120
}

include/network/protocol/http/client/connection/async_normal.hpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
#ifndef NETWORK_PROTOCOL_HTTP_IMPL_HTTP_ASYNC_CONNECTION_HPP_20100601
1010
#define NETWORK_PROTOCOL_HTTP_IMPL_HTTP_ASYNC_CONNECTION_HPP_20100601
1111

12-
#include <boost/shared_ptr.hpp>
13-
#include <boost/scoped_ptr.hpp>
12+
#include <memory>
13+
#include <utility>
1414
#include <network/protocol/http/client/client_connection.hpp>
15-
#include <boost/enable_shared_from_this.hpp>
1615

17-
namespace asio {
16+
namespace boost { namespace asio {
1817
class io_service;
1918
} // namespace asio
19+
} // namespace boost
2020

2121
namespace network { namespace http {
2222

@@ -28,11 +28,11 @@ struct connection_delegate;
2828
struct http_async_connection_pimpl;
2929

3030
struct http_async_connection : client_connection
31-
, boost::enable_shared_from_this<http_async_connection> {
31+
, std::enable_shared_from_this<http_async_connection> {
3232
using client_connection::callback_type;
33-
http_async_connection(boost::shared_ptr<resolver_delegate> resolver_delegate,
34-
boost::shared_ptr<connection_delegate> connection_delegate,
35-
asio::io_service & io_service,
33+
http_async_connection(std::shared_ptr<resolver_delegate> resolver_delegate,
34+
std::shared_ptr<connection_delegate> connection_delegate,
35+
boost::asio::io_service & io_service,
3636
bool follow_redirects);
3737
http_async_connection * clone() const;
3838
virtual response send_request(std::string const & method,
@@ -43,8 +43,8 @@ struct http_async_connection : client_connection
4343
virtual void reset(); // override
4444
virtual ~http_async_connection();
4545
private:
46-
explicit http_async_connection(boost::shared_ptr<http_async_connection_pimpl>);
47-
boost::shared_ptr<http_async_connection_pimpl> pimpl;
46+
explicit http_async_connection(std::shared_ptr<http_async_connection_pimpl>);
47+
std::shared_ptr<http_async_connection_pimpl> pimpl;
4848
};
4949

5050
} // namespace http

0 commit comments

Comments
 (0)