From 690a1622aaf4fac8c3c19d72909f865194721b1c Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 5 Mar 2015 00:03:42 +0900 Subject: [PATCH] asio: Add const qualifier to client::session member functions --- src/asio_client_session.cc | 18 +++++++++++------- src/includes/nghttp2/asio_http2_client.h | 14 +++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/asio_client_session.cc b/src/asio_client_session.cc index ed489372..8c002e21 100644 --- a/src/asio_client_session.cc +++ b/src/asio_client_session.cc @@ -49,24 +49,28 @@ session::session(boost::asio::io_service &io_service, session::~session() {} -void session::on_connect(connect_cb cb) { impl_->on_connect(std::move(cb)); } +void session::on_connect(connect_cb cb) const { + impl_->on_connect(std::move(cb)); +} -void session::on_error(error_cb cb) { impl_->on_error(std::move(cb)); } +void session::on_error(error_cb cb) const { impl_->on_error(std::move(cb)); } -void session::shutdown() { impl_->shutdown(); } +void session::shutdown() const { impl_->shutdown(); } -boost::asio::io_service &session::io_service() { return impl_->io_service(); } +boost::asio::io_service &session::io_service() const { + return impl_->io_service(); +} const request *session::submit(boost::system::error_code &ec, const std::string &method, - const std::string &uri, header_map h) { + const std::string &uri, header_map h) const { return impl_->submit(ec, method, uri, read_cb(), std::move(h)); } const request *session::submit(boost::system::error_code &ec, const std::string &method, const std::string &uri, std::string data, - header_map h) { + header_map h) const { return impl_->submit(ec, method, uri, string_reader(std::move(data)), std::move(h)); } @@ -74,7 +78,7 @@ const request *session::submit(boost::system::error_code &ec, const request *session::submit(boost::system::error_code &ec, const std::string &method, const std::string &uri, read_cb cb, - header_map h) { + header_map h) const { return impl_->submit(ec, method, uri, std::move(cb), std::move(h)); } diff --git a/src/includes/nghttp2/asio_http2_client.h b/src/includes/nghttp2/asio_http2_client.h index de15430e..6f5a8385 100644 --- a/src/includes/nghttp2/asio_http2_client.h +++ b/src/includes/nghttp2/asio_http2_client.h @@ -97,22 +97,22 @@ public: const std::string &service); ~session(); - void on_connect(connect_cb cb); - void on_error(error_cb cb); + void on_connect(connect_cb cb) const; + void on_error(error_cb cb) const; - void shutdown(); + void shutdown() const; - boost::asio::io_service &io_service(); + boost::asio::io_service &io_service() const; const request *submit(boost::system::error_code &ec, const std::string &method, const std::string &uri, - header_map h = {}); + header_map h = {}) const; const request *submit(boost::system::error_code &ec, const std::string &method, const std::string &uri, - std::string data, header_map h = {}); + std::string data, header_map h = {}) const; const request *submit(boost::system::error_code &ec, const std::string &method, const std::string &uri, - read_cb cb, header_map h = {}); + read_cb cb, header_map h = {}) const; private: std::unique_ptr impl_;