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

Function encodeStringSet

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

Source from the content-addressed store, hash-verified

1019}
1020
1021static napi_value encodeStringSet(napi_env env, napi_callback_info info) {
1022 size_t argc = 4;
1023 napi_value args[4] = {nullptr};
1024 NAPI_CALL(napi_get_cb_info(env, info, &argc, args, nullptr, nullptr));
1025
1026 auto handle = NValueToUInt64(env, args[0]);
1027 auto key = NValueToString(env, args[1]);
1028 MMKV *kv = reinterpret_cast<MMKV *>(handle);
1029 if (kv && key.length() > 0) {
1030 auto value = NValueToStringArray(env, args[2]);
1031 if (IsNValueUndefined(env, args[3])) {
1032 auto ret = kv->set(value, key);
1033 return BoolToNValue(env, ret);
1034 }
1035 uint32_t expiration = NValueToUInt32(env, args[3]);
1036 auto ret = kv->set(value, key, expiration);
1037 return BoolToNValue(env, ret);
1038 }
1039 return BoolToNValue(env, false);
1040}
1041
1042static napi_value decodeStringSet(napi_env env, napi_callback_info info) {
1043 size_t argc = 3;

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected