mirror of
https://github.com/borgesdan/xn65
synced 2024-12-29 21:54:47 +01:00
26 lines
532 B
C++
26 lines
532 B
C++
|
#ifndef XNA_HELPERS_HPP
|
||
|
#define XNA_HELPERS_HPP
|
||
|
|
||
|
#include <string>
|
||
|
|
||
|
namespace xna {
|
||
|
inline std::wstring StringToWString(const std::string& str)
|
||
|
{
|
||
|
std::wstring wstr;
|
||
|
size_t size;
|
||
|
wstr.resize(str.length());
|
||
|
mbstowcs_s(&size, &wstr[0], wstr.size() + 1, str.c_str(), str.size());
|
||
|
return wstr;
|
||
|
}
|
||
|
|
||
|
inline std::string WStringToString(const std::wstring& wstr)
|
||
|
{
|
||
|
std::string str;
|
||
|
size_t size;
|
||
|
str.resize(wstr.length());
|
||
|
wcstombs_s(&size, &str[0], str.size() + 1, wstr.c_str(), wstr.size());
|
||
|
return str;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endif
|