MCPcopy Create free account
hub / github.com/GNOME/gjs / gjs_unichar_from_string

Function gjs_unichar_from_string

gjs/jsapi-util-string.cpp:437–444  ·  view source on GitHub ↗

* gjs_unichar_from_string: * @string: A string * @result: (out): A unicode character * * If successful, @result is assigned the Unicode codepoint * corresponding to the first full character in @string. This * function handles characters outside the BMP. * * If @string is empty, @result will be 0. An exception will * be thrown if @string can not be represented as UTF-8. */

Source from the content-addressed store, hash-verified

435 * be thrown if @string can not be represented as UTF-8.
436 */
437bool gjs_unichar_from_string(JSContext* cx, JS::Value value, gunichar* result) {
438 JS::UniqueChars utf8_str{gjs_string_to_utf8(cx, value)};
439 if (utf8_str) {
440 *result = g_utf8_get_char(utf8_str.get());
441 return true;
442 }
443 return false;
444}
445
446jsid gjs_intern_string_to_id(JSContext* cx, const char* string) {
447 JS::RootedString str(cx, JS_AtomizeAndPinString(cx, string));

Callers 3

inMethod · 0.85
value_to_ghashtable_keyFunction · 0.85

Calls 2

gjs_string_to_utf8Function · 0.85
getMethod · 0.45

Tested by

no test coverage detected