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

Function encodeUInt32

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

Source from the content-addressed store, hash-verified

781}
782
783static napi_value encodeUInt32(napi_env env, napi_callback_info info) {
784 size_t argc = 4;
785 napi_value args[4] = {nullptr};
786 NAPI_CALL(napi_get_cb_info(env, info, &argc, args, nullptr, nullptr));
787
788 auto handle = NValueToUInt64(env, args[0]);
789 auto key = NValueToString(env, args[1]);
790 MMKV *kv = reinterpret_cast<MMKV *>(handle);
791 if (kv && key.length() > 0) {
792 auto value = NValueToUInt32(env, args[2]);
793 if (IsNValueUndefined(env, args[3])) {
794 auto ret = kv->set(value, key);
795 return BoolToNValue(env, ret);
796 }
797 uint32_t expiration = NValueToUInt32(env, args[3]);
798 auto ret = kv->set(value, key, expiration);
799 return BoolToNValue(env, ret);
800 }
801 return BoolToNValue(env, false);
802}
803
804static napi_value decodeUInt32(napi_env env, napi_callback_info info) {
805 size_t argc = 3;

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected