asio: Add const qualifier to client::session member functions

This commit is contained in:
Tatsuhiro Tsujikawa 2015-03-05 00:03:42 +09:00
parent aaef798566
commit 690a1622aa
2 changed files with 18 additions and 14 deletions

View File

@ -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));
}

View File

@ -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<session_impl> impl_;