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

Function encodeInt32

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

Source from the content-addressed store, hash-verified

741}
742
743static napi_value encodeInt32(napi_env env, napi_callback_info info) {
744 size_t argc = 4;
745 napi_value args[4] = {nullptr};
746 NAPI_CALL(napi_get_cb_info(env, info, &argc, args, nullptr, nullptr));
747
748 auto handle = NValueToUInt64(env, args[0]);
749 auto key = NValueToString(env, args[1]);
750 MMKV *kv = reinterpret_cast<MMKV *>(handle);
751 if (kv && key.length() > 0) {
752 auto value = NValueToInt32(env, args[2]);
753 if (IsNValueUndefined(env, args[3])) {
754 auto ret = kv->set(value, key);
755 return BoolToNValue(env, ret);
756 }
757 uint32_t expiration = NValueToUInt32(env, args[3]);
758 auto ret = kv->set(value, key, expiration);
759 return BoolToNValue(env, ret);
760 }
761 return BoolToNValue(env, false);
762}
763
764static napi_value decodeInt32(napi_env env, napi_callback_info info) {
765 size_t argc = 3;

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected