charset: provide overloads for rvalue references

This commit is contained in:
Andrzej Rybczak
2015-06-13 16:51:22 +02:00
parent 2ea3679220
commit fac92e17aa
2 changed files with 16 additions and 0 deletions

View File

@@ -68,4 +68,18 @@ std::string localeToUtf8(const std::string &s)
: boost::locale::conv::to_utf<char>(s, Config.system_encoding);
}
std::string utf8ToLocale(std::string &&s)
{
if (!Config.system_encoding.empty())
s = boost::locale::conv::from_utf<char>(s, Config.system_encoding);
return std::move(s);
}
std::string localeToUtf8(std::string &&s)
{
if (!Config.system_encoding.empty())
s = boost::locale::conv::to_utf<char>(s, Config.system_encoding);
return std::move(s);
}
}

View File

@@ -32,7 +32,9 @@ std::string toUtf8From(const std::string &s, const char *charset);
std::string fromUtf8To(const std::string &s, const char *charset);
std::string utf8ToLocale(const std::string &s);
std::string utf8ToLocale(std::string &&s);
std::string localeToUtf8(const std::string &s);
std::string localeToUtf8(std::string &&s);
}