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

Function decodeUInt32

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

Source from the content-addressed store, hash-verified

802}
803
804static napi_value decodeUInt32(napi_env env, napi_callback_info info) {
805 size_t argc = 3;
806 napi_value args[3] = {nullptr};
807 NAPI_CALL(napi_get_cb_info(env, info, &argc, args, nullptr, nullptr));
808
809 auto handle = NValueToUInt64(env, args[0]);
810 auto key = NValueToString(env, args[1]);
811 auto defaultValue = NValueToUInt32(env, args[2]);
812 MMKV *kv = reinterpret_cast<MMKV *>(handle);
813 if (kv && key.length() > 0) {
814 bool hasValue = false;
815 auto ret = kv->getUInt32(key, defaultValue, &hasValue);
816 if (hasValue) {
817 return UInt32ToNValue(env, ret);
818 }
819 }
820 return args[2];
821}
822
823static napi_value encodeInt64(napi_env env, napi_callback_info info) {
824 size_t argc = 4;

Callers

nothing calls this directly

Calls 5

NValueToUInt64Function · 0.85
NValueToUInt32Function · 0.85
UInt32ToNValueFunction · 0.85
NValueToStringFunction · 0.70
getUInt32Method · 0.45

Tested by

no test coverage detected