Start work to enable scripting

This commit is contained in:
Marianne Gagnon
2015-04-24 20:59:32 -04:00
parent fc942433e2
commit 9f883db6f7
10 changed files with 230 additions and 94 deletions
+27 -1
View File
@@ -22,7 +22,7 @@
#include "utils/log.hpp"
#include "utils/time.hpp"
#include "utils/utf8.h"
#include "coreutil.h"
#include <math.h>
@@ -684,6 +684,32 @@ namespace StringUtils
return output.str();
} // xmlEncode
// ------------------------------------------------------------------------
std::string wide_to_utf8(const wchar_t* input)
{
static std::vector<char> utf8line;
utf8line.clear();
utf8::utf16to8(input, input + wcslen(input), back_inserter(utf8line));
utf8line.push_back(0);
return std::string(&utf8line[0]);
}
// ------------------------------------------------------------------------
irr::core::stringw utf8_to_wide(const char* input)
{
static std::vector<wchar_t> utf16line;
utf16line.clear();
utf8::utf8to16(input, input + strlen(input), back_inserter(utf16line));
utf16line.push_back(0);
return irr::core::stringw(&utf16line[0]);
}
// ------------------------------------------------------------------------
/** Converts a version string (in the form of 'X.Y.Za-rcU' into an
* integer number.