charset: provide overloads for rvalue references
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user