MCPcopy Create free account
hub / github.com/Tencent/MMKV / NValueToString

Function NValueToString

OpenHarmony/entry/src/main/cpp/napi_init.cpp:38–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38static string NValueToString(napi_env env, napi_value value, bool maybeUndefined = false) {
39 if (maybeUndefined && IsNValueUndefined(env, value)) {
40 return "";
41 }
42
43 size_t size;
44 napi_get_value_string_utf8(env, value, nullptr, 0, &size);
45 string result(size, '\0');
46 napi_get_value_string_utf8(env, value, (char *) result.data(), size + 1, nullptr);
47 return result;
48}
49
50static napi_value StringToNValue(napi_env env, const string &value) {
51 napi_value result;

Callers 1

TestNativeMMKVFunction · 0.70

Calls 1

IsNValueUndefinedFunction · 0.70

Tested by 1

TestNativeMMKVFunction · 0.56