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

Function decodeBytes

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

Source from the content-addressed store, hash-verified

1156}
1157
1158static napi_value decodeBytes(napi_env env, napi_callback_info info) {
1159 size_t argc = 3;
1160 napi_value args[3] = {nullptr};
1161 NAPI_CALL(napi_get_cb_info(env, info, &argc, args, nullptr, nullptr));
1162
1163 auto handle = NValueToUInt64(env, args[0]);
1164 auto key = NValueToString(env, args[1]);
1165 MMKV *kv = reinterpret_cast<MMKV *>(handle);
1166 if (kv && key.length() > 0) {
1167 MMBuffer result;
1168 if (kv->getBytes(key, result)) {
1169 return MMBufferToNValue(env, std::move(result));
1170 }
1171 }
1172 return args[2];
1173}
1174
1175template <typename T>
1176napi_value encodeArray(napi_env env, napi_callback_info info) {

Callers

nothing calls this directly

Calls 4

NValueToUInt64Function · 0.85
MMBufferToNValueFunction · 0.85
NValueToStringFunction · 0.70
getBytesMethod · 0.45

Tested by

no test coverage detected