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

Function decodeString

OpenHarmony/MMKV/src/main/cpp/native_bridge.cpp:1004–1019  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1002}
1003
1004static napi_value decodeString(napi_env env, napi_callback_info info) {
1005 size_t argc = 3;
1006 napi_value args[3] = {nullptr};
1007 NAPI_CALL(napi_get_cb_info(env, info, &argc, args, nullptr, nullptr));
1008
1009 auto handle = NValueToUInt64(env, args[0]);
1010 auto key = NValueToString(env, args[1]);
1011 MMKV *kv = reinterpret_cast<MMKV *>(handle);
1012 if (kv && key.length() > 0) {
1013 string result;
1014 if (kv->getString(key, result)) {
1015 return StringToNValue(env, result);
1016 }
1017 }
1018 return args[2];
1019}
1020
1021static napi_value encodeStringSet(napi_env env, napi_callback_info info) {
1022 size_t argc = 4;

Callers

nothing calls this directly

Calls 4

NValueToUInt64Function · 0.85
NValueToStringFunction · 0.70
StringToNValueFunction · 0.70
getStringMethod · 0.45

Tested by

no test coverage detected