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

Function decodeInt64

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

Source from the content-addressed store, hash-verified

842}
843
844static napi_value decodeInt64(napi_env env, napi_callback_info info) {
845 size_t argc = 3;
846 napi_value args[3] = {nullptr};
847 NAPI_CALL(napi_get_cb_info(env, info, &argc, args, nullptr, nullptr));
848
849 auto handle = NValueToUInt64(env, args[0]);
850 auto key = NValueToString(env, args[1]);
851 auto defaultValue = NValueToInt64(env, args[2]);
852 MMKV *kv = reinterpret_cast<MMKV *>(handle);
853 if (kv && key.length() > 0) {
854 bool hasValue = false;
855 auto ret = kv->getInt64(key, defaultValue, &hasValue);
856 if (hasValue) {
857 return Int64ToNValue(env, ret);
858 }
859 }
860 return args[2];
861}
862
863static napi_value encodeUInt64(napi_env env, napi_callback_info info) {
864 size_t argc = 4;

Callers

nothing calls this directly

Calls 5

NValueToUInt64Function · 0.85
NValueToInt64Function · 0.85
Int64ToNValueFunction · 0.85
NValueToStringFunction · 0.70
getInt64Method · 0.45

Tested by

no test coverage detected