MCPcopy Create free account
hub / github.com/axmolengine/axmol / newStringUTFJNI

Function newStringUTFJNI

core/base/UTF8.cpp:379–395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377}
378
379jstring newStringUTFJNI(JNIEnv* env, std::string_view utf8Str, bool* ret)
380{
381 std::u16string utf16Str;
382 bool flag = ax::StringUtils::UTF8ToUTF16(utf8Str, utf16Str);
383
384 if (ret)
385 {
386 *ret = flag;
387 }
388
389 if (!flag)
390 {
391 utf16Str.clear();
392 }
393 jstring stringText = env->NewString((const jchar*)utf16Str.data(), utf16Str.length());
394 return stringText;
395}
396#endif
397
398std::vector<char16_t> getChar16VectorFromUTF16String(const std::u16string& utf16)

Calls 4

UTF8ToUTF16Function · 0.85
clearMethod · 0.45
dataMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected