mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 04:41:16 +00:00
Patched to read into std::wstring
This commit is contained in:
@@ -32,4 +32,7 @@ namespace YAML
|
||||
|
||||
template <>
|
||||
bool Converter<bool>::Convert(const std::string& input, bool& output);
|
||||
|
||||
template <>
|
||||
bool Converter<std::wstring>::Convert(const std::string& input, std::wstring& output);
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "conversion.h"
|
||||
#include <algorithm>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Specializations for converting a string to specific types
|
||||
@@ -82,5 +82,19 @@ namespace YAML
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user