Commit f8440aa0 authored by jbeder's avatar jbeder
Browse files

Patched to read into std::wstring

parent fd5bf7c2
...@@ -32,4 +32,7 @@ namespace YAML ...@@ -32,4 +32,7 @@ namespace YAML
template <> template <>
bool Converter<bool>::Convert(const std::string& input, bool& output); bool Converter<bool>::Convert(const std::string& input, bool& output);
template <>
bool Converter<std::wstring>::Convert(const std::string& input, std::wstring& output);
} }
#include "conversion.h" #include "conversion.h"
#include <algorithm> #include <algorithm>
#include <cstdlib>
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
// Specializations for converting a string to specific types // Specializations for converting a string to specific types
...@@ -82,5 +82,19 @@ namespace YAML ...@@ -82,5 +82,19 @@ namespace YAML
return false; return false;
} }
template <>
bool Converter<std::wstring>::Convert(const std::string& input, std::wstring& output)
{
output.clear();
output.resize(std::mbstowcs(NULL, input.data(), input.size()));
std::mbstowcs(
(wchar_t *) output.data(),
input.data(),
input.size()
);
return true;
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment