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

Function encodeDouble

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

Source from the content-addressed store, hash-verified

941}
942
943static napi_value encodeDouble(napi_env env, napi_callback_info info) {
944 size_t argc = 4;
945 napi_value args[4] = {nullptr};
946 NAPI_CALL(napi_get_cb_info(env, info, &argc, args, nullptr, nullptr));
947
948 auto handle = NValueToUInt64(env, args[0]);
949 auto key = NValueToString(env, args[1]);
950 MMKV *kv = reinterpret_cast<MMKV *>(handle);
951 if (kv && key.length() > 0) {
952 auto value = NValueToDouble(env, args[2]);
953 if (IsNValueUndefined(env, args[3])) {
954 auto ret = kv->set(value, key);
955 return BoolToNValue(env, ret);
956 }
957 uint32_t expiration = NValueToUInt32(env, args[3]);
958 auto ret = kv->set(value, key, expiration);
959 return BoolToNValue(env, ret);
960 }
961 return BoolToNValue(env, false);
962}
963
964static napi_value decodeDouble(napi_env env, napi_callback_info info) {
965 size_t argc = 3;

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected