| 927 | } |
| 928 | |
| 929 | uint64_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 | |
| 958 | float MMKV::getFloat(MMKVKey_t key, float defaultValue, bool *hasValue) { |
| 959 | if (isKeyEmpty(key)) { |