diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-09-27 23:51:34 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-09-27 23:51:34 +0200 |
commit | a7a285eb61dd83afc892bc1d64ffe14b9f1426a3 (patch) | |
tree | 08d2efcaec46e5f5702d9e336a0e8ba7e636aff9 /src/Core/String.cpp | |
parent | b40ba0cf91603b695f1f2380cbd39966a458f22f (diff) | |
download | mad-a7a285eb61dd83afc892bc1d64ffe14b9f1426a3.tar mad-a7a285eb61dd83afc892bc1d64ffe14b9f1426a3.zip |
Completely migrate to Unicode String class
Diffstat (limited to 'src/Core/String.cpp')
-rw-r--r-- | src/Core/String.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Core/String.cpp b/src/Core/String.cpp index d9d357e..e66e456 100644 --- a/src/Core/String.cpp +++ b/src/Core/String.cpp @@ -22,6 +22,15 @@ namespace Mad { namespace Core { +std::string String::toCodepage(const char *codepage) const { + boost::uint32_t len = static_cast<boost::uint32_t>(extract(0, length(), 0, codepage)); + + boost::scoped_array<char> buf(new char[len]); + extract(0, length(), buf.get(), len, codepage); + + return std::string(buf.get(), len); +} + boost::int32_t String::findFirstOf(const String &chars, boost::int32_t start) const { for(boost::int32_t i = start; i < length(); ++i) { if(chars.indexOf(charAt(i)) >= 0) |