Add examples for handler type requirements.
diff --git a/asio/src/doc/requirements/AcceptHandler.qbk b/asio/src/doc/requirements/AcceptHandler.qbk index 5f5b05e..cf85bb5 100644 --- a/asio/src/doc/requirements/AcceptHandler.qbk +++ b/asio/src/doc/requirements/AcceptHandler.qbk
@@ -12,4 +12,39 @@ class should work correctly in the expression `h(ec)`, where `ec` is an lvalue of type `const error_code`. +[heading Examples] + +A free function as an accept handler: + + void accept_handler( + const asio::error_code& ec) + { + ... + } + +An accept handler function object: + + struct accept_handler + { + ... + void operator()( + const asio::error_code& ec) + { + ... + } + ... + }; + +A non-static class member function adapted to an accept handler using `bind()`: + + void my_class::accept_handler( + const asio::error_code& ec) + { + ... + } + ... + acceptor.async_accept(..., + boost::bind(&my_class::accept_handler, + this, asio::placeholders::error)); + [endsect]
diff --git a/asio/src/doc/requirements/CompletionHandler.qbk b/asio/src/doc/requirements/CompletionHandler.qbk index ade04db..d483052 100644 --- a/asio/src/doc/requirements/CompletionHandler.qbk +++ b/asio/src/doc/requirements/CompletionHandler.qbk
@@ -11,4 +11,35 @@ asio.reference.Handler handler]. A value `h` of a completion handler class should work correctly in the expression `h()`. +[heading Examples] + +A free function as a completion handler: + + void completion_handler() + { + ... + } + +A completion handler function object: + + struct completion_handler + { + ... + void operator()() + { + ... + } + ... + }; + +A non-static class member function adapted to a completion handler using +`bind()`: + + void my_class::completion_handler() + { + ... + } + ... + my_io_service.post(boost::bind(&my_class::completion_handler, this)); + [endsect]
diff --git a/asio/src/doc/requirements/ConnectHandler.qbk b/asio/src/doc/requirements/ConnectHandler.qbk index 5189441..21d4095 100644 --- a/asio/src/doc/requirements/ConnectHandler.qbk +++ b/asio/src/doc/requirements/ConnectHandler.qbk
@@ -12,4 +12,39 @@ class should work correctly in the expression `h(ec)`, where `ec` is an lvalue of type `const error_code`. +[heading Examples] + +A free function as a connect handler: + + void connect_handler( + const asio::error_code& ec) + { + ... + } + +A connect handler function object: + + struct connect_handler + { + ... + void operator()( + const asio::error_code& ec) + { + ... + } + ... + }; + +A non-static class member function adapted to a connect handler using `bind()`: + + void my_class::connect_handler( + const asio::error_code& ec) + { + ... + } + ... + socket.async_connect(..., + boost::bind(&my_class::connect_handler, + this, asio::placeholders::error)); + [endsect]
diff --git a/asio/src/doc/requirements/ReadHandler.qbk b/asio/src/doc/requirements/ReadHandler.qbk index 61cf763..9821fe8 100644 --- a/asio/src/doc/requirements/ReadHandler.qbk +++ b/asio/src/doc/requirements/ReadHandler.qbk
@@ -12,4 +12,43 @@ should work correctly in the expression `h(ec, s)`, where `ec` is an lvalue of type `const error_code` and `s` is an lvalue of type `const size_t`. +[heading Examples] + +A free function as a read handler: + + void read_handler( + const asio::error_code& ec, + std::size_t bytes_transferred) + { + ... + } + +A read handler function object: + + struct read_handler + { + ... + void operator()( + const asio::error_code& ec, + std::size_t bytes_transferred) + { + ... + } + ... + }; + +A non-static class member function adapted to a read handler using `bind()`: + + void my_class::read_handler( + const asio::error_code& ec, + std::size_t bytes_transferred) + { + ... + } + ... + socket.async_read(..., + boost::bind(&my_class::read_handler, + this, asio::placeholders::error, + asio::placeholders::bytes_transferred)); + [endsect]
diff --git a/asio/src/doc/requirements/ResolveHandler.qbk b/asio/src/doc/requirements/ResolveHandler.qbk index e5955c4..4dfe9c1 100644 --- a/asio/src/doc/requirements/ResolveHandler.qbk +++ b/asio/src/doc/requirements/ResolveHandler.qbk
@@ -15,4 +15,43 @@ template parameter of the [link asio.reference.ip__resolver_service `resolver_service`] which is used to initiate the asynchronous operation. +[heading Examples] + +A free function as a resolve handler: + + void resolve_handler( + const asio::error_code& ec, + asio::ip::tcp::resolver::iterator iterator) + { + ... + } + +A resolve handler function object: + + struct resolve_handler + { + ... + void operator()( + const asio::error_code& ec, + asio::ip::tcp::resolver::iterator iterator) + { + ... + } + ... + }; + +A non-static class member function adapted to a resolve handler using `bind()`: + + void my_class::resolve_handler( + const asio::error_code& ec, + asio::ip::tcp::resolver::iterator iterator) + { + ... + } + ... + resolver.async_resolve(..., + boost::bind(&my_class::resolve_handler, + this, asio::placeholders::error, + asio::placeholders::iterator)); + [endsect]
diff --git a/asio/src/doc/requirements/WaitHandler.qbk b/asio/src/doc/requirements/WaitHandler.qbk index 77b9cdc..5843ec7 100644 --- a/asio/src/doc/requirements/WaitHandler.qbk +++ b/asio/src/doc/requirements/WaitHandler.qbk
@@ -12,4 +12,39 @@ should work correctly in the expression `h(ec)`, where `ec` is an lvalue of type `const error_code`. +[heading Examples] + +A free function as a wait handler: + + void wait_handler( + const asio::error_code& ec) + { + ... + } + +A wait handler function object: + + struct wait_handler + { + ... + void operator()( + const asio::error_code& ec) + { + ... + } + ... + }; + +A non-static class member function adapted to a wait handler using `bind()`: + + void my_class::wait_handler( + const asio::error_code& ec) + { + ... + } + ... + socket.async_wait(..., + boost::bind(&my_class::wait_handler, + this, asio::placeholders::error)); + [endsect]
diff --git a/asio/src/doc/requirements/WriteHandler.qbk b/asio/src/doc/requirements/WriteHandler.qbk index e2a7aea..e72cbc7 100644 --- a/asio/src/doc/requirements/WriteHandler.qbk +++ b/asio/src/doc/requirements/WriteHandler.qbk
@@ -12,4 +12,43 @@ should work correctly in the expression `h(ec, s)`, where `ec` is an lvalue of type `const error_code` and `s` is an lvalue of type `const size_t`. +[heading Examples] + +A free function as a write handler: + + void write_handler( + const asio::error_code& ec, + std::size_t bytes_transferred) + { + ... + } + +A write handler function object: + + struct write_handler + { + ... + void operator()( + const asio::error_code& ec, + std::size_t bytes_transferred) + { + ... + } + ... + }; + +A non-static class member function adapted to a write handler using `bind()`: + + void my_class::write_handler( + const asio::error_code& ec, + std::size_t bytes_transferred) + { + ... + } + ... + socket.async_write(..., + boost::bind(&my_class::write_handler, + this, asio::placeholders::error, + asio::placeholders::bytes_transferred)); + [endsect]