Skip to content

Update boost to std #589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jan 30, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Replaced boost::shared_ptr with std::shared_ptr.
  • Loading branch information
glynos committed Jan 29, 2016
commit bd35adb72b98fd15b2cf1c7345d16607e999c194
13 changes: 6 additions & 7 deletions boost/network/protocol/http/client/async_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
// http://www.boost.org/LICENSE_1_0.txt)

#include <thread>
#include <memory>
#include <boost/asio/io_service.hpp>
#include <boost/asio/strand.hpp>
#include <boost/bind.hpp>
#include <boost/make_shared.hpp>
#include <boost/network/protocol/http/traits/connection_policy.hpp>
#include <boost/shared_ptr.hpp>

namespace boost {
namespace network {
Expand All @@ -39,7 +38,7 @@ struct async_client

async_client(bool cache_resolved, bool follow_redirect,
bool always_verify_peer, int timeout,
boost::shared_ptr<boost::asio::io_service> service,
std::shared_ptr<boost::asio::io_service> service,
optional<string_type> certificate_filename,
optional<string_type> verify_path,
optional<string_type> certificate_file,
Expand All @@ -48,7 +47,7 @@ struct async_client
: connection_base(cache_resolved, follow_redirect, timeout),
service_ptr(service.get()
? service
: boost::make_shared<boost::asio::io_service>()),
: std::make_shared<boost::asio::io_service>()),
service_(*service_ptr),
resolver_(service_),
sentinel_(new boost::asio::io_service::work(service_)),
Expand Down Expand Up @@ -88,11 +87,11 @@ struct async_client
generator);
}

