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

Function encodeBoolSet

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

Source from the content-addressed store, hash-verified

1095}
1096
1097static napi_value encodeBoolSet(napi_env env, napi_callback_info info) {
1098 size_t argc = 4;
1099 napi_value args[4] = {nullptr};
1100 NAPI_CALL(napi_get_cb_info(env, info, &argc, args, nullptr, nullptr));
1101
1102 auto handle = NValueToUInt64(env, args[0]);
1103 auto key = NValueToString(env, args[1]);
1104 MMKV *kv = reinterpret_cast<MMKV *>(handle);
1105 if (kv && key.length() > 0) {
1106 auto value = NValueToBoolArray(env, args[2]);
1107 if (IsNValueUndefined(env, args[3])) {
1108 auto ret = kv->set(value, key);
1109 return BoolToNValue(env, ret);
1110 }
1111 uint32_t expiration = NValueToUInt32(env, args[3]);
1112 auto ret = kv->set(value, key, expiration);
1113 }
1114 return BoolToNValue(env, false);
1115}
1116
1117static napi_value decodeBoolSet(napi_env env, napi_callback_info info) {
1118 size_t argc = 3;

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected