x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
basic_resolver.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\asio\ip\basic_resolver.hpp
旋转
特效
属性
历史版本
// // basic_resolver.hpp // ~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef BOOST_ASIO_IP_BASIC_RESOLVER_HPP #define BOOST_ASIO_IP_BASIC_RESOLVER_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include
#include
#include
#include
#include
namespace boost { namespace asio { namespace ip { /// Provides endpoint resolution functionality. /** * The basic_resolver class template provides the ability to resolve a query * to a list of endpoints. * * @par Thread Safety * @e Distinct @e objects: Safe.@n * @e Shared @e objects: Unsafe. */ template
> class basic_resolver : public basic_io_object
{ public: /// The protocol type. typedef InternetProtocol protocol_type; /// The endpoint type. typedef typename InternetProtocol::endpoint endpoint_type; /// The query type. typedef typename InternetProtocol::resolver_query query; /// The iterator type. typedef typename InternetProtocol::resolver_iterator iterator; /// Constructor. /** * This constructor creates a basic_resolver. * * @param io_service The io_service object that the resolver will use to * dispatch handlers for any asynchronous operations performed on the timer. */ explicit basic_resolver(boost::asio::io_service& io_service) : basic_io_object
(io_service) { } /// Cancel any asynchronous operations that are waiting on the resolver. /** * This function forces the completion of any pending asynchronous * operations on the host resolver. The handler for each cancelled operation * will be invoked with the boost::asio::error::operation_aborted error code. */ void cancel() { return this->service.cancel(this->implementation); } /// Resolve a query to a list of entries. /** * This function is used to resolve a query into a list of endpoint entries. * * @param q A query object that determines what endpoints will be returned. * * @returns A forward-only iterator that can be used to traverse the list * of endpoint entries. * * @throws boost::system::system_error Thrown on failure. * * @note A default constructed iterator represents the end of the list. * * A successful call to this function is guaranteed to return at least one * entry. */ iterator resolve(const query& q) { boost::system::error_code ec; iterator i = this->service.resolve(this->implementation, q, ec); boost::asio::detail::throw_error(ec); return i; } /// Resolve a query to a list of entries. /** * This function is used to resolve a query into a list of endpoint entries. * * @param q A query object that determines what endpoints will be returned. * * @param ec Set to indicate what error occurred, if any. * * @returns A forward-only iterator that can be used to traverse the list * of endpoint entries. Returns a default constructed iterator if an error * occurs. * * @note A default constructed iterator represents the end of the list. * * A successful call to this function is guaranteed to return at least one * entry. */ iterator resolve(const query& q, boost::system::error_code& ec) { return this->service.resolve(this->implementation, q, ec); } /// Asynchronously resolve a query to a list of entries. /** * This function is used to asynchronously resolve a query into a list of * endpoint entries. * * @param q A query object that determines what endpoints will be returned. * * @param handler The handler to be called when the resolve operation * completes. Copies will be made of the handler as required. The function * signature of the handler must be: * @code void handler( * const boost::system::error_code& error, // Result of operation. * resolver::iterator iterator // Forward-only iterator that can * // be used to traverse the list * // of endpoint entries. * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using * boost::asio::io_service::post(). * * @note A default constructed iterator represents the end of the list. * * A successful resolve operation is guaranteed to pass at least one entry to * the handler. */ template
void async_resolve(const query& q, ResolveHandler handler) { return this->service.async_resolve(this->implementation, q, handler); } /// Resolve an endpoint to a list of entries. /** * This function is used to resolve an endpoint into a list of endpoint * entries. * * @param e An endpoint object that determines what endpoints will be * returned. * * @returns A forward-only iterator that can be used to traverse the list * of endpoint entries. * * @throws boost::system::system_error Thrown on failure. * * @note A default constructed iterator represents the end of the list. * * A successful call to this function is guaranteed to return at least one * entry. */ iterator resolve(const endpoint_type& e) { boost::system::error_code ec; iterator i = this->service.resolve(this->implementation, e, ec); boost::asio::detail::throw_error(ec); return i; } /// Resolve an endpoint to a list of entries. /** * This function is used to resolve an endpoint into a list of endpoint * entries. * * @param e An endpoint object that determines what endpoints will be * returned. * * @param ec Set to indicate what error occurred, if any. * * @returns A forward-only iterator that can be used to traverse the list * of endpoint entries. Returns a default constructed iterator if an error * occurs. * * @note A default constructed iterator represents the end of the list. * * A successful call to this function is guaranteed to return at least one * entry. */ iterator resolve(const endpoint_type& e, boost::system::error_code& ec) { return this->service.resolve(this->implementation, e, ec); } /// Asynchronously resolve an endpoint to a list of entries. /** * This function is used to asynchronously resolve an endpoint into a list of * endpoint entries. * * @param e An endpoint object that determines what endpoints will be * returned. * * @param handler The handler to be called when the resolve operation * completes. Copies will be made of the handler as required. The function * signature of the handler must be: * @code void handler( * const boost::system::error_code& error, // Result of operation. * resolver::iterator iterator // Forward-only iterator that can * // be used to traverse the list * // of endpoint entries. * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the handler will not be invoked from within this function. Invocation * of the handler will be performed in a manner equivalent to using * boost::asio::io_service::post(). * * @note A default constructed iterator represents the end of the list. * * A successful resolve operation is guaranteed to pass at least one entry to * the handler. */ template
void async_resolve(const endpoint_type& e, ResolveHandler handler) { return this->service.async_resolve(this->implementation, e, handler); } }; } // namespace ip } // namespace asio } // namespace boost #include
#endif // BOOST_ASIO_IP_BASIC_RESOLVER_HPP
basic_resolver.hpp
网页地址
文件地址
上一页
5/16
下一页
下载
( 8 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.