boost::shared_ptr<boost::asio::io_service> service_ptr;
std::shared_ptr<boost::asio::io_service> service_ptr;
boost::asio::io_service& service_;
resolver_type resolver_;
boost::shared_ptr<boost::asio::io_service::work> sentinel_;
boost::shared_ptr<std::thread> lifetime_thread_;
std::shared_ptr<boost::asio::io_service::work> sentinel_;
std::shared_ptr<std::thread> lifetime_thread_;
optional<string_type> certificate_filename_;
optional<string_type> verify_path_;
optional<string_type> certificate_file_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct async_connection_base {
typedef function<void(char_const_range const &, system::error_code const &)>
body_callback_function_type;
typedef function<bool(string_type &)> body_generator_function_type;
typedef shared_ptr<this_type> connection_ptr;
typedef std::shared_ptr<this_type> connection_ptr;

// This is the factory function which constructs the appropriate async
// connection implementation with the correct delegate chosen based on the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ template <class Tag, unsigned version_major, unsigned version_minor>
struct http_async_connection
: async_connection_base<Tag, version_major, version_minor>,
protected http_async_protocol_handler<Tag, version_major, version_minor>,
boost::enable_shared_from_this<
std::enable_shared_from_this<
http_async_connection<Tag, version_major, version_minor> > {
http_async_connection(http_async_connection const&) = delete;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct normal_delegate;

template <class Tag>
struct connection_delegate_factory {
typedef shared_ptr<connection_delegate> connection_delegate_ptr;
typedef std::shared_ptr<connection_delegate> connection_delegate_ptr;
typedef typename string<Tag>::type string_type;

// This is the factory method that actually returns the delegate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include <boost/asio/io_service.hpp>
#include <boost/asio/ssl.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/network/protocol/http/client/connection/connection_delegate.hpp>
#include <boost/network/support/is_default_string.hpp>
#include <boost/network/support/is_default_wstring.hpp>
Expand All @@ -22,7 +21,7 @@ namespace http {
namespace impl {

struct ssl_delegate : connection_delegate,
enable_shared_from_this<ssl_delegate> {
std::enable_shared_from_this<ssl_delegate> {
ssl_delegate(asio::io_service &service, bool always_verify_peer,
optional<std::string> certificate_filename,
optional<std::string> verify_path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ template <class Tag, unsigned version_major, unsigned version_minor>
struct http_sync_connection
: public virtual sync_connection_base<Tag, version_major, version_minor>,
sync_connection_base_impl<Tag, version_major, version_minor>,
boost::enable_shared_from_this<
std::enable_shared_from_this<
http_sync_connection<Tag, version_major, version_minor> > {
typedef typename resolver_policy<Tag>::type resolver_base;
typedef typename resolver_base::resolver_type resolver_type;
Expand Down
2 changes: 1 addition & 1 deletion boost/network/protocol/http/client/connection/sync_ssl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ template <class Tag, unsigned version_major, unsigned version_minor>
struct https_sync_connection
: public virtual sync_connection_base<Tag, version_major, version_minor>,
sync_connection_base_impl<Tag, version_major, version_minor>,
boost::enable_shared_from_this<
std::enable_shared_from_this<
https_sync_connection<Tag, version_major, version_minor> > {
typedef typename resolver_policy<Tag>::type resolver_base;
typedef typename resolver_base::resolver_type resolver_type;
Expand Down
3 changes: 2 additions & 1 deletion boost/network/protocol/http/client/facade.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <memory>
#include <boost/network/protocol/http/client/pimpl.hpp>
#include <boost/network/protocol/http/request.hpp>
#include <boost/network/protocol/http/response.hpp>
Expand Down Expand Up @@ -299,7 +300,7 @@ class basic_client_facade {
void clear_resolved_cache() { pimpl->clear_resolved_cache(); }

protected:
boost::shared_ptr<pimpl_type> pimpl;
std::shared_ptr<pimpl_type> pimpl;

void init_pimpl(client_options<Tag> const& options) {
pimpl.reset(new pimpl_type(
Expand Down
8 changes: 4 additions & 4 deletions boost/network/protocol/http/client/options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <memory>
#include <boost/asio/io_service.hpp>
#include <boost/network/traits/string.hpp>
#include <boost/optional/optional.hpp>
#include <boost/smart_ptr/shared_ptr.hpp>

namespace boost {
namespace network {
Expand Down Expand Up @@ -107,7 +107,7 @@ class client_options {
return *this;
}

client_options& io_service(boost::shared_ptr<boost::asio::io_service> v) {
client_options& io_service(std::shared_ptr<boost::asio::io_service> v) {
io_service_ = v;
return *this;
}
Expand Down Expand Up @@ -148,7 +148,7 @@ class client_options {

long openssl_options() const { return openssl_options_; }

boost::shared_ptr<boost::asio::io_service> io_service() const {
std::shared_ptr<boost::asio::io_service> io_service() const {
return io_service_;
}

Expand All @@ -165,7 +165,7 @@ class client_options {
boost::optional<string_type> openssl_private_key_file_;
boost::optional<string_type> openssl_ciphers_;
long openssl_options_;
boost::shared_ptr<boost::asio::io_service> io_service_;
std::shared_ptr<boost::asio::io_service> io_service_;
bool always_verify_peer_;
int timeout_;
};
Expand Down
4 changes: 2 additions & 2 deletions boost/network/protocol/http/client/pimpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <memory>
#include <boost/asio/io_service.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/if.hpp>
Expand All @@ -16,7 +17,6 @@
#include <boost/network/support/is_async.hpp>
#include <boost/network/support/is_sync.hpp>
#include <boost/optional/optional.hpp>
#include <boost/smart_ptr/shared_ptr.hpp>
#include <boost/static_assert.hpp>

namespace boost {
Expand Down Expand Up @@ -74,7 +74,7 @@ struct basic_client_impl
optional<string_type> const& certificate_file,
optional<string_type> const& private_key_file,
optional<string_type> const& ciphers, long ssl_options,
boost::shared_ptr<boost::asio::io_service> service,
std::shared_ptr<boost::asio::io_service> service,
int timeout)
: base_type(cache_resolved, follow_redirect, always_verify_peer, timeout,
service, certificate_filename, verify_path, certificate_file,
Expand Down
9 changes: 4 additions & 5 deletions boost/network/protocol/http/client/sync_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <memory>
#include <boost/bind/bind.hpp>
#include <boost/function.hpp>
#include <boost/network/protocol/http/client/options.hpp>
Expand All @@ -15,8 +16,6 @@
#include <boost/network/protocol/http/traits/connection_policy.hpp>
#include <boost/network/traits/string.hpp>
#include <boost/optional/optional.hpp>
#include <boost/smart_ptr/make_shared.hpp>
#include <boost/smart_ptr/shared_ptr.hpp>

namespace boost {
namespace network {
Expand All @@ -38,7 +37,7 @@ struct sync_client
typedef function<bool(string_type&)> body_generator_function_type;
friend struct basic_client_impl<Tag, version_major, version_minor>;

boost::shared_ptr<boost::asio::io_service> service_ptr;
std::shared_ptr<boost::asio::io_service> service_ptr;
boost::asio::io_service& service_;
resolver_type resolver_;
optional<string_type> certificate_filename_;
Expand All @@ -51,7 +50,7 @@ struct sync_client

sync_client(
bool cache_resolved, bool follow_redirect, bool always_verify_peer,
int timeout, boost::shared_ptr<boost::asio::io_service> service,
int timeout, std::shared_ptr<boost::asio::io_service> service,
optional<string_type> certificate_filename =
optional<string_type>(),
optional<string_type> verify_path = optional<string_type>(),
Expand All @@ -61,7 +60,7 @@ struct sync_client
long ssl_options = 0)
: connection_base(cache_resolved, follow_redirect, timeout),
service_ptr(service.get() ? service
: make_shared<boost::asio::io_service>()),
: std::make_shared<boost::asio::io_service>()),
service_(*service_ptr),
resolver_(service_),
certificate_filename_(std::move(certificate_filename)),
Expand Down
6 changes: 3 additions & 3 deletions boost/network/protocol/http/policies/async_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <memory>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/bind.hpp>
#include <boost/cstdint.hpp>
Expand All @@ -18,7 +19,6 @@
#include <boost/network/protocol/http/message/wrappers/protocol.hpp>
#include <boost/network/protocol/http/traits/resolver_policy.hpp>
#include <boost/network/version.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/tuple/tuple.hpp>

namespace boost {
Expand Down Expand Up @@ -63,11 +63,11 @@ struct async_connection_policy : resolver_policy<Tag>::type {
}

private:
shared_ptr<http::impl::async_connection_base<Tag, version_major,
std::shared_ptr<http::impl::async_connection_base<Tag, version_major,
version_minor> > pimpl;
};

typedef boost::shared_ptr<connection_impl> connection_ptr;
typedef std::shared_ptr<connection_impl> connection_ptr;
connection_ptr get_connection(
resolver_type& resolver, basic_request<Tag> const& request_,
bool always_verify_peer,
Expand Down
8 changes: 4 additions & 4 deletions boost/network/protocol/http/policies/async_resolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <memory>
#include <boost/asio/placeholders.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/asio/strand.hpp>
#include <boost/network/protocol/http/traits/resolver.hpp>
#include <boost/network/traits/string.hpp>
Expand All @@ -24,7 +24,7 @@ namespace http {
namespace policies {

template <class Tag>
struct async_resolver : boost::enable_shared_from_this<async_resolver<Tag> > {
struct async_resolver : std::enable_shared_from_this<async_resolver<Tag> > {
typedef typename resolver<Tag>::type resolver_type;
typedef typename resolver_type::iterator resolver_iterator;
typedef typename resolver_type::query resolver_query;
Expand All @@ -42,8 +42,8 @@ struct async_resolver : boost::enable_shared_from_this<async_resolver<Tag> > {
protected:
bool cache_resolved_;
endpoint_cache endpoint_cache_;
boost::shared_ptr<boost::asio::io_service> service_;
boost::shared_ptr<boost::asio::io_service::strand> resolver_strand_;
std::shared_ptr<boost::asio::io_service> service_;
std::shared_ptr<boost::asio::io_service::strand> resolver_strand_;

explicit async_resolver(bool cache_resolved)
: cache_resolved_(cache_resolved), endpoint_cache_() {}
Expand Down
9 changes: 4 additions & 5 deletions boost/network/protocol/http/policies/pooled_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <boost/network/protocol/http/client/connection/sync_base.hpp>
#include <boost/network/protocol/http/response.hpp>
#include <boost/network/protocol/http/traits/resolver_policy.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/unordered_map.hpp>
#include <utility>
Expand Down Expand Up @@ -40,7 +39,7 @@ struct pooled_connection_policy : resolver_policy<Tag>::type {
void cleanup() { host_connection_map().swap(host_connections_); }

struct connection_impl {
typedef function<shared_ptr<connection_impl>(
typedef function<std::shared_ptr<connection_impl>(
resolver_type&, basic_request<Tag> const&, optional<string_type> const&,
optional<string_type> const&, optional<string_type> const&,
optional<string_type> const&, optional<string_type> const&)>
Expand Down Expand Up @@ -166,7 +165,7 @@ struct pooled_connection_policy : resolver_policy<Tag>::type {
} while (true);
}

shared_ptr<http::impl::sync_connection_base<Tag, version_major,
std::shared_ptr<http::impl::sync_connection_base<Tag, version_major,
version_minor> > pimpl;
resolver_type& resolver_;
bool connection_follow_redirect_;
Expand All @@ -179,9 +178,9 @@ struct pooled_connection_policy : resolver_policy<Tag>::type {
long ssl_options_;
};

typedef shared_ptr<connection_impl> connection_ptr;
typedef std::shared_ptr<connection_impl> connection_ptr;

typedef unordered_map<string_type, weak_ptr<connection_impl>> host_connection_map;
typedef unordered_map<string_type, std::weak_ptr<connection_impl>> host_connection_map;
boost::mutex host_mutex_;
host_connection_map host_connections_;
bool follow_redirect_;
Expand Down
6 changes: 3 additions & 3 deletions boost/network/protocol/http/policies/simple_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// http://www.boost.org/LICENSE_1_0.txt)

#include <iterator>
#include <memory>
#include <boost/function.hpp>
#include <boost/cstdint.hpp>
#include <boost/lexical_cast.hpp>
Expand All @@ -16,7 +17,6 @@
#include <boost/network/protocol/http/traits/resolver_policy.hpp>
#include <boost/network/traits/string.hpp>
#include <boost/network/version.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/network/protocol/http/client/connection/sync_base.hpp>
#include <boost/network/traits/string.hpp>
#include <boost/optional/optional.hpp>
Expand Down Expand Up @@ -110,12 +110,12 @@ struct simple_connection_policy : resolver_policy<Tag>::type {
}

private:
shared_ptr<http::impl::sync_connection_base<Tag, version_major,
std::shared_ptr<http::impl::sync_connection_base<Tag, version_major,
version_minor> > pimpl;
bool follow_redirect_;
};

typedef boost::shared_ptr<connection_impl> connection_ptr;
typedef std::shared_ptr<connection_impl> connection_ptr;
connection_ptr get_connection(
resolver_type& resolver, basic_request<Tag> const& request_,
bool always_verify_peer,
Expand Down
Loading