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

Function decodeFloat

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

Source from the content-addressed store, hash-verified

922}
923
924static napi_value decodeFloat(napi_env env, napi_callback_info info) {
925 size_t argc = 3;
926 napi_value args[3] = {nullptr};
927 NAPI_CALL(napi_get_cb_info(env, info, &argc, args, nullptr, nullptr));
928
929 auto handle = NValueToUInt64(env, args[0]);
930 auto key = NValueToString(env, args[1]);
931 auto defaultValue = NValueToDouble(env, args[2]);
932 MMKV *kv = reinterpret_cast<MMKV *>(handle);
933 if (kv && key.length() > 0) {
934 bool hasValue = false;
935 auto ret = kv->getFloat(key, defaultValue, &hasValue);
936 if (hasValue) {
937 return DoubleToNValue(env, ret);
938 }
939 }
940 return args[2];
941}
942
943static napi_value encodeDouble(napi_env env, napi_callback_info info) {
944 size_t argc = 4;

Callers

nothing calls this directly

Calls 5

NValueToUInt64Function · 0.85
NValueToDoubleFunction · 0.85
DoubleToNValueFunction · 0.85
NValueToStringFunction · 0.70
getFloatMethod · 0.45

Tested by

no test coverage detected