AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Acore::Asio::Resolver Class Reference

#include "Resolver.h"

Public Member Functions

 Resolver (IoContext &ioContext)
 
Optional< boost::asio::ip::tcp::endpoint > Resolve (boost::asio::ip::tcp const &protocol, std::string const &host, std::string const &service)
 

Private Attributes

boost::asio::ip::tcp::resolver _impl
 

Detailed Description

Hack to make it possible to forward declare resolver (one of its template arguments is a typedef to something super long and using nested classes)

Constructor & Destructor Documentation

◆ Resolver()

Acore::Asio::Resolver::Resolver ( IoContext ioContext)
inlineexplicit
34: _impl(ioContext) { }
boost::asio::ip::tcp::resolver _impl
Definition: Resolver.h:59

Member Function Documentation

◆ Resolve()

Optional< boost::asio::ip::tcp::endpoint > Acore::Asio::Resolver::Resolve ( boost::asio::ip::tcp const &  protocol,
std::string const &  host,
std::string const &  service 
)
inline
37 {
38 boost::system::error_code ec;
39#if BOOST_VERSION >= 106600
40 boost::asio::ip::resolver_base::flags flagsResolver = boost::asio::ip::resolver_base::all_matching;
41 boost::asio::ip::tcp::resolver::results_type results = _impl.resolve(protocol, host, service, flagsResolver, ec);
42 if (results.begin() == results.end() || ec)
43 return {};
44
45 return results.begin()->endpoint();
46#else
47 boost::asio::ip::resolver_query_base::flags flagsQuery = boost::asio::ip::tcp::resolver::query::all_matching;
48 boost::asio::ip::tcp::resolver::query query(std::move(protocol), std::move(host), std::move(service), flagsQuery);
49 boost::asio::ip::tcp::resolver::iterator itr = _impl.resolve(query, ec);
50 boost::asio::ip::tcp::resolver::iterator end;
51 if (itr == end || ec)
52 return {};
53
54 return itr->endpoint();
55#endif
56 }

References _impl.

Referenced by LoadRealmInfo().

Member Data Documentation

◆ _impl

boost::asio::ip::tcp::resolver Acore::Asio::Resolver::_impl
private

Referenced by Resolve().