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

Function encodeBool

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

Source from the content-addressed store, hash-verified

701}
702
703static napi_value encodeBool(napi_env env, napi_callback_info info) {
704 size_t argc = 4;
705 napi_value args[4] = {nullptr};
706 NAPI_CALL(napi_get_cb_info(env, info, &argc, args, nullptr, nullptr));
707
708 auto handle = NValueToUInt64(env, args[0]);
709 auto key = NValueToString(env, args[1]);
710 MMKV *kv = reinterpret_cast<MMKV *>(handle);
711 if (kv && key.length() > 0) {
712 auto value = NValueToBool(env,args[2]);
713 if (IsNValueUndefined(env, args[3])) {
714 auto ret = kv->set(value, key);
715 return BoolToNValue(env, ret);
716 }
717 uint32_t expiration = NValueToUInt32(env, args[3]);
718 auto ret = kv->set(value, key, expiration);
719 return BoolToNValue(env, ret);
720 }
721 return BoolToNValue(env,false);
722}
723
724static napi_value decodeBool(napi_env env, napi_callback_info info) {
725 size_t argc = 3;

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected