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

Method getUInt64

Core/MMKV.cpp:929–956  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

927}
928
929uint64_t MMKV::getUInt64(MMKVKey_t key, uint64_t defaultValue, bool *hasValue) {
930 if (isKeyEmpty(key)) {
931 if (hasValue != nullptr) {
932 *hasValue = false;
933 }
934 return defaultValue;
935 }
936 SCOPED_LOCK(m_lock);
937 SCOPED_LOCK(m_sharedProcessLock);
938 auto data = getDataForKey(key);
939 if (data.length() > 0) {
940 try {
941 CodedInputData input(data.getPtr(), data.length());
942 if (hasValue != nullptr) {
943 *hasValue = true;
944 }
945 return input.readUInt64();
946 } catch (std::exception &exception) {
947 MMKVError("%s", exception.what());
948 } catch (...) {
949 MMKVError("decode fail");
950 }
951 }
952 if (hasValue != nullptr) {
953 *hasValue = false;
954 }
955 return defaultValue;
956}
957
958float MMKV::getFloat(MMKVKey_t key, float defaultValue, bool *hasValue) {
959 if (isKeyEmpty(key)) {

Callers 11

functionalTestFunction · 0.45
functionalTestFunction · 0.45
testImportFunction · 0.45
functionalTestFunction · 0.45
decodeUInt64Function · 0.45
decodeUInt64Function · 0.45
functionalTestFunction · 0.45
testCompareBeforeSetFunction · 0.45
testImportFunction · 0.45
testUInt64Function · 0.45
functionalTestFunction · 0.45

Calls 2

isKeyEmptyFunction · 0.85
readUInt64Method · 0.80

Tested by 2

testUInt64Function · 0.36
functionalTestFunction · 0.36