string_coding: unused functions
This commit is contained in:
parent
285d9f04d5
commit
3ee2174892
|
@ -34,100 +34,6 @@ namespace epee
|
|||
{
|
||||
namespace string_encoding
|
||||
{
|
||||
inline std::string convert_to_ansii(const std::wstring& str_from)
|
||||
{
|
||||
|
||||
std::string res(str_from.begin(), str_from.end());
|
||||
return res;
|
||||
/*
|
||||
std::string result;
|
||||
std::locale loc;
|
||||
for(unsigned int i= 0; i < str_from.size(); ++i)
|
||||
{
|
||||
result += std::use_facet<std::ctype<wchar_t> >(loc).narrow(str_from[i]);
|
||||
}
|
||||
return result;
|
||||
*/
|
||||
|
||||
//return boost::lexical_cast<std::string>(str_from);
|
||||
/*
|
||||
std::string str_trgt;
|
||||
if(!str_from.size())
|
||||
return str_trgt;
|
||||
int cb = ::WideCharToMultiByte( code_page, 0, str_from.data(), (__int32)str_from.size(), 0, 0, 0, 0 );
|
||||
if(!cb)
|
||||
return str_trgt;
|
||||
str_trgt.resize(cb);
|
||||
::WideCharToMultiByte( code_page, 0, str_from.data(), (int)str_from.size(),
|
||||
(char*)str_trgt.data(), (int)str_trgt.size(), 0, 0);
|
||||
return str_trgt;*/
|
||||
}
|
||||
|
||||
inline std::string convert_to_ansii(const std::string& str_from)
|
||||
{
|
||||
return str_from;
|
||||
}
|
||||
|
||||
inline std::wstring convert_to_unicode(const std::string& str_from)
|
||||
{
|
||||
std::wstring result;
|
||||
std::locale loc;
|
||||
for(unsigned int i= 0; i < str_from.size(); ++i)
|
||||
{
|
||||
result += std::use_facet<std::ctype<wchar_t> >(loc).widen(str_from[i]);
|
||||
}
|
||||
return result;
|
||||
|
||||
//return boost::lexical_cast<std::wstring>(str_from);
|
||||
/*
|
||||
std::wstring str_trgt;
|
||||
if(!str_from.size())
|
||||
return str_trgt;
|
||||
|
||||
int cb = ::MultiByteToWideChar( code_page, 0, str_from.data(), (int)str_from.size(), 0, 0 );
|
||||
if(!cb)
|
||||
return str_trgt;
|
||||
|
||||
str_trgt.resize(cb);
|
||||
::MultiByteToWideChar( code_page, 0, str_from.data(),(int)str_from.size(),
|
||||
(wchar_t*)str_trgt.data(),(int)str_trgt.size());
|
||||
return str_trgt;*/
|
||||
}
|
||||
inline std::wstring convert_to_unicode(const std::wstring& str_from)
|
||||
{
|
||||
return str_from;
|
||||
}
|
||||
|
||||
template<class target_string>
|
||||
inline target_string convert_to_t(const std::wstring& str_from);
|
||||
|
||||
template<>
|
||||
inline std::string convert_to_t<std::string>(const std::wstring& str_from)
|
||||
{
|
||||
return convert_to_ansii(str_from);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline std::wstring convert_to_t<std::wstring>(const std::wstring& str_from)
|
||||
{
|
||||
return str_from;
|
||||
}
|
||||
|
||||
template<class target_string>
|
||||
inline target_string convert_to_t(const std::string& str_from);
|
||||
|
||||
template<>
|
||||
inline std::string convert_to_t<std::string>(const std::string& str_from)
|
||||
{
|
||||
return str_from;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline std::wstring convert_to_t<std::wstring>(const std::string& str_from)
|
||||
{
|
||||
return convert_to_unicode(str_from);
|
||||
}
|
||||
|
||||
inline
|
||||
std::string& base64_chars()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue