MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / createUTF16string

Function createUTF16string

Engine/source/core/strings/unicode.cpp:249–268  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Functions that convert buffers of unicode code points -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

247// Functions that convert buffers of unicode code points
248//-----------------------------------------------------------------------------
249UTF16* createUTF16string( const UTF8* unistring)
250{
251 PROFILE_SCOPE(createUTF16string);
252
253 // allocate plenty of memory.
254 U32 nCodepoints, len = dStrlen(unistring) + 1;
255 FrameTemp<UTF16> buf(len);
256
257 // perform conversion
258 nCodepoints = convertUTF8toUTF16N( unistring, buf, len);
259
260 // add 1 for the NULL terminator the converter promises it included.
261 nCodepoints++;
262
263 // allocate the return buffer, copy over, and return it.
264 UTF16 *ret = new UTF16[nCodepoints];
265 dMemcpy(ret, buf, nCodepoints * sizeof(UTF16));
266
267 return ret;
268}
269
270//-----------------------------------------------------------------------------
271UTF8* createUTF8string( const UTF16* unistring)

Callers 6

setCursorShapeMethod · 0.85
appendMethod · 0.85
insertMethod · 0.85
utf16Method · 0.85
StrTestMethod · 0.85
messageBoxMethod · 0.85

Calls 3

convertUTF8toUTF16NFunction · 0.85
dStrlenFunction · 0.70
dMemcpyFunction · 0.50

Tested by 1

StrTestMethod · 0.68