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

Function decodeInt32

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

Source from the content-addressed store, hash-verified

762}
763
764static napi_value decodeInt32(napi_env env, napi_callback_info info) {
765 size_t argc = 3;
766 napi_value args[3] = {nullptr};
767 NAPI_CALL(napi_get_cb_info(env, info, &argc, args, nullptr, nullptr));
768
769 auto handle = NValueToUInt64(env, args[0]);
770 auto key = NValueToString(env, args[1]);
771 auto defaultValue = NValueToInt32(env, args[2]);
772 MMKV *kv = reinterpret_cast<MMKV *>(handle);
773 if (kv && key.length() > 0) {
774 bool hasValue = false;
775 auto ret = kv->getInt32(key, defaultValue, &hasValue);
776 if (hasValue) {
777 return Int32ToNValue(env, ret);
778 }
779 }
780 return args[2];
781}
782
783static napi_value encodeUInt32(napi_env env, napi_callback_info info) {
784 size_t argc = 4;

Callers

nothing calls this directly

Calls 5

NValueToUInt64Function · 0.85
NValueToInt32Function · 0.85
Int32ToNValueFunction · 0.85
NValueToStringFunction · 0.70
getInt32Method · 0.45

Tested by

no test coverage detected