11 #ifndef ASIO_DETAIL_WINRT_UTILS_HPP    12 #define ASIO_DETAIL_WINRT_UTILS_HPP    14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)    16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)    20 #if defined(ASIO_WINDOWS_RUNTIME)    28 #include <windows.storage.streams.h>    29 #include <wrl/implements.h>    39 namespace winrt_utils {
    41 inline Platform::String^ string(
const char* from)
    43   std::wstring tmp(from, from + std::strlen(from));
    44   return ref 
new Platform::String(tmp.c_str());
    47 inline Platform::String^ string(
const std::string& from)
    49   std::wstring tmp(from.begin(), from.end());
    50   return ref 
new Platform::String(tmp.c_str());
    53 inline std::string string(Platform::String^ from)
    55   std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
    56   return converter.to_bytes(from->Data());
    59 inline Platform::String^ string(
unsigned short from)
    65 inline Platform::String^ string(
const T& from)
    67   return string(from.to_string());
    70 inline int integer(Platform::String^ from)
    72   return _wtoi(from->Data());
    76 inline Windows::Networking::HostName^ 
host_name(
const T& from)
    78   return ref 
new Windows::Networking::HostName((
string)(from));
    81 template <
typename ConstBufferSequence>
    82 inline Windows::Storage::Streams::IBuffer^ buffer_dup(
    83     const ConstBufferSequence& 
buffers)
    85   using Microsoft::WRL::ComPtr;
    87   auto b = ref 
new Windows::Storage::Streams::Buffer(size);
    88   ComPtr<IInspectable> insp = 
reinterpret_cast<IInspectable*
>(
b);
    89   ComPtr<Windows::Storage::Streams::IBufferByteAccess> bacc;
    91   byte* bytes = 
nullptr;
   104 #endif // defined(ASIO_WINDOWS_RUNTIME)   106 #endif // ASIO_DETAIL_WINRT_UTILS_HPP mutable_buffers_1 buffer(const mutable_buffer &b)
Create a new modifiable buffer from an existing buffer. 
 
asio::basic_streambuf< Allocator > & b
 
std::string to_string(reply::status_type status)
 
std::size_t buffer_size(const mutable_buffer &b)
Get the number of bytes in a modifiable buffer. 
 
const MutableBufferSequence & buffers
 
ASIO_DECL std::string host_name()
Get the current host name. 
 
std::size_t buffer_copy(const mutable_buffer &target, const const_buffer &source)
Copies bytes from a source buffer to a target buffer.