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

Function encodeNumberSet

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

Source from the content-addressed store, hash-verified

1057}
1058
1059static napi_value encodeNumberSet(napi_env env, napi_callback_info info) {
1060 size_t argc = 4;
1061 napi_value args[4] = {nullptr};
1062 NAPI_CALL(napi_get_cb_info(env, info, &argc, args, nullptr, nullptr));
1063
1064 auto handle = NValueToUInt64(env, args[0]);
1065 auto key = NValueToString(env, args[1]);
1066 MMKV *kv = reinterpret_cast<MMKV *>(handle);
1067 if (kv && key.length() > 0) {
1068 auto value = NValueToDoubleArray(env, args[2]);
1069 if (IsNValueUndefined(env, args[3])) {
1070 auto ret = kv->set(value, key);
1071 return BoolToNValue(env, ret);
1072 }
1073 uint32_t expiration = NValueToUInt32(env, args[3]);
1074 auto ret = kv->set(value, key, expiration);
1075 return BoolToNValue(env, ret);
1076 }
1077 return BoolToNValue(env, false);
1078}
1079
1080static napi_value decodeNumberSet(napi_env env, napi_callback_info info) {
1081 size_t argc = 3;

Callers

nothing calls this directly

Calls 7

NValueToUInt64Function · 0.85
NValueToDoubleArrayFunction · 0.85
NValueToUInt32Function · 0.85
NValueToStringFunction · 0.70
IsNValueUndefinedFunction · 0.70
BoolToNValueFunction · 0.70
setMethod · 0.45

Tested by

no test coverage detected