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

Function decodeBool

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

Source from the content-addressed store, hash-verified

722}
723
724static napi_value decodeBool(napi_env env, napi_callback_info info) {
725 size_t argc = 3;
726 napi_value args[3] = {nullptr};
727 NAPI_CALL(napi_get_cb_info(env, info, &argc, args, nullptr, nullptr));
728
729 auto handle = NValueToUInt64(env, args[0]);
730 auto key = NValueToString(env, args[1]);
731 auto defaultValue = NValueToBool(env, args[2]);
732 MMKV *kv = reinterpret_cast<MMKV *>(handle);
733 if (kv && key.length() > 0) {
734 bool hasValue = false;
735 auto ret = kv->getBool(key, defaultValue, &hasValue);
736 if(hasValue) {
737 return BoolToNValue(env, ret);
738 }
739 }
740 return args[2];
741}
742
743static napi_value encodeInt32(napi_env env, napi_callback_info info) {
744 size_t argc = 4;

Callers

nothing calls this directly

Calls 5

NValueToUInt64Function · 0.85
NValueToBoolFunction · 0.85
NValueToStringFunction · 0.70
BoolToNValueFunction · 0.70
getBoolMethod · 0.45

Tested by

no test coverage detected