Move ucstring utf8 implementation to header

develop
kaetemi 4 years ago
parent 3dddc5ab40
commit 1300d5d4d4

@ -128,17 +128,7 @@ public:
} }
/// Converts the controlled ucstring to a string str /// Converts the controlled ucstring to a string str
void toString (std::string &str) const void toString(std::string &str) const;
{
str.resize (size ());
for (uint i = 0; i < str.size (); i++)
{
if (operator[](i) > 255)
str[i] = '?';
else
str[i] = (char) operator[](i);
}
}
/// Converts the controlled ucstring and returns the resulting string /// Converts the controlled ucstring and returns the resulting string
std::string toString () const std::string toString () const

@ -17,6 +17,18 @@
#include "stdmisc.h" #include "stdmisc.h"
#include "nel/misc/ucstring.h" #include "nel/misc/ucstring.h"
void ucstring::toString(std::string &str) const
{
str.resize(size());
for (uint i = 0; i < str.size (); i++)
{
if (operator[](i) > 255)
str[i] = '?';
else
str[i] = (char) operator[](i);
}
}
std::string ucstring::toUtf8() const std::string ucstring::toUtf8() const
{ {
std::string res; std::string res;

Loading…
Cancel
Save