@react-native-ohos/react-native-mmkv 3.3.1-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1114) hide show
  1. package/MMKV/Core/CMakeLists.txt +172 -0
  2. package/MMKV/Core/CodedInputData.cpp +252 -0
  3. package/MMKV/Core/CodedInputData.h +87 -0
  4. package/MMKV/Core/CodedInputDataCrypt.cpp +280 -0
  5. package/MMKV/Core/CodedInputDataCrypt.h +87 -0
  6. package/MMKV/Core/CodedInputDataCrypt_OSX.cpp +62 -0
  7. package/MMKV/Core/CodedInputData_OSX.cpp +92 -0
  8. package/MMKV/Core/CodedOutputData.cpp +186 -0
  9. package/MMKV/Core/CodedOutputData.h +88 -0
  10. package/MMKV/Core/Core.xcodeproj/project.pbxproj +707 -0
  11. package/MMKV/Core/Core.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  12. package/MMKV/Core/Core.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  13. package/MMKV/Core/Core.xcodeproj/xcshareddata/xcschemes/Core.xcscheme +67 -0
  14. package/MMKV/Core/Core.xcodeproj/xcshareddata/xcschemes/MMKVWatchCore.xcscheme +67 -0
  15. package/MMKV/Core/InterProcessLock.cpp +186 -0
  16. package/MMKV/Core/InterProcessLock.h +119 -0
  17. package/MMKV/Core/InterProcessLock_Android.cpp +103 -0
  18. package/MMKV/Core/InterProcessLock_Win32.cpp +108 -0
  19. package/MMKV/Core/KeyValueHolder.cpp +236 -0
  20. package/MMKV/Core/KeyValueHolder.h +122 -0
  21. package/MMKV/Core/MMBuffer.cpp +210 -0
  22. package/MMKV/Core/MMBuffer.h +111 -0
  23. package/MMKV/Core/MMKV.cpp +1702 -0
  24. package/MMKV/Core/MMKV.h +595 -0
  25. package/MMKV/Core/MMKVLog.cpp +127 -0
  26. package/MMKV/Core/MMKVLog.h +86 -0
  27. package/MMKV/Core/MMKVLog_Android.cpp +134 -0
  28. package/MMKV/Core/MMKVMetaInfo.hpp +99 -0
  29. package/MMKV/Core/MMKVPredef.h +293 -0
  30. package/MMKV/Core/MMKV_Android.cpp +261 -0
  31. package/MMKV/Core/MMKV_IO.cpp +1905 -0
  32. package/MMKV/Core/MMKV_IO.h +57 -0
  33. package/MMKV/Core/MMKV_OSX.cpp +423 -0
  34. package/MMKV/Core/MMKV_OSX.h +57 -0
  35. package/MMKV/Core/MemoryFile.cpp +603 -0
  36. package/MMKV/Core/MemoryFile.h +194 -0
  37. package/MMKV/Core/MemoryFile_Android.cpp +236 -0
  38. package/MMKV/Core/MemoryFile_Linux.cpp +125 -0
  39. package/MMKV/Core/MemoryFile_OSX.cpp +142 -0
  40. package/MMKV/Core/MemoryFile_Win32.cpp +554 -0
  41. package/MMKV/Core/MiniPBCoder.cpp +672 -0
  42. package/MMKV/Core/MiniPBCoder.h +151 -0
  43. package/MMKV/Core/MiniPBCoder_OSX.cpp +237 -0
  44. package/MMKV/Core/PBEncodeItem.hpp +104 -0
  45. package/MMKV/Core/PBUtility.cpp +61 -0
  46. package/MMKV/Core/PBUtility.h +148 -0
  47. package/MMKV/Core/ScopedLock.hpp +69 -0
  48. package/MMKV/Core/ThreadLock.cpp +75 -0
  49. package/MMKV/Core/ThreadLock.h +81 -0
  50. package/MMKV/Core/ThreadLock_Win32.cpp +89 -0
  51. package/MMKV/Core/aes/AESCrypt.cpp +273 -0
  52. package/MMKV/Core/aes/AESCrypt.h +112 -0
  53. package/MMKV/Core/aes/openssl/openssl_aes-armv4.S +1243 -0
  54. package/MMKV/Core/aes/openssl/openssl_aes.h +130 -0
  55. package/MMKV/Core/aes/openssl/openssl_aes_core.cpp +1044 -0
  56. package/MMKV/Core/aes/openssl/openssl_aes_locl.h +38 -0
  57. package/MMKV/Core/aes/openssl/openssl_aesv8-armx.S +308 -0
  58. package/MMKV/Core/aes/openssl/openssl_arm_arch.h +84 -0
  59. package/MMKV/Core/aes/openssl/openssl_cfb128.cpp +97 -0
  60. package/MMKV/Core/aes/openssl/openssl_md32_common.h +254 -0
  61. package/MMKV/Core/aes/openssl/openssl_md5.h +49 -0
  62. package/MMKV/Core/aes/openssl/openssl_md5_dgst.cpp +166 -0
  63. package/MMKV/Core/aes/openssl/openssl_md5_locl.h +75 -0
  64. package/MMKV/Core/aes/openssl/openssl_md5_one.cpp +30 -0
  65. package/MMKV/Core/aes/openssl/openssl_opensslconf.h +271 -0
  66. package/MMKV/Core/core.vcxproj +288 -0
  67. package/MMKV/Core/core.vcxproj.filters +150 -0
  68. package/MMKV/Core/crc32/Checksum.h +75 -0
  69. package/MMKV/Core/crc32/crc32_armv8.cpp +134 -0
  70. package/MMKV/Core/crc32/zlib/CMakeLists.txt +60 -0
  71. package/MMKV/Core/crc32/zlib/crc32.cpp +55 -0
  72. package/MMKV/Core/crc32/zlib/crc32.h +48 -0
  73. package/MMKV/Core/crc32/zlib/zconf.h +380 -0
  74. package/MMKV/Core/crc32/zlib/zutil.h +25 -0
  75. package/MMKV/README.md +354 -0
  76. package/README.md +5 -0
  77. package/cpp/MMKVManagedBuffer.h +32 -0
  78. package/cpp/MmkvHostObject.cpp +355 -0
  79. package/cpp/MmkvHostObject.h +32 -0
  80. package/cpp/MmkvLogger.h +35 -0
  81. package/cpp/NativeMmkvModule.cpp +43 -0
  82. package/cpp/NativeMmkvModule.h +38 -0
  83. package/harmony/reactNativeMMKV/BuildProfile.ets +17 -0
  84. package/harmony/reactNativeMMKV/LICENSE +20 -0
  85. package/harmony/reactNativeMMKV/NOTICE +34 -0
  86. package/harmony/reactNativeMMKV/README.OpenSource +11 -0
  87. package/harmony/reactNativeMMKV/build-profile.json5 +9 -0
  88. package/harmony/reactNativeMMKV/hvigorfile.ts +6 -0
  89. package/harmony/reactNativeMMKV/index.ets +24 -0
  90. package/harmony/reactNativeMMKV/oh-package.json5 +15 -0
  91. package/harmony/reactNativeMMKV/src/main/cpp/CMakeLists.txt +15 -0
  92. package/harmony/reactNativeMMKV/src/main/cpp/ComponentDescriptors.h +39 -0
  93. package/harmony/reactNativeMMKV/src/main/cpp/EventEmitters.cpp +41 -0
  94. package/harmony/reactNativeMMKV/src/main/cpp/EventEmitters.h +182 -0
  95. package/harmony/reactNativeMMKV/src/main/cpp/HarmonyLogger.cpp +32 -0
  96. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/.clang-format +36 -0
  97. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/.dockerignore +2 -0
  98. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/.github/FUNDING.yml +14 -0
  99. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/.github/ISSUE_TEMPLATE/bug_report.md +45 -0
  100. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/.gitmodules +3 -0
  101. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/build.gradle +54 -0
  102. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/checkstyle.xml +156 -0
  103. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/debug.keystore +0 -0
  104. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/gradle/android-publish-private.gradle +207 -0
  105. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/gradle/android-publish.gradle +276 -0
  106. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/gradle/build_library.gradle +62 -0
  107. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/gradle/check.gradle +76 -0
  108. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/gradle/wrapper/gradle-wrapper.jar +0 -0
  109. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/gradle/wrapper/gradle-wrapper.properties +6 -0
  110. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/gradle.properties +25 -0
  111. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/gradlew +172 -0
  112. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/gradlew.bat +84 -0
  113. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/CMakeLists.txt +56 -0
  114. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/build.gradle +238 -0
  115. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/gradle.properties +2 -0
  116. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/proguard-rules.pro +9 -0
  117. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/androidTest/AndroidManifest.xml +11 -0
  118. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/androidTest/java/com/tencent/mmkv/MMKVTest.java +270 -0
  119. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/androidTest/java/com/tencent/mmkv/MMKVTestService.java +79 -0
  120. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/AndroidManifest.xml +3 -0
  121. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/aidl/com/tencent/mmkv/ParcelableMMKV.aidl +4 -0
  122. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/cpp/flutter-bridge.cpp +706 -0
  123. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/cpp/native-bridge.cpp +1244 -0
  124. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/MMKV.java +2024 -0
  125. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/MMKVContentChangeNotification.java +34 -0
  126. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/MMKVContentProvider.java +174 -0
  127. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/MMKVHandler.java +63 -0
  128. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/MMKVLogLevel.java +52 -0
  129. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/MMKVProcessUtil.java +100 -0
  130. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/MMKVRecoverStrategic.java +36 -0
  131. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/NameSpace.java +214 -0
  132. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/NativeBuffer.java +36 -0
  133. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/ParcelableMMKV.java +108 -0
  134. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/UnsupportedArchitectureException.java +27 -0
  135. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvannotation/build.gradle +34 -0
  136. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvannotation/src/main/AndroidManifest.xml +3 -0
  137. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvannotation/src/main/java/dalvik/annotation/optimization/FastNative.java +104 -0
  138. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/build.gradle +116 -0
  139. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/proguard-rules.pro +24 -0
  140. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/AndroidManifest.xml +54 -0
  141. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/aidl/com/tencent/mmkvdemo/IAshmemMMKV.aidl +8 -0
  142. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/cpp/CMakeLists.txt +50 -0
  143. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/cpp/mmkvdemo.cpp +245 -0
  144. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/Baseline.java +297 -0
  145. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/BenchMarkBaseService.java +363 -0
  146. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/FakeInfo.java +67 -0
  147. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/Info.java +69 -0
  148. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/MainActivity.java +1029 -0
  149. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/MultiProcessSharedPreferences.java +710 -0
  150. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/MyApplication.java +130 -0
  151. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/MyService.java +105 -0
  152. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/MyService_1.java +92 -0
  153. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/SQLiteKV.java +143 -0
  154. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/TestParcelable.java +70 -0
  155. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/kotlin/KotlinUsecase.kt +67 -0
  156. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/drawable/ic_launcher_background.xml +170 -0
  157. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/drawable-v24/ic_launcher_foreground.xml +34 -0
  158. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/layout/activity_main.xml +76 -0
  159. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
  160. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
  161. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  162. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  163. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  164. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  165. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  166. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  167. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  168. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  169. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  170. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  171. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/values/colors.xml +6 -0
  172. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/values/strings.xml +3 -0
  173. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/values/styles.xml +11 -0
  174. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/pmd-ruleset.xml +44 -0
  175. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/proguard-rules/proguard-rules-android-lib.pro +54 -0
  176. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/proguard-rules/proguard-rules-test.pro +6 -0
  177. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/settings.gradle +3 -0
  178. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/CHANGELOG.md +979 -0
  179. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/CODE_OF_CONDUCT.md +76 -0
  180. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/CONTRIBUTING.md +61 -0
  181. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/CMakeLists.txt +207 -0
  182. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/CodedInputData.cpp +248 -0
  183. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/CodedInputData.h +86 -0
  184. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/CodedInputDataCrypt.cpp +276 -0
  185. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/CodedInputDataCrypt.h +86 -0
  186. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/CodedInputDataCrypt_OSX.cpp +62 -0
  187. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/CodedInputData_OSX.cpp +92 -0
  188. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/CodedOutputData.cpp +182 -0
  189. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/CodedOutputData.h +86 -0
  190. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/Core.xcodeproj/project.pbxproj +703 -0
  191. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/Core.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  192. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/Core.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  193. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/Core.xcodeproj/xcshareddata/xcschemes/Core.xcscheme +67 -0
  194. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/Core.xcodeproj/xcshareddata/xcschemes/MMKVWatchCore.xcscheme +67 -0
  195. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/InterProcessLock.cpp +211 -0
  196. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/InterProcessLock.h +124 -0
  197. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/InterProcessLock_Android.cpp +104 -0
  198. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/InterProcessLock_Win32.cpp +108 -0
  199. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/KeyValueHolder.cpp +237 -0
  200. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/KeyValueHolder.h +122 -0
  201. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMBuffer.cpp +207 -0
  202. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMBuffer.h +119 -0
  203. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKV.cpp +1791 -0
  204. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKV.h +781 -0
  205. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKVLog.cpp +127 -0
  206. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKVLog.h +86 -0
  207. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKVLog_Android.cpp +134 -0
  208. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKVMetaInfo.hpp +99 -0
  209. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKVPredef.h +310 -0
  210. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKV_Android.cpp +365 -0
  211. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKV_IO.cpp +2049 -0
  212. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKV_IO.h +85 -0
  213. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKV_OSX.cpp +589 -0
  214. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKV_OSX.h +30 -0
  215. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MemoryFile.cpp +716 -0
  216. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MemoryFile.h +212 -0
  217. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MemoryFile_Android.cpp +247 -0
  218. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MemoryFile_Linux.cpp +126 -0
  219. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MemoryFile_OSX.cpp +173 -0
  220. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MemoryFile_Win32.cpp +655 -0
  221. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MiniPBCoder.cpp +668 -0
  222. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MiniPBCoder.h +150 -0
  223. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MiniPBCoder_OSX.cpp +237 -0
  224. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/PBEncodeItem.hpp +102 -0
  225. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/PBUtility.cpp +61 -0
  226. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/PBUtility.h +148 -0
  227. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/ScopedLock.hpp +69 -0
  228. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/ThreadLock.cpp +75 -0
  229. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/ThreadLock.h +81 -0
  230. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/ThreadLock_Win32.cpp +89 -0
  231. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/AESCrypt.cpp +293 -0
  232. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/AESCrypt.h +117 -0
  233. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_aes.h +98 -0
  234. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_aes_core.cpp +1044 -0
  235. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_aes_locl.h +38 -0
  236. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_aesv8-armx.S +308 -0
  237. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_arm_arch.h +84 -0
  238. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_cfb128.cpp +97 -0
  239. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_md32_common.h +254 -0
  240. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_md5.h +49 -0
  241. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_md5_dgst.cpp +166 -0
  242. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_md5_locl.h +75 -0
  243. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_md5_one.cpp +30 -0
  244. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_opensslconf.h +271 -0
  245. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/core.vcxproj +288 -0
  246. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/core.vcxproj.filters +150 -0
  247. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/crc32/CMakeLists.txt +60 -0
  248. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/crc32/Checksum.h +76 -0
  249. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/crc32/crc32_armv8.cpp +134 -0
  250. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/crc32/zlib/crc32.cpp +55 -0
  251. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/crc32/zlib/crc32.h +48 -0
  252. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/crc32/zlib/zconf.h +380 -0
  253. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/crc32/zlib/zutil.h +25 -0
  254. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Dockerfile +25 -0
  255. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/LICENSE.TXT +193 -0
  256. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/MMKV.podspec +40 -0
  257. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/MMKV.xcworkspace/contents.xcworkspacedata +10 -0
  258. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/MMKV.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  259. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/MMKVAppExtension.podspec +37 -0
  260. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/MMKVCore.podspec +47 -0
  261. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/MMKVWatchExtension.podspec +38 -0
  262. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Makefile +10 -0
  263. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/AppScope/app.json5 +10 -0
  264. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/AppScope/resources/base/element/string.json +8 -0
  265. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/AppScope/resources/base/media/app_icon.png +0 -0
  266. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/BuildProfile.ets +17 -0
  267. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/CHANGELOG.md +75 -0
  268. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/Index.ets +4 -0
  269. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/LICENSE +193 -0
  270. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/README.md +208 -0
  271. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/build-profile.json5 +40 -0
  272. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/consumer-rules.txt +61 -0
  273. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/example/Index.ets +686 -0
  274. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/example/Util.ets +31 -0
  275. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/hvigorfile.ts +6 -0
  276. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/obfuscation-rules.txt +18 -0
  277. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/oh-package.json5 +22 -0
  278. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/cpp/CMakeLists.txt +43 -0
  279. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/cpp/flutter-bridge.cpp +703 -0
  280. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/cpp/native_bridge.cpp +1840 -0
  281. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/cpp/types/libmmkv/index.d.ts +80 -0
  282. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/cpp/types/libmmkv/oh-package.json5 +6 -0
  283. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/ets/utils/MMKV.ets +1073 -0
  284. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/ets/utils/MMKVHandler.ets +111 -0
  285. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/ets/utils/MMKVLogLevel.ets +50 -0
  286. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/ets/utils/NativeBuffer.ets +34 -0
  287. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/ets/utils/Util.ts +24 -0
  288. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/module.json5 +12 -0
  289. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/build-profile.json5 +62 -0
  290. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/dependencies/hvigor-4.3.0.tgz +0 -0
  291. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/dependencies/hvigor-ohos-plugin-4.3.0.tgz +0 -0
  292. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/build-profile.json5 +39 -0
  293. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/hvigorfile.ts +6 -0
  294. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/obfuscation-rules.txt +25 -0
  295. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/oh-package.json5 +13 -0
  296. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/cpp/CMakeLists.txt +54 -0
  297. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/cpp/napi_init.cpp +233 -0
  298. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/cpp/types/libentry/index.d.ts +1 -0
  299. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/cpp/types/libentry/oh-package.json5 +6 -0
  300. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/ets/Util/Baseline.ets +188 -0
  301. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/ets/Util/MyMMKVHandler.ets +76 -0
  302. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/ets/Util/Util.ets +220 -0
  303. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/ets/entryability/EntryAbility.ets +107 -0
  304. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/ets/pages/Index.ets +766 -0
  305. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/ets/process/DemoProcess.ets +31 -0
  306. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/module.json5 +38 -0
  307. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/resources/base/element/color.json +8 -0
  308. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/resources/base/element/string.json +16 -0
  309. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/resources/base/media/background.png +0 -0
  310. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/resources/base/media/foreground.png +0 -0
  311. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/resources/base/media/layered_image.json +7 -0
  312. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/resources/base/media/startIcon.png +0 -0
  313. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/resources/base/profile/main_pages.json +5 -0
  314. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/resources/en_US/element/string.json +16 -0
  315. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/resources/zh_CN/element/string.json +16 -0
  316. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/mock/mock-config.json5 +2 -0
  317. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/ohosTest/ets/test/Ability.test.ets +55 -0
  318. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/ohosTest/ets/test/List.test.ets +25 -0
  319. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/ohosTest/ets/testability/TestAbility.ets +67 -0
  320. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/ohosTest/ets/testability/pages/Index.ets +37 -0
  321. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ets +110 -0
  322. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/ohosTest/module.json5 +38 -0
  323. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/ohosTest/resources/base/element/color.json +8 -0
  324. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/ohosTest/resources/base/element/string.json +16 -0
  325. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/ohosTest/resources/base/media/icon.png +0 -0
  326. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/ohosTest/resources/base/profile/test_pages.json +5 -0
  327. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/test/List.test.ets +25 -0
  328. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/test/LocalUnit.test.ets +53 -0
  329. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/hvigor/hvigor-config.json5 +21 -0
  330. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/hvigorfile.ts +6 -0
  331. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/oh-package.json5 +15 -0
  332. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/CMakeLists.txt +27 -0
  333. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/demo/CMakeLists.txt +65 -0
  334. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/demo/TestInterProcessLock.cpp +130 -0
  335. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/demo/UnitTest.cpp +272 -0
  336. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/demo/demo.cpp +1431 -0
  337. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/demo/process.cpp +78 -0
  338. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/golang/CMakeLists.txt +87 -0
  339. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/golang/callback.go +121 -0
  340. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/golang/go.mod +3 -0
  341. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/golang/golang-bridge.cpp +731 -0
  342. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/golang/golang-bridge.h +131 -0
  343. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/golang/mmkv.go +817 -0
  344. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/golang/mmkv_test.go +33 -0
  345. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/golang/test/go.mod +7 -0
  346. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/golang/test/main.go +455 -0
  347. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/src/CMakeLists.txt +83 -0
  348. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/src/libmmkv.cpp +21 -0
  349. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/CMakeLists.txt +62 -0
  350. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/README.md +6 -0
  351. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/demo.py +368 -0
  352. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/libmmkv_python.cpp +454 -0
  353. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.appveyor.yml +35 -0
  354. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.clang-format +38 -0
  355. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.clang-tidy +77 -0
  356. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.cmake-format.yaml +73 -0
  357. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.codespell-ignore-lines +24 -0
  358. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.gitattributes +1 -0
  359. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/CODEOWNERS +9 -0
  360. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/CONTRIBUTING.md +388 -0
  361. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/ISSUE_TEMPLATE/bug-report.yml +61 -0
  362. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/ISSUE_TEMPLATE/config.yml +8 -0
  363. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/dependabot.yml +15 -0
  364. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/labeler.yml +13 -0
  365. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/labeler_merged.yml +8 -0
  366. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/matchers/pylint.json +32 -0
  367. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/pull_request_template.md +19 -0
  368. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/workflows/ci.yml +1233 -0
  369. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/workflows/configure.yml +92 -0
  370. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/workflows/format.yml +60 -0
  371. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/workflows/labeler.yml +25 -0
  372. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/workflows/pip.yml +117 -0
  373. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/workflows/upstream.yml +116 -0
  374. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.pre-commit-config.yaml +156 -0
  375. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.readthedocs.yml +20 -0
  376. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/CMakeLists.txt +375 -0
  377. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/LICENSE +29 -0
  378. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/MANIFEST.in +6 -0
  379. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/README.rst +181 -0
  380. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/SECURITY.md +13 -0
  381. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/Doxyfile +21 -0
  382. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/_static/css/custom.css +3 -0
  383. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/cast/chrono.rst +81 -0
  384. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/cast/custom.rst +93 -0
  385. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/cast/eigen.rst +310 -0
  386. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/cast/functional.rst +109 -0
  387. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/cast/index.rst +43 -0
  388. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/cast/overview.rst +170 -0
  389. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/cast/stl.rst +249 -0
  390. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/cast/strings.rst +296 -0
  391. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/classes.rst +1335 -0
  392. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/embedding.rst +262 -0
  393. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/exceptions.rst +401 -0
  394. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/functions.rst +614 -0
  395. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/misc.rst +429 -0
  396. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/pycpp/index.rst +13 -0
  397. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/pycpp/numpy.rst +453 -0
  398. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/pycpp/object.rst +286 -0
  399. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/pycpp/utilities.rst +155 -0
  400. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/smart_ptrs.rst +174 -0
  401. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/basics.rst +307 -0
  402. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/benchmark.py +89 -0
  403. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/benchmark.rst +95 -0
  404. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/changelog.rst +3121 -0
  405. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/classes.rst +555 -0
  406. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/cmake/index.rst +8 -0
  407. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/compiling.rst +726 -0
  408. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/conf.py +369 -0
  409. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/faq.rst +308 -0
  410. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/index.rst +48 -0
  411. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/installing.rst +105 -0
  412. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/limitations.rst +72 -0
  413. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/pybind11-logo.png +0 -0
  414. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/pybind11_vs_boost_python1.png +0 -0
  415. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/pybind11_vs_boost_python1.svg +427 -0
  416. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/pybind11_vs_boost_python2.png +0 -0
  417. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/pybind11_vs_boost_python2.svg +427 -0
  418. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/reference.rst +130 -0
  419. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/release.rst +143 -0
  420. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/requirements.in +6 -0
  421. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/requirements.txt +275 -0
  422. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/upgrade.rst +594 -0
  423. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/attr.h +690 -0
  424. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/buffer_info.h +208 -0
  425. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/cast.h +1848 -0
  426. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/chrono.h +225 -0
  427. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/common.h +2 -0
  428. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/complex.h +74 -0
  429. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/detail/class.h +754 -0
  430. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/detail/common.h +1268 -0
  431. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/detail/descr.h +172 -0
  432. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/detail/init.h +434 -0
  433. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/detail/internals.h +749 -0
  434. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/detail/type_caster_base.h +1214 -0
  435. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/detail/typeid.h +65 -0
  436. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/eigen/common.h +9 -0
  437. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/eigen/matrix.h +714 -0
  438. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/eigen/tensor.h +517 -0
  439. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/eigen.h +12 -0
  440. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/embed.h +313 -0
  441. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/eval.h +156 -0
  442. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/functional.h +138 -0
  443. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/gil.h +219 -0
  444. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/gil_safe_call_once.h +91 -0
  445. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/iostream.h +265 -0
  446. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/numpy.h +2135 -0
  447. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/operators.h +202 -0
  448. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/options.h +92 -0
  449. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/pybind11.h +3026 -0
  450. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/pytypes.h +2604 -0
  451. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/stl/filesystem.h +115 -0
  452. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/stl.h +448 -0
  453. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/stl_bind.h +822 -0
  454. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/type_caster_pyobject_ptr.h +61 -0
  455. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/typing.h +239 -0
  456. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/noxfile.py +107 -0
  457. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/pybind11/__init__.py +19 -0
  458. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/pybind11/__main__.py +63 -0
  459. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/pybind11/_version.py +12 -0
  460. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/pybind11/commands.py +39 -0
  461. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/pybind11/py.typed +0 -0
  462. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/pybind11/setup_helpers.py +500 -0
  463. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/pyproject.toml +87 -0
  464. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/setup.cfg +43 -0
  465. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/setup.py +149 -0
  466. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/CMakeLists.txt +589 -0
  467. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/conftest.py +224 -0
  468. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/constructor_stats.h +322 -0
  469. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/cross_module_gil_utils.cpp +111 -0
  470. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/cross_module_interleaved_error_already_set.cpp +54 -0
  471. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/eigen_tensor_avoid_stl_array.cpp +16 -0
  472. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/env.py +31 -0
  473. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/extra_python_package/pytest.ini +0 -0
  474. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/extra_python_package/test_files.py +296 -0
  475. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/extra_setuptools/pytest.ini +0 -0
  476. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/extra_setuptools/test_setuphelper.py +153 -0
  477. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/local_bindings.h +92 -0
  478. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/object.h +205 -0
  479. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/pybind11_cross_module_tests.cpp +149 -0
  480. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/pybind11_tests.cpp +131 -0
  481. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/pybind11_tests.h +98 -0
  482. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/pytest.ini +23 -0
  483. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/requirements.txt +13 -0
  484. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_async.cpp +25 -0
  485. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_async.py +26 -0
  486. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_buffers.cpp +259 -0
  487. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_buffers.py +230 -0
  488. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_builtin_casters.cpp +387 -0
  489. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_builtin_casters.py +530 -0
  490. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_call_policies.cpp +113 -0
  491. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_call_policies.py +249 -0
  492. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_callbacks.cpp +280 -0
  493. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_callbacks.py +227 -0
  494. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_chrono.cpp +81 -0
  495. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_chrono.py +207 -0
  496. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_class.cpp +656 -0
  497. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_class.py +503 -0
  498. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_cmake_build/CMakeLists.txt +80 -0
  499. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_cmake_build/embed.cpp +23 -0
  500. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt +28 -0
  501. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt +39 -0
  502. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt +46 -0
  503. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_cmake_build/main.cpp +6 -0
  504. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +47 -0
  505. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +41 -0
  506. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +47 -0
  507. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_cmake_build/test.py +10 -0
  508. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_const_name.cpp +55 -0
  509. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_const_name.py +31 -0
  510. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_constants_and_functions.cpp +158 -0
  511. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_constants_and_functions.py +58 -0
  512. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_copy_move.cpp +544 -0
  513. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_copy_move.py +140 -0
  514. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_custom_type_casters.cpp +217 -0
  515. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_custom_type_casters.py +124 -0
  516. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_custom_type_setup.cpp +41 -0
  517. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_custom_type_setup.py +50 -0
  518. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_docstring_options.cpp +129 -0
  519. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_docstring_options.py +66 -0
  520. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_eigen_matrix.cpp +443 -0
  521. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_eigen_matrix.py +816 -0
  522. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_eigen_tensor.cpp +18 -0
  523. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_eigen_tensor.inl +332 -0
  524. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_eigen_tensor.py +290 -0
  525. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_embed/CMakeLists.txt +54 -0
  526. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_embed/catch.cpp +43 -0
  527. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_embed/external_module.cpp +20 -0
  528. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_embed/test_interpreter.cpp +488 -0
  529. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_embed/test_interpreter.py +16 -0
  530. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_embed/test_trampoline.py +18 -0
  531. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_enum.cpp +133 -0
  532. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_enum.py +270 -0
  533. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_eval.cpp +118 -0
  534. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_eval.py +52 -0
  535. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_eval_call.py +5 -0
  536. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_exceptions.cpp +388 -0
  537. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_exceptions.h +13 -0
  538. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_exceptions.py +434 -0
  539. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_factory_constructors.cpp +430 -0
  540. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_factory_constructors.py +518 -0
  541. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_gil_scoped.cpp +144 -0
  542. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_gil_scoped.py +244 -0
  543. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_iostream.cpp +126 -0
  544. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_iostream.py +293 -0
  545. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_kwargs_and_defaults.cpp +325 -0
  546. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_kwargs_and_defaults.py +428 -0
  547. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_local_bindings.cpp +106 -0
  548. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_local_bindings.py +259 -0
  549. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_methods_and_attributes.cpp +492 -0
  550. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_methods_and_attributes.py +539 -0
  551. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_modules.cpp +125 -0
  552. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_modules.py +118 -0
  553. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_multiple_inheritance.cpp +341 -0
  554. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_multiple_inheritance.py +495 -0
  555. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_numpy_array.cpp +547 -0
  556. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_numpy_array.py +672 -0
  557. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_numpy_dtypes.cpp +639 -0
  558. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_numpy_dtypes.py +448 -0
  559. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_numpy_vectorize.cpp +107 -0
  560. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_numpy_vectorize.py +268 -0
  561. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_opaque_types.cpp +77 -0
  562. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_opaque_types.py +60 -0
  563. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_operator_overloading.cpp +281 -0
  564. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_operator_overloading.py +153 -0
  565. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_pickling.cpp +194 -0
  566. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_pickling.py +95 -0
  567. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_python_multiple_inheritance.cpp +45 -0
  568. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_python_multiple_inheritance.py +36 -0
  569. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_pytypes.cpp +926 -0
  570. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_pytypes.py +1050 -0
  571. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_sequences_and_iterators.cpp +600 -0
  572. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_sequences_and_iterators.py +267 -0
  573. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_smart_ptr.cpp +473 -0
  574. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_smart_ptr.py +317 -0
  575. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_stl.cpp +549 -0
  576. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_stl.py +383 -0
  577. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_stl_binders.cpp +275 -0
  578. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_stl_binders.py +395 -0
  579. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_tagbased_polymorphic.cpp +147 -0
  580. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_tagbased_polymorphic.py +30 -0
  581. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_thread.cpp +66 -0
  582. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_thread.py +44 -0
  583. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_type_caster_pyobject_ptr.cpp +167 -0
  584. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_type_caster_pyobject_ptr.py +122 -0
  585. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_union.cpp +22 -0
  586. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_union.py +10 -0
  587. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_unnamed_namespace_a.cpp +38 -0
  588. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_unnamed_namespace_a.py +36 -0
  589. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_unnamed_namespace_b.cpp +13 -0
  590. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_unnamed_namespace_b.py +7 -0
  591. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_vector_unique_ptr_member.cpp +54 -0
  592. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_vector_unique_ptr_member.py +16 -0
  593. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_virtual_functions.cpp +592 -0
  594. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_virtual_functions.py +460 -0
  595. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/valgrind-numpy-scipy.supp +140 -0
  596. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/valgrind-python.supp +117 -0
  597. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/FindCatch.cmake +76 -0
  598. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/FindEigen3.cmake +86 -0
  599. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/FindPythonLibsNew.cmake +310 -0
  600. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/JoinPaths.cmake +23 -0
  601. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/check-style.sh +44 -0
  602. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/cmake_uninstall.cmake.in +23 -0
  603. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/codespell_ignore_lines_from_errors.py +40 -0
  604. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/libsize.py +38 -0
  605. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/make_changelog.py +92 -0
  606. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/pybind11.pc.in +7 -0
  607. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/pybind11Common.cmake +429 -0
  608. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/pybind11Config.cmake.in +233 -0
  609. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/pybind11GuessPythonExtSuffix.cmake +86 -0
  610. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/pybind11NewTools.cmake +341 -0
  611. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/pybind11Tools.cmake +239 -0
  612. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/pyproject.toml +3 -0
  613. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/setup_global.py.in +63 -0
  614. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/setup_main.py.in +44 -0
  615. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/test-pybind11GuessPythonExtSuffix.cmake +161 -0
  616. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/setup.py +76 -0
  617. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/unit_test.py +209 -0
  618. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/README.md +357 -0
  619. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/README_CN.md +301 -0
  620. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/SECURITY.md +15 -0
  621. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Script/dumpJavaSignature.py +144 -0
  622. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Script/formatCode.py +17 -0
  623. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/.clang-format +35 -0
  624. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32.sln +58 -0
  625. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32Demo/Win32Demo.cpp +548 -0
  626. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32Demo/Win32Demo.vcxproj +190 -0
  627. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32Demo/Win32Demo.vcxproj.filters +30 -0
  628. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32Demo/pch.cpp +23 -0
  629. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32Demo/pch.h +28 -0
  630. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32DemoProcess/Win32DemoProcess.cpp +88 -0
  631. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32DemoProcess/Win32DemoProcess.vcxproj +188 -0
  632. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32DemoProcess/Win32DemoProcess.vcxproj.filters +30 -0
  633. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32DemoProcess/pch.cpp +21 -0
  634. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32DemoProcess/pch.h +24 -0
  635. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/.metadata +10 -0
  636. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/.vscode/launch.json +162 -0
  637. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/.vscode/settings.json +12 -0
  638. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/CHANGELOG.md +196 -0
  639. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/LICENSE +193 -0
  640. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/README.md +217 -0
  641. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/analysis_options.yaml +49 -0
  642. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/README.md +16 -0
  643. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/build.gradle +79 -0
  644. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/src/main/AndroidManifest.xml +41 -0
  645. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/src/main/java/com/tencent/mmkv_example/MainActivity.java +25 -0
  646. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/src/main/res/drawable/launch_background.xml +12 -0
  647. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  648. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  649. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  650. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  651. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  652. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/src/main/res/values/styles.xml +18 -0
  653. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/src/profile/AndroidManifest.xml +7 -0
  654. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/build.gradle +29 -0
  655. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/gradle/wrapper/gradle-wrapper.properties +6 -0
  656. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/gradle.properties +4 -0
  657. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/settings.gradle +25 -0
  658. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/settings_aar.gradle +1 -0
  659. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Flutter/AppFrameworkInfo.plist +26 -0
  660. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Flutter/Debug.xcconfig +2 -0
  661. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Flutter/Release.xcconfig +2 -0
  662. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Flutter/ephemeral/flutter_lldb_helper.py +32 -0
  663. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Flutter/ephemeral/flutter_lldbinit +5 -0
  664. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Podfile +49 -0
  665. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/AppDelegate.h +26 -0
  666. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/AppDelegate.m +33 -0
  667. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +122 -0
  668. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png +0 -0
  669. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png +0 -0
  670. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png +0 -0
  671. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png +0 -0
  672. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png +0 -0
  673. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png +0 -0
  674. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png +0 -0
  675. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png +0 -0
  676. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png +0 -0
  677. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png +0 -0
  678. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png +0 -0
  679. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png +0 -0
  680. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png +0 -0
  681. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png +0 -0
  682. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png +0 -0
  683. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +23 -0
  684. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png +0 -0
  685. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png +0 -0
  686. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png +0 -0
  687. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md +5 -0
  688. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Base.lproj/LaunchScreen.storyboard +37 -0
  689. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Base.lproj/Main.storyboard +29 -0
  690. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Info.plist +49 -0
  691. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Runner.entitlements +10 -0
  692. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/main.m +29 -0
  693. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner.xcodeproj/project.pbxproj +612 -0
  694. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  695. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  696. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
  697. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +90 -0
  698. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner.xcworkspace/contents.xcworkspacedata +10 -0
  699. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  700. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
  701. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/lib/main.dart +565 -0
  702. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/linux/CMakeLists.txt +128 -0
  703. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/linux/flutter/CMakeLists.txt +88 -0
  704. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/linux/flutter/generated_plugin_registrant.cc +15 -0
  705. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/linux/flutter/generated_plugin_registrant.h +15 -0
  706. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/linux/flutter/generated_plugins.cmake +24 -0
  707. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/linux/runner/CMakeLists.txt +26 -0
  708. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/linux/runner/main.cc +6 -0
  709. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/linux/runner/my_application.cc +130 -0
  710. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/linux/runner/my_application.h +18 -0
  711. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Flutter/Flutter-Debug.xcconfig +2 -0
  712. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Flutter/Flutter-Release.xcconfig +2 -0
  713. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Flutter/GeneratedPluginRegistrant.swift +14 -0
  714. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Podfile +47 -0
  715. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/AppDelegate.swift +13 -0
  716. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +68 -0
  717. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png +0 -0
  718. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png +0 -0
  719. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png +0 -0
  720. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png +0 -0
  721. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png +0 -0
  722. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png +0 -0
  723. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png +0 -0
  724. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Base.lproj/MainMenu.xib +343 -0
  725. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Configs/AppInfo.xcconfig +14 -0
  726. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Configs/Debug.xcconfig +2 -0
  727. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Configs/Release.xcconfig +2 -0
  728. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Configs/Warnings.xcconfig +13 -0
  729. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/DebugProfile.entitlements +12 -0
  730. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Info.plist +32 -0
  731. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/MainFlutterWindow.swift +15 -0
  732. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Release.entitlements +8 -0
  733. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner.xcodeproj/project.pbxproj +800 -0
  734. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  735. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +99 -0
  736. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner.xcworkspace/contents.xcworkspacedata +10 -0
  737. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  738. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +5 -0
  739. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/RunnerTests/RunnerTests.swift +12 -0
  740. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/AppScope/app.json5 +10 -0
  741. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/AppScope/resources/base/element/string.json +8 -0
  742. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/AppScope/resources/base/media/app_icon.png +0 -0
  743. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/build-profile.json5 +41 -0
  744. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/build-profile.json5 +34 -0
  745. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/hvigorfile.ts +17 -0
  746. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/oh-package.json5 +13 -0
  747. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets +36 -0
  748. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/main/ets/pages/Index.ets +38 -0
  749. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets +28 -0
  750. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/main/module.json5 +53 -0
  751. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/main/resources/base/element/color.json +8 -0
  752. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/main/resources/base/element/string.json +16 -0
  753. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/main/resources/base/media/icon.png +0 -0
  754. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/main/resources/base/profile/main_pages.json +5 -0
  755. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/main/resources/en_US/element/string.json +16 -0
  756. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/main/resources/zh_CN/element/string.json +16 -0
  757. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/ohosTest/ets/test/Ability.test.ets +50 -0
  758. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/ohosTest/ets/test/List.test.ets +20 -0
  759. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets +63 -0
  760. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets +49 -0
  761. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts +64 -0
  762. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/ohosTest/module.json5 +51 -0
  763. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/ohosTest/resources/base/element/color.json +8 -0
  764. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/ohosTest/resources/base/element/string.json +16 -0
  765. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/ohosTest/resources/base/media/icon.png +0 -0
  766. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json +5 -0
  767. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/hvigor/hvigor-config.json5 +20 -0
  768. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/hvigorfile.ts +21 -0
  769. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/oh-package.json5 +21 -0
  770. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/pubspec.yaml +75 -0
  771. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/CMakeLists.txt +108 -0
  772. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/flutter/CMakeLists.txt +109 -0
  773. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/flutter/generated_plugin_registrant.cc +14 -0
  774. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/flutter/generated_plugin_registrant.h +15 -0
  775. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/flutter/generated_plugins.cmake +24 -0
  776. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/CMakeLists.txt +40 -0
  777. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/Runner.rc +121 -0
  778. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/flutter_window.cpp +71 -0
  779. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/flutter_window.h +33 -0
  780. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/main.cpp +43 -0
  781. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/resource.h +16 -0
  782. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/resources/app_icon.ico +0 -0
  783. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/runner.exe.manifest +14 -0
  784. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/utils.cpp +65 -0
  785. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/utils.h +19 -0
  786. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/win32_window.cpp +288 -0
  787. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/win32_window.h +102 -0
  788. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/lib/mmkv.dart +1052 -0
  789. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/mmkv.iml +17 -0
  790. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/pubspec.yaml +62 -0
  791. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/test/mmkv_test.dart +48 -0
  792. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/tool/fix_mmkv_plugin_name.rb +4 -0
  793. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/tool/mmkvpodhelper.rb +23 -0
  794. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv.iml +25 -0
  795. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/CHANGELOG.md +48 -0
  796. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/LICENSE +193 -0
  797. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/README.md +17 -0
  798. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/android/build.gradle +39 -0
  799. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  800. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  801. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/android/gradle.properties +4 -0
  802. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/android/gradlew +160 -0
  803. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/android/gradlew.bat +90 -0
  804. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/android/settings.gradle +1 -0
  805. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/android/src/main/AndroidManifest.xml +1 -0
  806. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/android/src/main/java/com/tencent/mmkv/MMKVPlugin.java +82 -0
  807. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/lib/mmkv_android.dart +76 -0
  808. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/pubspec.yaml +40 -0
  809. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/.metadata +33 -0
  810. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/CHANGELOG.md +52 -0
  811. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/LICENSE +193 -0
  812. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/README.md +17 -0
  813. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/darwin/Classes/MMKVPlugin.h +28 -0
  814. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/darwin/Classes/MMKVPlugin.mm +39 -0
  815. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/darwin/Classes/flutter-bridge.h +32 -0
  816. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/darwin/Classes/flutter-bridge.mm +693 -0
  817. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/darwin/mmkv_ios.podspec +35 -0
  818. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/lib/mmkv_ios.dart +78 -0
  819. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/pubspec.yaml +44 -0
  820. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/.metadata +30 -0
  821. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/CHANGELOG.md +9 -0
  822. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/LICENSE +193 -0
  823. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/README.md +17 -0
  824. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/analysis_options.yaml +4 -0
  825. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/lib/mmkv_linux.dart +69 -0
  826. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/linux/CMakeLists.txt +63 -0
  827. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/linux/flutter-bridge.cpp +694 -0
  828. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/linux/include/mmkv_linux/mmkv_linux_plugin.h +46 -0
  829. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/linux/mmkv_linux_plugin.cc +97 -0
  830. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/pubspec.yaml +47 -0
  831. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/.metadata +30 -0
  832. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/CHANGELOG.md +42 -0
  833. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/LICENSE +193 -0
  834. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/README.md +17 -0
  835. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/analysis_options.yaml +4 -0
  836. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/lib/mmkv_ohos.dart +84 -0
  837. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/ohos/build-profile.json5 +10 -0
  838. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/ohos/hvigorfile.ts +2 -0
  839. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/ohos/index.ets +17 -0
  840. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/ohos/oh-package.json5 +15 -0
  841. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/ohos/src/main/ets/components/plugin/MMKVPlugin.ets +78 -0
  842. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/ohos/src/main/module.json5 +10 -0
  843. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/pubspec.yaml +50 -0
  844. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_platform_interface/CHANGELOG.md +38 -0
  845. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_platform_interface/LICENSE +193 -0
  846. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_platform_interface/README.md +30 -0
  847. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_platform_interface/lib/mmkv_platform_ffi.dart +363 -0
  848. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_platform_interface/lib/mmkv_platform_interface.dart +363 -0
  849. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_platform_interface/pubspec.yaml +23 -0
  850. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/.metadata +30 -0
  851. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/CHANGELOG.md +9 -0
  852. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/LICENSE +193 -0
  853. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/README.md +17 -0
  854. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/analysis_options.yaml +4 -0
  855. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/lib/mmkv_win32.dart +69 -0
  856. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/pubspec.yaml +47 -0
  857. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/windows/CMakeLists.txt +71 -0
  858. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/windows/flutter-bridge.cpp +721 -0
  859. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/windows/include/mmkv_win32/mmkv_win32_plugin.h +43 -0
  860. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/windows/mmkv_win32_plugin.cpp +88 -0
  861. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV/AutoCleanInfo.hpp +65 -0
  862. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV/MMKV.h +552 -0
  863. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV/MMKVHandler.h +60 -0
  864. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV/Resources/Info.plist +24 -0
  865. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV/libMMKV.mm +1361 -0
  866. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV.xcodeproj/project.pbxproj +967 -0
  867. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  868. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  869. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV.xcodeproj/xcshareddata/xcschemes/MMKV For App Extension.xcscheme +67 -0
  870. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV.xcodeproj/xcshareddata/xcschemes/MMKV Static.xcscheme +76 -0
  871. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV.xcodeproj/xcshareddata/xcschemes/MMKV.xcscheme +76 -0
  872. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV.xcodeproj/xcshareddata/xcschemes/MMKVWatchExtension.xcscheme +67 -0
  873. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/Config.xcconfig +10 -0
  874. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/AppDelegate.h +15 -0
  875. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/AppDelegate.m +43 -0
  876. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
  877. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/Assets.xcassets/AppIcon.appiconset/Contents.json +13 -0
  878. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/Assets.xcassets/Contents.json +6 -0
  879. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/Base.lproj/LaunchScreen.storyboard +25 -0
  880. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/Base.lproj/Main.storyboard +42 -0
  881. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/Info.plist +25 -0
  882. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/MMKVCatalystDemo.entitlements +12 -0
  883. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/SceneDelegate.h +16 -0
  884. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/SceneDelegate.m +58 -0
  885. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/ViewController.h +15 -0
  886. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/ViewController.mm +85 -0
  887. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/main.m +19 -0
  888. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/AppDelegate.h +27 -0
  889. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/AppDelegate.m +135 -0
  890. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/DemoSwiftUsage.swift +82 -0
  891. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/MMKVDemo-Bridging-Header.h +22 -0
  892. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json +98 -0
  893. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/Resources/Base.lproj/LaunchScreen.storyboard +25 -0
  894. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/Resources/Base.lproj/Main.storyboard +48 -0
  895. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/Resources/Info.plist +49 -0
  896. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/Resources/MMKVDemo.entitlements +10 -0
  897. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/Resources/testReadOnly +0 -0
  898. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/Resources/testReadOnly.crc +0 -0
  899. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/TestMMKVCpp.cpp +204 -0
  900. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/TestMMKVCpp.hpp +18 -0
  901. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/ViewController+TestCaseBad.h +39 -0
  902. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/ViewController+TestCaseBad.mm +200 -0
  903. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/ViewController.h +32 -0
  904. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/ViewController.mm +1245 -0
  905. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/main.m +28 -0
  906. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo.xcodeproj/project.pbxproj +1944 -0
  907. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  908. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  909. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
  910. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo.xcodeproj/xcshareddata/xcschemes/MMKVDemo.xcscheme +88 -0
  911. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo.xcodeproj/xcshareddata/xcschemes/MMKVMacDemo.xcscheme +78 -0
  912. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo.xcodeproj/xcshareddata/xcschemes/MMKVTodayExtensionDemo.xcscheme +116 -0
  913. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo.xcodeproj/xcshareddata/xcschemes/WatchApp (Notification).xcscheme +106 -0
  914. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo.xcodeproj/xcshareddata/xcschemes/WatchApp.xcscheme +102 -0
  915. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo.xcodeproj/xcshareddata/xcschemes/kvdemo.xcscheme +78 -0
  916. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemoTests/Info.plist +22 -0
  917. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemoTests/MMKVDemoTests.mm +554 -0
  918. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemoTests/MMKVPerformanceTest.mm +118 -0
  919. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVMacDemo/AppDelegate.h +13 -0
  920. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVMacDemo/AppDelegate.m +27 -0
  921. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVMacDemo/Assets.xcassets/AppIcon.appiconset/Contents.json +58 -0
  922. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVMacDemo/Assets.xcassets/Contents.json +6 -0
  923. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVMacDemo/Base.lproj/Main.storyboard +718 -0
  924. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVMacDemo/Info.plist +32 -0
  925. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVMacDemo/MMKVMacDemo.entitlements +10 -0
  926. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVMacDemo/ViewController.h +13 -0
  927. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVMacDemo/ViewController.mm +352 -0
  928. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVMacDemo/main.m +15 -0
  929. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVTodayExtensionDemo/Base.lproj/MainInterface.storyboard +45 -0
  930. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVTodayExtensionDemo/Info.plist +31 -0
  931. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVTodayExtensionDemo/MMKVTodayExtensionDemo.entitlements +10 -0
  932. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVTodayExtensionDemo/TodayViewController.h +25 -0
  933. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVTodayExtensionDemo/TodayViewController.m +106 -0
  934. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Content.imageset/Contents.json +12 -0
  935. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Contents.json +6 -0
  936. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/Assets.xcassets/AppIcon.solidimagestack/Contents.json +17 -0
  937. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Content.imageset/Contents.json +12 -0
  938. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Contents.json +6 -0
  939. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/Assets.xcassets/AppIcon.solidimagestack/Middle.solidimagestacklayer/Content.imageset/Contents.json +12 -0
  940. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/Assets.xcassets/AppIcon.solidimagestack/Middle.solidimagestacklayer/Contents.json +6 -0
  941. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/Assets.xcassets/Contents.json +6 -0
  942. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/ContentView.swift +71 -0
  943. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/Info.plist +15 -0
  944. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/MMKVVisionDemoApp.swift +22 -0
  945. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/Preview Content/Preview Assets.xcassets/Contents.json +6 -0
  946. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp/Assets.xcassets/AppIcon.appiconset/Contents.json +81 -0
  947. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp/Assets.xcassets/Contents.json +6 -0
  948. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp/Base.lproj/Interface.storyboard +47 -0
  949. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp/Info.plist +33 -0
  950. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json +28 -0
  951. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Assets.xcassets/Complication.complicationset/Contents.json +48 -0
  952. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json +28 -0
  953. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json +28 -0
  954. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json +28 -0
  955. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json +28 -0
  956. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json +28 -0
  957. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json +28 -0
  958. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json +28 -0
  959. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Assets.xcassets/Contents.json +6 -0
  960. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/ExtensionDelegate.h +25 -0
  961. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/ExtensionDelegate.mm +135 -0
  962. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Info.plist +36 -0
  963. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/InterfaceController.h +26 -0
  964. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/InterfaceController.m +50 -0
  965. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/NotificationController.h +26 -0
  966. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/NotificationController.m +60 -0
  967. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/PushNotificationPayload.apns +20 -0
  968. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/AppDelegate.h +15 -0
  969. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/AppDelegate.m +49 -0
  970. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
  971. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/Assets.xcassets/AppIcon.appiconset/Contents.json +13 -0
  972. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/Assets.xcassets/Contents.json +6 -0
  973. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/Base.lproj/LaunchScreen.storyboard +25 -0
  974. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/Base.lproj/Main.storyboard +45 -0
  975. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/Info.plist +25 -0
  976. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/SceneDelegate.h +16 -0
  977. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/SceneDelegate.m +58 -0
  978. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/ViewController.h +15 -0
  979. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/ViewController.m +38 -0
  980. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/kvdemo.entitlements +10 -0
  981. package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/main.m +19 -0
  982. package/harmony/reactNativeMMKV/src/main/cpp/MMKVManagedBuffer.h +49 -0
  983. package/harmony/reactNativeMMKV/src/main/cpp/MmkvCxx.cpp +152 -0
  984. package/harmony/reactNativeMMKV/src/main/cpp/MmkvCxx.h +36 -0
  985. package/harmony/reactNativeMMKV/src/main/cpp/MmkvHostObject.cpp +357 -0
  986. package/harmony/reactNativeMMKV/src/main/cpp/MmkvHostObject.h +66 -0
  987. package/harmony/reactNativeMMKV/src/main/cpp/MmkvLogger.h +52 -0
  988. package/harmony/reactNativeMMKV/src/main/cpp/MmkvPlatformContext.cpp +37 -0
  989. package/harmony/reactNativeMMKV/src/main/cpp/MmkvPlatformContext.h +36 -0
  990. package/harmony/reactNativeMMKV/src/main/cpp/NativeMMKVComponentDescriptor.h +65 -0
  991. package/harmony/reactNativeMMKV/src/main/cpp/NativeMMKVJSIBinder.h +55 -0
  992. package/harmony/reactNativeMMKV/src/main/cpp/NativeMMKVPackage.h +67 -0
  993. package/harmony/reactNativeMMKV/src/main/cpp/Props.cpp +37 -0
  994. package/harmony/reactNativeMMKV/src/main/cpp/Props.h +42 -0
  995. package/harmony/reactNativeMMKV/src/main/cpp/ShadowNodes.cpp +39 -0
  996. package/harmony/reactNativeMMKV/src/main/cpp/ShadowNodes.h +41 -0
  997. package/harmony/reactNativeMMKV/src/main/cpp/States.cpp +40 -0
  998. package/harmony/reactNativeMMKV/src/main/cpp/States.h +45 -0
  999. package/harmony/reactNativeMMKV/src/main/ets/Logger.ts +65 -0
  1000. package/harmony/reactNativeMMKV/src/main/ets/MmkvCxxPackage.ts +46 -0
  1001. package/harmony/reactNativeMMKV/src/main/ets/MmkvCxxTurboModule.ts +60 -0
  1002. package/harmony/reactNativeMMKV/src/main/ets/MmkvPlatformContextPackage.ts +46 -0
  1003. package/harmony/reactNativeMMKV/src/main/ets/MmkvPlatformContextTurboModule.ts +48 -0
  1004. package/harmony/reactNativeMMKV/src/main/module.json5 +7 -0
  1005. package/harmony/reactNativeMMKV/src/main/resources/base/element/string.json +8 -0
  1006. package/harmony/reactNativeMMKV/src/main/resources/en_US/element/string.json +8 -0
  1007. package/harmony/reactNativeMMKV/src/main/resources/zh_CN/element/string.json +8 -0
  1008. package/harmony/reactNativeMMKV/ts.ts +27 -0
  1009. package/harmony/reactNativeMMKV.har +0 -0
  1010. package/lib/commonjs/MMKV.js +124 -0
  1011. package/lib/commonjs/MMKV.js.map +1 -0
  1012. package/lib/commonjs/MemoryWarningListener.js +31 -0
  1013. package/lib/commonjs/MemoryWarningListener.js.map +1 -0
  1014. package/lib/commonjs/MemoryWarningListener.web.js +11 -0
  1015. package/lib/commonjs/MemoryWarningListener.web.js.map +1 -0
  1016. package/lib/commonjs/ModuleNotFoundError.js +75 -0
  1017. package/lib/commonjs/ModuleNotFoundError.js.map +1 -0
  1018. package/lib/commonjs/NativeMmkv.js +53 -0
  1019. package/lib/commonjs/NativeMmkv.js.map +1 -0
  1020. package/lib/commonjs/NativeMmkvPlatformContext.js +22 -0
  1021. package/lib/commonjs/NativeMmkvPlatformContext.js.map +1 -0
  1022. package/lib/commonjs/PlatformChecker.js +14 -0
  1023. package/lib/commonjs/PlatformChecker.js.map +1 -0
  1024. package/lib/commonjs/Types.js +32 -0
  1025. package/lib/commonjs/Types.js.map +1 -0
  1026. package/lib/commonjs/createMMKV.js +43 -0
  1027. package/lib/commonjs/createMMKV.js.map +1 -0
  1028. package/lib/commonjs/createMMKV.mock.js +43 -0
  1029. package/lib/commonjs/createMMKV.mock.js.map +1 -0
  1030. package/lib/commonjs/createMMKV.web.js +110 -0
  1031. package/lib/commonjs/createMMKV.web.js.map +1 -0
  1032. package/lib/commonjs/createTextEncoder.js +23 -0
  1033. package/lib/commonjs/createTextEncoder.js.map +1 -0
  1034. package/lib/commonjs/hooks.js +198 -0
  1035. package/lib/commonjs/hooks.js.map +1 -0
  1036. package/lib/commonjs/index.js +40 -0
  1037. package/lib/commonjs/index.js.map +1 -0
  1038. package/lib/commonjs/package.json +1 -0
  1039. package/lib/module/MMKV.js +119 -0
  1040. package/lib/module/MMKV.js.map +1 -0
  1041. package/lib/module/MemoryWarningListener.js +27 -0
  1042. package/lib/module/MemoryWarningListener.js.map +1 -0
  1043. package/lib/module/MemoryWarningListener.web.js +6 -0
  1044. package/lib/module/MemoryWarningListener.web.js.map +1 -0
  1045. package/lib/module/ModuleNotFoundError.js +70 -0
  1046. package/lib/module/ModuleNotFoundError.js.map +1 -0
  1047. package/lib/module/NativeMmkv.js +51 -0
  1048. package/lib/module/NativeMmkv.js.map +1 -0
  1049. package/lib/module/NativeMmkvPlatformContext.js +18 -0
  1050. package/lib/module/NativeMmkvPlatformContext.js.map +1 -0
  1051. package/lib/module/PlatformChecker.js +10 -0
  1052. package/lib/module/PlatformChecker.js.map +1 -0
  1053. package/lib/module/Types.js +31 -0
  1054. package/lib/module/Types.js.map +1 -0
  1055. package/lib/module/createMMKV.js +38 -0
  1056. package/lib/module/createMMKV.js.map +1 -0
  1057. package/lib/module/createMMKV.mock.js +38 -0
  1058. package/lib/module/createMMKV.mock.js.map +1 -0
  1059. package/lib/module/createMMKV.web.js +105 -0
  1060. package/lib/module/createMMKV.web.js.map +1 -0
  1061. package/lib/module/createTextEncoder.js +19 -0
  1062. package/lib/module/createTextEncoder.js.map +1 -0
  1063. package/lib/module/hooks.js +189 -0
  1064. package/lib/module/hooks.js.map +1 -0
  1065. package/lib/module/index.js +6 -0
  1066. package/lib/module/index.js.map +1 -0
  1067. package/lib/typescript/src/MMKV.d.ts +34 -0
  1068. package/lib/typescript/src/MMKV.d.ts.map +1 -0
  1069. package/lib/typescript/src/MemoryWarningListener.d.ts +3 -0
  1070. package/lib/typescript/src/MemoryWarningListener.d.ts.map +1 -0
  1071. package/lib/typescript/src/MemoryWarningListener.web.d.ts +3 -0
  1072. package/lib/typescript/src/MemoryWarningListener.web.d.ts.map +1 -0
  1073. package/lib/typescript/src/ModuleNotFoundError.d.ts +7 -0
  1074. package/lib/typescript/src/ModuleNotFoundError.d.ts.map +1 -0
  1075. package/lib/typescript/src/NativeMmkv.d.ts +91 -0
  1076. package/lib/typescript/src/NativeMmkv.d.ts.map +1 -0
  1077. package/lib/typescript/src/NativeMmkvPlatformContext.d.ts +20 -0
  1078. package/lib/typescript/src/NativeMmkvPlatformContext.d.ts.map +1 -0
  1079. package/lib/typescript/src/PlatformChecker.d.ts +2 -0
  1080. package/lib/typescript/src/PlatformChecker.d.ts.map +1 -0
  1081. package/lib/typescript/src/Types.d.ts +172 -0
  1082. package/lib/typescript/src/Types.d.ts.map +1 -0
  1083. package/lib/typescript/src/__tests__/hooks.test.d.ts +2 -0
  1084. package/lib/typescript/src/__tests__/hooks.test.d.ts.map +1 -0
  1085. package/lib/typescript/src/createMMKV.d.ts +3 -0
  1086. package/lib/typescript/src/createMMKV.d.ts.map +1 -0
  1087. package/lib/typescript/src/createMMKV.mock.d.ts +3 -0
  1088. package/lib/typescript/src/createMMKV.mock.d.ts.map +1 -0
  1089. package/lib/typescript/src/createMMKV.web.d.ts +3 -0
  1090. package/lib/typescript/src/createMMKV.web.d.ts.map +1 -0
  1091. package/lib/typescript/src/createTextEncoder.d.ts +2 -0
  1092. package/lib/typescript/src/createTextEncoder.d.ts.map +1 -0
  1093. package/lib/typescript/src/hooks.d.ts +86 -0
  1094. package/lib/typescript/src/hooks.d.ts.map +1 -0
  1095. package/lib/typescript/src/index.d.ts +4 -0
  1096. package/lib/typescript/src/index.d.ts.map +1 -0
  1097. package/package.json +187 -0
  1098. package/react-native-mmkv.podspec +38 -0
  1099. package/react-native.config.js +20 -0
  1100. package/src/MMKV.ts +142 -0
  1101. package/src/MemoryWarningListener.ts +29 -0
  1102. package/src/MemoryWarningListener.web.ts +5 -0
  1103. package/src/ModuleNotFoundError.ts +95 -0
  1104. package/src/NativeMmkv.ts +118 -0
  1105. package/src/NativeMmkvPlatformContext.ts +38 -0
  1106. package/src/PlatformChecker.ts +9 -0
  1107. package/src/Types.ts +178 -0
  1108. package/src/__tests__/hooks.test.tsx +89 -0
  1109. package/src/createMMKV.mock.ts +38 -0
  1110. package/src/createMMKV.ts +42 -0
  1111. package/src/createMMKV.web.ts +127 -0
  1112. package/src/createTextEncoder.ts +16 -0
  1113. package/src/hooks.ts +247 -0
  1114. package/src/index.ts +4 -0
@@ -0,0 +1,1905 @@
1
+ /*
2
+ * Tencent is pleased to support the open source community by making
3
+ * MMKV available.
4
+ *
5
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company.
6
+ * All rights reserved.
7
+ *
8
+ * Licensed under the BSD 3-Clause License (the "License"); you may not use
9
+ * this file except in compliance with the License. You may obtain a copy of
10
+ * the License at
11
+ *
12
+ * https://opensource.org/licenses/BSD-3-Clause
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */
20
+
21
+ #include "MMKV_IO.h"
22
+ #include "CodedInputData.h"
23
+ #include "CodedOutputData.h"
24
+ #include "InterProcessLock.h"
25
+ #include "MMBuffer.h"
26
+ #include "MMKVLog.h"
27
+ #include "MMKVMetaInfo.hpp"
28
+ #include "MemoryFile.h"
29
+ #include "MiniPBCoder.h"
30
+ #include "PBUtility.h"
31
+ #include "ScopedLock.hpp"
32
+ #include "ThreadLock.h"
33
+ #include "aes/AESCrypt.h"
34
+ #include "aes/openssl/openssl_aes.h"
35
+ #include "aes/openssl/openssl_md5.h"
36
+ #include "crc32/Checksum.h"
37
+ #include <algorithm>
38
+ #include <cassert>
39
+ #include <cstring>
40
+ #include <ctime>
41
+
42
+ #ifdef MMKV_IOS
43
+ # include "MMKV_OSX.h"
44
+ #endif
45
+
46
+ #ifdef MMKV_APPLE
47
+ # if __has_feature(objc_arc)
48
+ # error This file must be compiled with MRC. Use -fno-objc-arc flag.
49
+ # endif
50
+ #endif // MMKV_APPLE
51
+
52
+ #ifndef MMKV_WIN32
53
+ # include <unistd.h>
54
+ #endif
55
+
56
+ using namespace std;
57
+ using namespace mmkv;
58
+ using KVHolderRet_t = std::pair<bool, KeyValueHolder>;
59
+ extern ThreadLock *g_instanceLock;
60
+ extern unordered_map<string, MMKV *> *g_instanceDic;
61
+
62
+ MMKV_NAMESPACE_BEGIN
63
+
64
+ void MMKV::loadFromFile() {
65
+ loadMetaInfoAndCheck();
66
+ #ifndef MMKV_DISABLE_CRYPT
67
+ if (m_crypter) {
68
+ if (m_metaInfo->m_version >= MMKVVersionRandomIV) {
69
+ m_crypter->resetIV(m_metaInfo->m_vector, sizeof(m_metaInfo->m_vector));
70
+ }
71
+ }
72
+ #endif
73
+ if (!m_file->isFileValid()) {
74
+ m_file->reloadFromFile(m_expectedCapacity);
75
+ }
76
+ if (!m_file->isFileValid()) {
77
+ MMKVError("file [%s] not valid", m_path.c_str());
78
+ } else {
79
+ // error checking
80
+ bool loadFromFile = false, needFullWriteback = false;
81
+ checkDataValid(loadFromFile, needFullWriteback);
82
+ MMKVInfo("loading [%s] with %zu actual size, file size %zu, InterProcess %d, meta info "
83
+ "version:%u",
84
+ m_mmapID.c_str(), m_actualSize, m_file->getFileSize(), isMultiProcess(), m_metaInfo->m_version);
85
+ auto ptr = (uint8_t *) m_file->getMemory();
86
+ // loading
87
+ if (loadFromFile && m_actualSize > 0) {
88
+ MMKVInfo("loading [%s] with crc %u sequence %u version %u", m_mmapID.c_str(), m_metaInfo->m_crcDigest,
89
+ m_metaInfo->m_sequence, m_metaInfo->m_version);
90
+ MMBuffer inputBuffer(ptr + Fixed32Size, m_actualSize, MMBufferNoCopy);
91
+ if (m_crypter) {
92
+ clearDictionary(m_dicCrypt);
93
+ } else {
94
+ clearDictionary(m_dic);
95
+ }
96
+ if (needFullWriteback) {
97
+ #ifndef MMKV_DISABLE_CRYPT
98
+ if (m_crypter) {
99
+ MiniPBCoder::greedyDecodeMap(*m_dicCrypt, inputBuffer, m_crypter);
100
+ } else
101
+ #endif
102
+ {
103
+ MiniPBCoder::greedyDecodeMap(*m_dic, inputBuffer);
104
+ }
105
+ } else {
106
+ #ifndef MMKV_DISABLE_CRYPT
107
+ if (m_crypter) {
108
+ MiniPBCoder::decodeMap(*m_dicCrypt, inputBuffer, m_crypter);
109
+ } else
110
+ #endif
111
+ {
112
+ MiniPBCoder::decodeMap(*m_dic, inputBuffer);
113
+ }
114
+ }
115
+ m_output = new CodedOutputData(ptr + Fixed32Size, m_file->getFileSize() - Fixed32Size);
116
+ m_output->seek(m_actualSize);
117
+ if (needFullWriteback) {
118
+ fullWriteback();
119
+ }
120
+ } else {
121
+ // file not valid or empty, discard everything
122
+ SCOPED_LOCK(m_exclusiveProcessLock);
123
+
124
+ m_output = new CodedOutputData(ptr + Fixed32Size, m_file->getFileSize() - Fixed32Size);
125
+ if (m_actualSize > 0) {
126
+ writeActualSize(0, 0, nullptr, IncreaseSequence);
127
+ sync(MMKV_SYNC);
128
+ } else {
129
+ writeActualSize(0, 0, nullptr, KeepSequence);
130
+ }
131
+ }
132
+ auto count = m_crypter ? m_dicCrypt->size() : m_dic->size();
133
+ MMKVInfo("loaded [%s] with %zu key-values", m_mmapID.c_str(), count);
134
+ // auto keys = allKeys();
135
+ // for (size_t index = 0; index < count; index++) {
136
+ // MMKVInfo("key[%llu]: %s", index, keys[index].c_str());
137
+ // }
138
+ }
139
+
140
+ m_needLoadFromFile = false;
141
+ }
142
+
143
+ // read from last m_position
144
+ void MMKV::partialLoadFromFile() {
145
+ if (!m_file->isFileValid()) {
146
+ return;
147
+ }
148
+ m_metaInfo->read(m_metaFile->getMemory());
149
+
150
+ size_t oldActualSize = m_actualSize;
151
+ m_actualSize = readActualSize();
152
+ auto fileSize = m_file->getFileSize();
153
+ MMKVDebug("loading [%s] with file size %zu, oldActualSize %zu, newActualSize %zu", m_mmapID.c_str(), fileSize,
154
+ oldActualSize, m_actualSize);
155
+
156
+ if (m_actualSize > 0) {
157
+ if (m_actualSize < fileSize && m_actualSize + Fixed32Size <= fileSize) {
158
+ if (m_actualSize > oldActualSize) {
159
+ auto position = oldActualSize;
160
+ size_t addedSize = m_actualSize - position;
161
+ auto basePtr = (uint8_t *) m_file->getMemory() + Fixed32Size;
162
+ // incremental update crc digest
163
+ m_crcDigest = (uint32_t) CRC32(m_crcDigest, basePtr + position, (z_size_t) addedSize);
164
+ if (m_crcDigest == m_metaInfo->m_crcDigest) {
165
+ MMBuffer inputBuffer(basePtr, m_actualSize, MMBufferNoCopy);
166
+ #ifndef MMKV_DISABLE_CRYPT
167
+ if (m_crypter) {
168
+ MiniPBCoder::greedyDecodeMap(*m_dicCrypt, inputBuffer, m_crypter, position);
169
+ } else
170
+ #endif
171
+ {
172
+ MiniPBCoder::greedyDecodeMap(*m_dic, inputBuffer, position);
173
+ }
174
+ m_output->seek(addedSize);
175
+ m_hasFullWriteback = false;
176
+
177
+ [[maybe_unused]] auto count = m_crypter ? m_dicCrypt->size() : m_dic->size();
178
+ MMKVDebug("partial loaded [%s] with %zu values", m_mmapID.c_str(), count);
179
+ return;
180
+ } else {
181
+ MMKVError("m_crcDigest[%u] != m_metaInfo->m_crcDigest[%u]", m_crcDigest, m_metaInfo->m_crcDigest);
182
+ }
183
+ }
184
+ }
185
+ }
186
+ // something is wrong, do a full load
187
+ clearMemoryCache();
188
+ loadFromFile();
189
+ }
190
+
191
+ void MMKV::loadMetaInfoAndCheck() {
192
+ if (!m_metaFile->isFileValid()) {
193
+ m_metaFile->reloadFromFile();
194
+ }
195
+ if (!m_metaFile->isFileValid()) {
196
+ MMKVError("file [%s] not valid", m_metaFile->getPath().c_str());
197
+ return;
198
+ }
199
+
200
+ m_metaInfo->read(m_metaFile->getMemory());
201
+ // the meta file is in specious status
202
+ if (m_metaInfo->m_version >= MMKVVersionHolder) {
203
+ MMKVWarning("meta file [%s] in specious state, version %u, flags 0x%llx", m_mmapID.c_str(),
204
+ m_metaInfo->m_version, m_metaInfo->m_flags);
205
+
206
+ // MMKVVersionActualSize is the last version we don't check meta file
207
+ m_metaInfo->m_version = MMKVVersionActualSize;
208
+ m_metaInfo->m_flags = 0;
209
+ m_metaInfo->write(m_metaFile->getMemory());
210
+ }
211
+
212
+ if (m_metaInfo->m_version >= MMKVVersionFlag) {
213
+ m_enableKeyExpire = m_metaInfo->hasFlag(MMKVMetaInfo::EnableKeyExipre);
214
+ if (m_enableKeyExpire && m_enableCompareBeforeSet) {
215
+ MMKVError("enableCompareBeforeSet will be invalid when Expiration is on");
216
+ m_enableCompareBeforeSet = false;
217
+ }
218
+ MMKVInfo("meta file [%s] has flag [%llu]", m_mmapID.c_str(), m_metaInfo->m_flags);
219
+ } else {
220
+ if (m_metaInfo->m_flags != 0) {
221
+ m_metaInfo->m_flags = 0;
222
+ m_metaInfo->write(m_metaFile->getMemory());
223
+ }
224
+ }
225
+ }
226
+
227
+ void MMKV::checkDataValid(bool &loadFromFile, bool &needFullWriteback) {
228
+ // try auto recover from last confirmed location
229
+ auto fileSize = m_file->getFileSize();
230
+ auto checkLastConfirmedInfo = [&] {
231
+ if (m_metaInfo->m_version >= MMKVVersionActualSize) {
232
+ // downgrade & upgrade support
233
+ uint32_t oldStyleActualSize = 0;
234
+ memcpy(&oldStyleActualSize, m_file->getMemory(), Fixed32Size);
235
+ if (oldStyleActualSize != m_actualSize) {
236
+ MMKVWarning("oldStyleActualSize %u not equal to meta actual size %lu", oldStyleActualSize,
237
+ m_actualSize);
238
+ if (oldStyleActualSize < fileSize && (oldStyleActualSize + Fixed32Size) <= fileSize) {
239
+ if (checkFileCRCValid(oldStyleActualSize, m_metaInfo->m_crcDigest)) {
240
+ MMKVInfo("looks like [%s] been downgrade & upgrade again", m_mmapID.c_str());
241
+ loadFromFile = true;
242
+ writeActualSize(oldStyleActualSize, m_metaInfo->m_crcDigest, nullptr, KeepSequence);
243
+ return;
244
+ }
245
+ } else {
246
+ MMKVWarning("oldStyleActualSize %u greater than file size %lu", oldStyleActualSize, fileSize);
247
+ }
248
+ }
249
+
250
+ auto lastActualSize = m_metaInfo->m_lastConfirmedMetaInfo.lastActualSize;
251
+ if (lastActualSize < fileSize && (lastActualSize + Fixed32Size) <= fileSize) {
252
+ auto lastCRCDigest = m_metaInfo->m_lastConfirmedMetaInfo.lastCRCDigest;
253
+ if (checkFileCRCValid(lastActualSize, lastCRCDigest)) {
254
+ loadFromFile = true;
255
+ writeActualSize(lastActualSize, lastCRCDigest, nullptr, KeepSequence);
256
+ } else {
257
+ MMKVError("check [%s] error: lastActualSize %u, lastActualCRC %u", m_mmapID.c_str(), lastActualSize,
258
+ lastCRCDigest);
259
+ }
260
+ } else {
261
+ MMKVError("check [%s] error: lastActualSize %u, file size is %u", m_mmapID.c_str(), lastActualSize,
262
+ fileSize);
263
+ }
264
+ }
265
+ };
266
+
267
+ m_actualSize = readActualSize();
268
+
269
+ if (m_actualSize < fileSize && (m_actualSize + Fixed32Size) <= fileSize) {
270
+ if (checkFileCRCValid(m_actualSize, m_metaInfo->m_crcDigest)) {
271
+ loadFromFile = true;
272
+ } else {
273
+ checkLastConfirmedInfo();
274
+ if (!loadFromFile) {
275
+
276
+ auto strategic = onMMKVCRCCheckFail(m_mmapID);
277
+ if (strategic == OnErrorRecover) {
278
+ loadFromFile = true;
279
+ needFullWriteback = true;
280
+ }
281
+ MMKVInfo("recover strategic for [%s] is %d", m_mmapID.c_str(), strategic);
282
+ }
283
+ }
284
+ } else {
285
+ MMKVError("check [%s] error: %zu size in total, file size is %zu", m_mmapID.c_str(), m_actualSize, fileSize);
286
+
287
+ checkLastConfirmedInfo();
288
+
289
+ if (!loadFromFile) {
290
+ auto strategic = onMMKVFileLengthError(m_mmapID);
291
+ if (strategic == OnErrorRecover) {
292
+ // make sure we don't over read the file
293
+ m_actualSize = fileSize - Fixed32Size;
294
+ loadFromFile = true;
295
+ needFullWriteback = true;
296
+ }
297
+ MMKVInfo("recover strategic for [%s] is %d", m_mmapID.c_str(), strategic);
298
+ }
299
+ }
300
+ }
301
+
302
+ void MMKV::checkLoadData() {
303
+ if (m_needLoadFromFile) {
304
+ SCOPED_LOCK(m_sharedProcessLock);
305
+
306
+ m_needLoadFromFile = false;
307
+ loadFromFile();
308
+ return;
309
+ }
310
+ if (!isMultiProcess()) {
311
+ return;
312
+ }
313
+
314
+ if (!m_metaFile->isFileValid()) {
315
+ return;
316
+ }
317
+ SCOPED_LOCK(m_sharedProcessLock);
318
+
319
+ MMKVMetaInfo metaInfo;
320
+ metaInfo.read(m_metaFile->getMemory());
321
+ if (m_metaInfo->m_sequence != metaInfo.m_sequence) {
322
+ MMKVInfo("[%s] oldSeq %u, newSeq %u", m_mmapID.c_str(), m_metaInfo->m_sequence, metaInfo.m_sequence);
323
+ SCOPED_LOCK(m_sharedProcessLock);
324
+
325
+ clearMemoryCache();
326
+ loadFromFile();
327
+ notifyContentChanged();
328
+ } else if (m_metaInfo->m_crcDigest != metaInfo.m_crcDigest) {
329
+ MMKVDebug("[%s] oldCrc %u, newCrc %u, new actualSize %u", m_mmapID.c_str(), m_metaInfo->m_crcDigest,
330
+ metaInfo.m_crcDigest, metaInfo.m_actualSize);
331
+ SCOPED_LOCK(m_sharedProcessLock);
332
+
333
+ size_t fileSize = m_file->getActualFileSize();
334
+ if (m_file->getFileSize() != fileSize) {
335
+ MMKVInfo("file size has changed [%s] from %zu to %zu", m_mmapID.c_str(), m_file->getFileSize(), fileSize);
336
+ clearMemoryCache();
337
+ loadFromFile();
338
+ } else {
339
+ partialLoadFromFile();
340
+ }
341
+ notifyContentChanged();
342
+ }
343
+ }
344
+
345
+ constexpr uint32_t ItemSizeHolderSize = 4;
346
+
347
+ static pair<MMBuffer, size_t> prepareEncode(const MMKVMap &dic) {
348
+ // make some room for placeholder
349
+ size_t totalSize = ItemSizeHolderSize;
350
+ for (auto &itr : dic) {
351
+ auto &kvHolder = itr.second;
352
+ totalSize += kvHolder.computedKVSize + kvHolder.valueSize;
353
+ }
354
+ return make_pair(MMBuffer(), totalSize);
355
+ }
356
+
357
+ #ifndef MMKV_DISABLE_CRYPT
358
+ static pair<MMBuffer, size_t> prepareEncode(const MMKVMapCrypt &dic) {
359
+ MMKVVector vec;
360
+ size_t totalSize = 0;
361
+ // make some room for placeholder
362
+ uint32_t smallestOffet = 5 + 1; // 5 is the largest size needed to encode varint32
363
+ for (auto &itr : dic) {
364
+ auto &kvHolder = itr.second;
365
+ if (kvHolder.type == KeyValueHolderType_Offset) {
366
+ totalSize += kvHolder.pbKeyValueSize + kvHolder.keySize + kvHolder.valueSize;
367
+ smallestOffet = min(smallestOffet, kvHolder.offset);
368
+ } else {
369
+ vec.emplace_back(itr.first, kvHolder.toMMBuffer(nullptr, nullptr));
370
+ }
371
+ }
372
+ if (smallestOffet > 5) {
373
+ smallestOffet = ItemSizeHolderSize;
374
+ }
375
+ totalSize += smallestOffet;
376
+ if (vec.empty()) {
377
+ return make_pair(MMBuffer(), totalSize);
378
+ }
379
+ auto buffer = MiniPBCoder::encodeDataWithObject(vec);
380
+ // skip the pb size of buffer
381
+ auto sizeOfMap = CodedInputData(buffer.getPtr(), buffer.length()).readUInt32();
382
+ totalSize += sizeOfMap;
383
+ return make_pair(std::move(buffer), totalSize);
384
+ }
385
+ #endif
386
+
387
+ static pair<MMBuffer, size_t> prepareEncode(MMKVVector &&vec) {
388
+ // make some room for placeholder
389
+ size_t totalSize = ItemSizeHolderSize;
390
+ auto buffer = MiniPBCoder::encodeDataWithObject(vec);
391
+ // skip the pb size of buffer
392
+ auto sizeOfMap = CodedInputData(buffer.getPtr(), buffer.length()).readUInt32();
393
+ totalSize += sizeOfMap;
394
+ return make_pair(std::move(buffer), totalSize);
395
+ }
396
+
397
+ // since we use append mode, when -[setData: forKey:] many times, space may not be enough
398
+ // try a full rewrite to make space
399
+ bool MMKV::ensureMemorySize(size_t newSize) {
400
+ if (!isFileValid()) {
401
+ MMKVWarning("[%s] file not valid", m_mmapID.c_str());
402
+ return false;
403
+ }
404
+ if (isReadOnly()) {
405
+ MMKVWarning("[%s] file readonly", m_mmapID.c_str());
406
+ return false;
407
+ }
408
+
409
+ if (newSize >= m_output->spaceLeft() || (m_crypter ? m_dicCrypt->empty() : m_dic->empty())) {
410
+ // remove expired keys
411
+ if (m_enableKeyExpire) {
412
+ filterExpiredKeys();
413
+ }
414
+ // try a full rewrite to make space
415
+ auto preparedData = m_crypter ? prepareEncode(*m_dicCrypt) : prepareEncode(*m_dic);
416
+ // dic.empty() means inserting key-value for the first time, no need to call msync()
417
+ return expandAndWriteBack(newSize, std::move(preparedData), m_crypter ? !m_dicCrypt->empty() : !m_dic->empty());
418
+ }
419
+ return true;
420
+ }
421
+
422
+ // try a full rewrite to make space
423
+ bool MMKV::expandAndWriteBack(size_t newSize, std::pair<mmkv::MMBuffer, size_t> preparedData, bool needSync) {
424
+ auto fileSize = m_file->getFileSize();
425
+ auto sizeOfDic = preparedData.second;
426
+ size_t lenNeeded = sizeOfDic + Fixed32Size + newSize;
427
+ size_t nowDicCount = m_crypter ? m_dicCrypt->size() : m_dic->size();
428
+ size_t laterDicCount = std::max<size_t>(1, nowDicCount + 1);
429
+ // or use <cmath> ceil()
430
+ size_t avgItemSize = (lenNeeded + laterDicCount - 1) / laterDicCount;
431
+ size_t futureUsage = avgItemSize * std::max<size_t>(8, laterDicCount / 2);
432
+ // 1. no space for a full rewrite, double it
433
+ // 2. or space is not large enough for future usage, double it to avoid frequently full rewrite
434
+ if (lenNeeded >= fileSize || (needSync && (lenNeeded + futureUsage) >= fileSize)) {
435
+ size_t oldSize = fileSize;
436
+ do {
437
+ fileSize *= 2;
438
+ } while (lenNeeded + futureUsage >= fileSize);
439
+ MMKVInfo("extending [%s] file size from %zu to %zu, incoming size:%zu, future usage:%zu", m_mmapID.c_str(),
440
+ oldSize, fileSize, newSize, futureUsage);
441
+
442
+ // if we can't extend size, rollback to old state
443
+ // this is a good place to mock enlarging file failure
444
+ if (!m_file->truncate(fileSize)) {
445
+ return false;
446
+ }
447
+
448
+ // check if we fail to make more space
449
+ if (!isFileValid()) {
450
+ MMKVWarning("[%s] file not valid", m_mmapID.c_str());
451
+ return false;
452
+ }
453
+ }
454
+ return doFullWriteBack(std::move(preparedData), nullptr, needSync);
455
+ }
456
+
457
+ size_t MMKV::readActualSize() {
458
+ MMKV_ASSERT(m_file->getMemory());
459
+ MMKV_ASSERT(m_metaFile->isFileValid());
460
+
461
+ uint32_t actualSize = 0;
462
+ memcpy(&actualSize, m_file->getMemory(), Fixed32Size);
463
+
464
+ if (m_metaInfo->m_version >= MMKVVersionActualSize) {
465
+ if (m_metaInfo->m_actualSize != actualSize) {
466
+ MMKVWarning("[%s] actual size %u, meta actual size %u", m_mmapID.c_str(), actualSize,
467
+ m_metaInfo->m_actualSize);
468
+ }
469
+ return m_metaInfo->m_actualSize;
470
+ } else {
471
+ return actualSize;
472
+ }
473
+ }
474
+
475
+ void MMKV::oldStyleWriteActualSize(size_t actualSize) {
476
+ MMKV_ASSERT(m_file->getMemory());
477
+
478
+ m_actualSize = actualSize;
479
+ #ifdef MMKV_IOS
480
+ auto ret = guardForBackgroundWriting(m_file->getMemory(), Fixed32Size);
481
+ if (!ret.first) {
482
+ return;
483
+ }
484
+ #endif
485
+ memcpy(m_file->getMemory(), &actualSize, Fixed32Size);
486
+ }
487
+
488
+ bool MMKV::writeActualSize(size_t size, uint32_t crcDigest, const void *iv, bool increaseSequence) {
489
+ // backward compatibility
490
+ oldStyleWriteActualSize(size);
491
+
492
+ if (!m_metaFile->isFileValid()) {
493
+ return false;
494
+ }
495
+
496
+ bool needsFullWrite = false;
497
+ m_actualSize = size;
498
+ m_metaInfo->m_actualSize = static_cast<uint32_t>(size);
499
+ m_crcDigest = crcDigest;
500
+ m_metaInfo->m_crcDigest = crcDigest;
501
+ if (m_metaInfo->m_version < MMKVVersionSequence) {
502
+ m_metaInfo->m_version = MMKVVersionSequence;
503
+ needsFullWrite = true;
504
+ }
505
+ #ifndef MMKV_DISABLE_CRYPT
506
+ if (mmkv_unlikely(iv)) {
507
+ memcpy(m_metaInfo->m_vector, iv, sizeof(m_metaInfo->m_vector));
508
+ if (m_metaInfo->m_version < MMKVVersionRandomIV) {
509
+ m_metaInfo->m_version = MMKVVersionRandomIV;
510
+ }
511
+ needsFullWrite = true;
512
+ }
513
+ #endif
514
+ if (mmkv_unlikely(increaseSequence)) {
515
+ m_metaInfo->m_sequence++;
516
+ m_metaInfo->m_lastConfirmedMetaInfo.lastActualSize = static_cast<uint32_t>(size);
517
+ m_metaInfo->m_lastConfirmedMetaInfo.lastCRCDigest = crcDigest;
518
+ if (m_metaInfo->m_version < MMKVVersionActualSize) {
519
+ m_metaInfo->m_version = MMKVVersionActualSize;
520
+ }
521
+ needsFullWrite = true;
522
+ MMKVInfo("[%s] increase sequence to %u, crc %u, actualSize %u", m_mmapID.c_str(), m_metaInfo->m_sequence,
523
+ m_metaInfo->m_crcDigest, m_metaInfo->m_actualSize);
524
+ }
525
+ if (m_metaInfo->m_version < MMKVVersionFlag) {
526
+ m_metaInfo->m_flags = 0;
527
+ m_metaInfo->m_version = MMKVVersionFlag;
528
+ needsFullWrite = true;
529
+ }
530
+ #ifdef MMKV_IOS
531
+ auto ret = guardForBackgroundWriting(m_metaFile->getMemory(), sizeof(MMKVMetaInfo));
532
+ if (!ret.first) {
533
+ return false;
534
+ }
535
+ #endif
536
+ if (mmkv_unlikely(needsFullWrite)) {
537
+ m_metaInfo->write(m_metaFile->getMemory());
538
+ } else {
539
+ m_metaInfo->writeCRCAndActualSizeOnly(m_metaFile->getMemory());
540
+ }
541
+ return true;
542
+ }
543
+
544
+ MMBuffer MMKV::getRawDataForKey(MMKVKey_t key) {
545
+ checkLoadData();
546
+ #ifndef MMKV_DISABLE_CRYPT
547
+ if (m_crypter) {
548
+ auto itr = m_dicCrypt->find(key);
549
+ if (itr != m_dicCrypt->end()) {
550
+ auto basePtr = (uint8_t *) (m_file->getMemory()) + Fixed32Size;
551
+ return itr->second.toMMBuffer(basePtr, m_crypter);
552
+ }
553
+ } else
554
+ #endif
555
+ {
556
+ auto itr = m_dic->find(key);
557
+ if (itr != m_dic->end()) {
558
+ auto basePtr = (uint8_t *) (m_file->getMemory()) + Fixed32Size;
559
+ return itr->second.toMMBuffer(basePtr);
560
+ }
561
+ }
562
+ MMBuffer nan;
563
+ return nan;
564
+ }
565
+
566
+ mmkv::MMBuffer MMKV::getDataForKey(MMKVKey_t key) {
567
+ if (mmkv_unlikely(m_enableKeyExpire)) {
568
+ return getDataWithoutMTimeForKey(key);
569
+ }
570
+ return getRawDataForKey(key);
571
+ }
572
+
573
+ #ifndef MMKV_DISABLE_CRYPT
574
+ // for Apple watch simulator
575
+ # if defined(TARGET_OS_SIMULATOR) && defined(TARGET_CPU_X86)
576
+ static AESCryptStatus t_status;
577
+ # else
578
+ thread_local AESCryptStatus t_status;
579
+ # endif
580
+ #endif // MMKV_DISABLE_CRYPT
581
+
582
+ bool MMKV::setDataForKey(MMBuffer &&data, MMKVKey_t key, bool isDataHolder) {
583
+ if ((!isDataHolder && data.length() == 0) || isKeyEmpty(key)) {
584
+ return false;
585
+ }
586
+ SCOPED_LOCK(m_lock);
587
+ SCOPED_LOCK(m_exclusiveProcessLock);
588
+ checkLoadData();
589
+
590
+ #ifndef MMKV_DISABLE_CRYPT
591
+ if (m_crypter) {
592
+ if (isDataHolder) {
593
+ auto sizeNeededForData = pbRawVarint32Size((uint32_t) data.length()) + data.length();
594
+ if (!KeyValueHolderCrypt::isValueStoredAsOffset(sizeNeededForData)) {
595
+ data = MiniPBCoder::encodeDataWithObject(data);
596
+ isDataHolder = false;
597
+ }
598
+ }
599
+ auto itr = m_dicCrypt->find(key);
600
+ if (itr != m_dicCrypt->end()) {
601
+ bool onlyOneKey = !isMultiProcess() && m_dicCrypt->size() == 1;
602
+ # ifdef MMKV_APPLE
603
+ KVHolderRet_t ret;
604
+ if (onlyOneKey) {
605
+ ret = overrideDataWithKey(data, key, itr->second, isDataHolder);
606
+ } else {
607
+ ret = appendDataWithKey(data, key, itr->second, isDataHolder);
608
+ }
609
+ # else
610
+ KVHolderRet_t ret;
611
+ if (onlyOneKey) {
612
+ ret = overrideDataWithKey(data, key, isDataHolder);
613
+ } else {
614
+ ret = appendDataWithKey(data, key, isDataHolder);
615
+ }
616
+ # endif
617
+ if (!ret.first) {
618
+ return false;
619
+ }
620
+ KeyValueHolderCrypt kvHolder;
621
+ if (KeyValueHolderCrypt::isValueStoredAsOffset(ret.second.valueSize)) {
622
+ kvHolder = KeyValueHolderCrypt(ret.second.keySize, ret.second.valueSize, ret.second.offset);
623
+ memcpy(&kvHolder.cryptStatus, &t_status, sizeof(t_status));
624
+ } else {
625
+ kvHolder = KeyValueHolderCrypt(std::move(data));
626
+ }
627
+ if (mmkv_likely(!m_enableKeyExpire)) {
628
+ itr->second = std::move(kvHolder);
629
+ } else {
630
+ itr = m_dicCrypt->find(key);
631
+ if (itr != m_dicCrypt->end()) {
632
+ itr->second = std::move(kvHolder);
633
+ } else {
634
+ // in case filterExpiredKeys() is triggered
635
+ m_dicCrypt->emplace(key, std::move(kvHolder));
636
+ mmkv_retain_key(key);
637
+ }
638
+ }
639
+ } else {
640
+ bool needOverride = !isMultiProcess() && m_dicCrypt->empty() && m_actualSize > 0;
641
+ KVHolderRet_t ret;
642
+ if (needOverride) {
643
+ ret = overrideDataWithKey(data, key, isDataHolder);
644
+ } else {
645
+ ret = appendDataWithKey(data, key, isDataHolder);
646
+ }
647
+ if (!ret.first) {
648
+ return false;
649
+ }
650
+ if (KeyValueHolderCrypt::isValueStoredAsOffset(ret.second.valueSize)) {
651
+ auto r = m_dicCrypt->emplace(
652
+ key, KeyValueHolderCrypt(ret.second.keySize, ret.second.valueSize, ret.second.offset));
653
+ if (r.second) {
654
+ memcpy(&(r.first->second.cryptStatus), &t_status, sizeof(t_status));
655
+ }
656
+ } else {
657
+ m_dicCrypt->emplace(key, KeyValueHolderCrypt(std::move(data)));
658
+ }
659
+ mmkv_retain_key(key);
660
+ }
661
+ } else
662
+ #endif // MMKV_DISABLE_CRYPT
663
+ {
664
+ auto itr = m_dic->find(key);
665
+ if (itr != m_dic->end()) {
666
+ // compare data before appending to file
667
+ if (isCompareBeforeSetEnabled()) {
668
+ auto basePtr = (uint8_t *) (m_file->getMemory()) + Fixed32Size;
669
+ MMBuffer oldValueData = itr->second.toMMBuffer(basePtr);
670
+ if (isDataHolder) {
671
+ CodedInputData inputData(oldValueData.getPtr(), oldValueData.length());
672
+ try {
673
+ // read extra holder header bytes and to real MMBuffer
674
+ oldValueData = CodedInputData::readRealData(oldValueData);
675
+ if (oldValueData == data) {
676
+ // MMKVInfo("[key] %s, set the same data", key.c_str());
677
+ return true;
678
+ }
679
+ } catch (std::exception &exception) {
680
+ MMKVWarning("compareBeforeSet exception: %s", exception.what());
681
+ } catch (...) {
682
+ MMKVWarning("compareBeforeSet fail");
683
+ }
684
+ } else {
685
+ if (oldValueData == data) {
686
+ // MMKVInfo("[key] %s, set the same data", key.c_str());
687
+ return true;
688
+ }
689
+ }
690
+ }
691
+
692
+ bool onlyOneKey = !isMultiProcess() && m_dic->size() == 1;
693
+ if (mmkv_likely(!m_enableKeyExpire)) {
694
+ KVHolderRet_t ret;
695
+ if (onlyOneKey) {
696
+ ret = overrideDataWithKey(data, itr->second, isDataHolder);
697
+ } else {
698
+ ret = appendDataWithKey(data, itr->second, isDataHolder);
699
+ }
700
+ if (!ret.first) {
701
+ return false;
702
+ }
703
+ itr->second = std::move(ret.second);
704
+ } else {
705
+ KVHolderRet_t ret;
706
+ if (onlyOneKey) {
707
+ ret = overrideDataWithKey(data, key, isDataHolder);
708
+ } else {
709
+ ret = appendDataWithKey(data, key, isDataHolder);
710
+ }
711
+ if (!ret.first) {
712
+ return false;
713
+ }
714
+ itr = m_dic->find(key);
715
+ if (itr != m_dic->end()) {
716
+ itr->second = std::move(ret.second);
717
+ } else {
718
+ // in case filterExpiredKeys() is triggered
719
+ m_dic->emplace(key, std::move(ret.second));
720
+ mmkv_retain_key(key);
721
+ }
722
+ }
723
+ } else {
724
+ bool needOverride = !isMultiProcess() && m_dic->empty() && m_actualSize > 0;
725
+ KVHolderRet_t ret;
726
+ if (needOverride) {
727
+ ret = overrideDataWithKey(data, key, isDataHolder);
728
+ } else {
729
+ ret = appendDataWithKey(data, key, isDataHolder);
730
+ }
731
+ if (!ret.first) {
732
+ return false;
733
+ }
734
+ m_dic->emplace(key, std::move(ret.second));
735
+ mmkv_retain_key(key);
736
+ }
737
+ }
738
+ m_hasFullWriteback = false;
739
+ return true;
740
+ }
741
+
742
+ template <typename T>
743
+ static void eraseHelper(T& container, std::string_view key) {
744
+ auto itr = container.find(key);
745
+ if (itr != container.end()) {
746
+ container.erase(itr);
747
+ }
748
+ }
749
+
750
+ bool MMKV::removeDataForKey(MMKVKey_t key) {
751
+ if (isKeyEmpty(key)) {
752
+ return false;
753
+ }
754
+ #ifndef MMKV_DISABLE_CRYPT
755
+ if (m_crypter) {
756
+ auto itr = m_dicCrypt->find(key);
757
+ if (itr != m_dicCrypt->end()) {
758
+ m_hasFullWriteback = false;
759
+ static MMBuffer nan;
760
+ # ifdef MMKV_APPLE
761
+ auto ret = appendDataWithKey(nan, key, itr->second);
762
+ if (ret.first) {
763
+ if (mmkv_unlikely(m_enableKeyExpire)) {
764
+ // filterExpiredKeys() may invalid itr
765
+ itr = m_dicCrypt->find(key);
766
+ if (itr == m_dicCrypt->end()) {
767
+ return true;
768
+ }
769
+ }
770
+ auto oldKey = itr->first;
771
+ m_dicCrypt->erase(itr);
772
+ [oldKey release];
773
+ }
774
+ # else
775
+ auto ret = appendDataWithKey(nan, key);
776
+ if (ret.first) {
777
+ if (mmkv_unlikely(m_enableKeyExpire)) {
778
+ eraseHelper(*m_dicCrypt, key);
779
+ } else {
780
+ m_dicCrypt->erase(itr);
781
+ }
782
+ }
783
+ # endif
784
+ return ret.first;
785
+ }
786
+ } else
787
+ #endif // MMKV_DISABLE_CRYPT
788
+ {
789
+ auto itr = m_dic->find(key);
790
+ if (itr != m_dic->end()) {
791
+ m_hasFullWriteback = false;
792
+ static MMBuffer nan;
793
+ auto ret = mmkv_likely(!m_enableKeyExpire) ? appendDataWithKey(nan, itr->second) : appendDataWithKey(nan, key);
794
+ if (ret.first) {
795
+ #ifdef MMKV_APPLE
796
+ if (mmkv_unlikely(m_enableKeyExpire)) {
797
+ // filterExpiredKeys() may invalid itr
798
+ itr = m_dic->find(key);
799
+ if (itr == m_dic->end()) {
800
+ return true;
801
+ }
802
+ }
803
+ auto oldKey = itr->first;
804
+ m_dic->erase(itr);
805
+ [oldKey release];
806
+ #else
807
+ if (mmkv_unlikely(m_enableKeyExpire)) {
808
+ // filterExpiredKeys() may invalid itr
809
+ eraseHelper(*m_dic, key);
810
+ } else {
811
+ m_dic->erase(itr);
812
+ }
813
+ #endif
814
+ }
815
+ return ret.first;
816
+ }
817
+ }
818
+
819
+ return false;
820
+ }
821
+
822
+ KVHolderRet_t
823
+ MMKV::doAppendDataWithKey(const MMBuffer &data, const MMBuffer &keyData, bool isDataHolder, uint32_t originKeyLength) {
824
+ auto isKeyEncoded = (originKeyLength < keyData.length());
825
+ auto keyLength = static_cast<uint32_t>(keyData.length());
826
+ auto valueLength = static_cast<uint32_t>(data.length());
827
+ if (isDataHolder) {
828
+ valueLength += pbRawVarint32Size(valueLength);
829
+ }
830
+ // size needed to encode the key
831
+ size_t size = isKeyEncoded ? keyLength : (keyLength + pbRawVarint32Size(keyLength));
832
+ // size needed to encode the value
833
+ size += valueLength + pbRawVarint32Size(valueLength);
834
+
835
+ SCOPED_LOCK(m_exclusiveProcessLock);
836
+
837
+ bool hasEnoughSize = ensureMemorySize(size);
838
+ if (!hasEnoughSize || !isFileValid()) {
839
+ return make_pair(false, KeyValueHolder());
840
+ }
841
+
842
+ #ifdef MMKV_IOS
843
+ auto ret = guardForBackgroundWriting(m_output->curWritePointer(), size);
844
+ if (!ret.first) {
845
+ return make_pair(false, KeyValueHolder());
846
+ }
847
+ #endif
848
+ #ifndef MMKV_DISABLE_CRYPT
849
+ if (m_crypter) {
850
+ if (KeyValueHolderCrypt::isValueStoredAsOffset(valueLength)) {
851
+ m_crypter->getCurStatus(t_status);
852
+ }
853
+ }
854
+ #endif
855
+ try {
856
+ if (isKeyEncoded) {
857
+ m_output->writeRawData(keyData);
858
+ } else {
859
+ m_output->writeData(keyData);
860
+ }
861
+ if (isDataHolder) {
862
+ m_output->writeRawVarint32((int32_t) valueLength);
863
+ }
864
+ m_output->writeData(data); // note: write size of data
865
+ } catch (std::exception &e) {
866
+ MMKVError("%s", e.what());
867
+ return make_pair(false, KeyValueHolder());
868
+ } catch (...) {
869
+ MMKVError("append fail");
870
+ return make_pair(false, KeyValueHolder());
871
+ }
872
+
873
+ auto offset = static_cast<uint32_t>(m_actualSize);
874
+ auto ptr = (uint8_t *) m_file->getMemory() + Fixed32Size + m_actualSize;
875
+ #ifndef MMKV_DISABLE_CRYPT
876
+ if (m_crypter) {
877
+ m_crypter->encrypt(ptr, ptr, size);
878
+ }
879
+ #endif
880
+ m_actualSize += size;
881
+ updateCRCDigest(ptr, size);
882
+
883
+ return make_pair(true, KeyValueHolder(originKeyLength, valueLength, offset));
884
+ }
885
+
886
+ KVHolderRet_t MMKV::doOverrideDataWithKey(const MMBuffer &data,
887
+ const MMBuffer &keyData,
888
+ bool isDataHolder,
889
+ uint32_t originKeyLength) {
890
+ auto isKeyEncoded = (originKeyLength < keyData.length());
891
+ auto keyLength = static_cast<uint32_t>(keyData.length());
892
+ auto valueLength = static_cast<uint32_t>(data.length());
893
+ if (isDataHolder) {
894
+ valueLength += pbRawVarint32Size(valueLength);
895
+ }
896
+ // size needed to encode the key
897
+ size_t size = isKeyEncoded ? keyLength : (keyLength + pbRawVarint32Size(keyLength));
898
+ // size needed to encode the value
899
+ size += valueLength + pbRawVarint32Size(valueLength);
900
+
901
+ if (!checkSizeForOverride(size)) {
902
+ return doAppendDataWithKey(data, keyData, isDataHolder, originKeyLength);
903
+ }
904
+
905
+ // we don't not support override in multi-process mode
906
+ // SCOPED_LOCK(m_exclusiveProcessLock);
907
+
908
+ #ifdef MMKV_IOS
909
+ auto ret = guardForBackgroundWriting(m_output->curWritePointer(), size);
910
+ if (!ret.first) {
911
+ return make_pair(false, KeyValueHolder());
912
+ }
913
+ #endif
914
+ #ifndef MMKV_DISABLE_CRYPT
915
+ if (m_crypter) {
916
+ if (m_metaInfo->m_version >= MMKVVersionRandomIV) {
917
+ m_crypter->resetIV(m_metaInfo->m_vector, sizeof(m_metaInfo->m_vector));
918
+ } else {
919
+ m_crypter->resetIV();
920
+ }
921
+ }
922
+ #endif
923
+ try {
924
+ // write ItemSizeHolder
925
+ m_output->setPosition(0);
926
+ m_output->writeUInt32(AESCrypt::randomItemSizeHolder(ItemSizeHolderSize));
927
+ m_actualSize = ItemSizeHolderSize;
928
+ #ifndef MMKV_DISABLE_CRYPT
929
+ if (m_crypter) {
930
+ auto ptr = (uint8_t *) m_file->getMemory() + Fixed32Size;
931
+ m_crypter->encrypt(ptr, ptr, m_actualSize);
932
+ if (KeyValueHolderCrypt::isValueStoredAsOffset(valueLength)) {
933
+ m_crypter->getCurStatus(t_status);
934
+ }
935
+ }
936
+ #endif
937
+ if (isKeyEncoded) {
938
+ m_output->writeRawData(keyData);
939
+ } else {
940
+ m_output->writeData(keyData);
941
+ }
942
+ if (isDataHolder) {
943
+ m_output->writeRawVarint32((int32_t) valueLength);
944
+ }
945
+ m_output->writeData(data); // note: write size of data
946
+ } catch (std::exception &e) {
947
+ MMKVError("%s", e.what());
948
+ return make_pair(false, KeyValueHolder());
949
+ } catch (...) {
950
+ MMKVError("append fail");
951
+ return make_pair(false, KeyValueHolder());
952
+ }
953
+
954
+ auto offset = static_cast<uint32_t>(m_actualSize);
955
+ m_actualSize += size;
956
+ #ifndef MMKV_DISABLE_CRYPT
957
+ if (m_crypter) {
958
+ auto ptr = (uint8_t *) m_file->getMemory() + Fixed32Size + offset;
959
+ m_crypter->encrypt(ptr, ptr, size);
960
+ }
961
+ #endif
962
+ recalculateCRCDigestOnly();
963
+
964
+ return make_pair(true, KeyValueHolder(originKeyLength, valueLength, offset));
965
+ }
966
+
967
+ bool MMKV::checkSizeForOverride(size_t size) {
968
+ if (!isFileValid()) {
969
+ MMKVWarning("[%s] file not valid", m_mmapID.c_str());
970
+ return false;
971
+ }
972
+
973
+ // only override if the file can hole it without ftruncate()
974
+ auto fileSize = m_file->getFileSize();
975
+ auto spaceNeededForOverride = size + Fixed32Size + ItemSizeHolderSize;
976
+ if (size > fileSize || spaceNeededForOverride > fileSize) {
977
+ return false;
978
+ }
979
+ return true;
980
+ }
981
+
982
+ KVHolderRet_t MMKV::appendDataWithKey(const MMBuffer &data, MMKVKey_t key, bool isDataHolder) {
983
+ #ifdef MMKV_APPLE
984
+ auto oData = [key dataUsingEncoding:NSUTF8StringEncoding];
985
+ auto keyData = MMBuffer(oData, MMBufferNoCopy);
986
+ #else
987
+ auto keyData = MMBuffer((void *) key.data(), key.size(), MMBufferNoCopy);
988
+ #endif
989
+ return doAppendDataWithKey(data, keyData, isDataHolder, static_cast<uint32_t>(keyData.length()));
990
+ }
991
+
992
+ KVHolderRet_t MMKV::overrideDataWithKey(const MMBuffer &data, MMKVKey_t key, bool isDataHolder) {
993
+ #ifdef MMKV_APPLE
994
+ auto oData = [key dataUsingEncoding:NSUTF8StringEncoding];
995
+ auto keyData = MMBuffer(oData, MMBufferNoCopy);
996
+ #else
997
+ auto keyData = MMBuffer((void *) key.data(), key.size(), MMBufferNoCopy);
998
+ #endif
999
+ return doOverrideDataWithKey(data, keyData, isDataHolder, static_cast<uint32_t>(keyData.length()));
1000
+ }
1001
+
1002
+ KVHolderRet_t MMKV::appendDataWithKey(const MMBuffer &data, const KeyValueHolder &kvHolder, bool isDataHolder) {
1003
+ SCOPED_LOCK(m_exclusiveProcessLock);
1004
+
1005
+ uint32_t keyLength = kvHolder.keySize;
1006
+ // size needed to encode the key
1007
+ size_t rawKeySize = keyLength + pbRawVarint32Size(keyLength);
1008
+
1009
+ // ensureMemorySize() might change kvHolder.offset, so have to do it early
1010
+ {
1011
+ auto valueLength = static_cast<uint32_t>(data.length());
1012
+ if (isDataHolder) {
1013
+ valueLength += pbRawVarint32Size(valueLength);
1014
+ }
1015
+ auto size = rawKeySize + valueLength + pbRawVarint32Size(valueLength);
1016
+ bool hasEnoughSize = ensureMemorySize(size);
1017
+ if (!hasEnoughSize) {
1018
+ return make_pair(false, KeyValueHolder());
1019
+ }
1020
+ }
1021
+ auto basePtr = (uint8_t *) m_file->getMemory() + Fixed32Size;
1022
+ MMBuffer keyData(basePtr + kvHolder.offset, rawKeySize, MMBufferNoCopy);
1023
+
1024
+ return doAppendDataWithKey(data, keyData, isDataHolder, keyLength);
1025
+ }
1026
+
1027
+ // only one key in dict, do not append, just rewrite from beginning
1028
+ KVHolderRet_t MMKV::overrideDataWithKey(const MMBuffer &data, const KeyValueHolder &kvHolder, bool isDataHolder) {
1029
+ // we don't not support override in multi-process mode
1030
+ // SCOPED_LOCK(m_exclusiveProcessLock);
1031
+
1032
+ uint32_t keyLength = kvHolder.keySize;
1033
+ // size needed to encode the key
1034
+ size_t rawKeySize = keyLength + pbRawVarint32Size(keyLength);
1035
+
1036
+ // ensureMemorySize() (inside doAppendDataWithKey() which be called from doOverrideDataWithKey())
1037
+ // might change kvHolder.offset, so have to do it early
1038
+ {
1039
+ auto valueLength = static_cast<uint32_t>(data.length());
1040
+ if (isDataHolder) {
1041
+ valueLength += pbRawVarint32Size(valueLength);
1042
+ }
1043
+ auto size = rawKeySize + valueLength + pbRawVarint32Size(valueLength);
1044
+ bool hasEnoughSize = checkSizeForOverride(size);
1045
+ if (!hasEnoughSize) {
1046
+ return appendDataWithKey(data, kvHolder, isDataHolder);
1047
+ }
1048
+ }
1049
+ auto basePtr = (uint8_t *) m_file->getMemory() + Fixed32Size;
1050
+ MMBuffer keyData(basePtr + kvHolder.offset, rawKeySize, MMBufferNoCopy);
1051
+
1052
+ return doOverrideDataWithKey(data, keyData, isDataHolder, keyLength);
1053
+ }
1054
+
1055
+ bool MMKV::fullWriteback(AESCrypt *newCrypter, bool onlyWhileExpire) {
1056
+ if (m_hasFullWriteback) {
1057
+ return true;
1058
+ }
1059
+ if (m_needLoadFromFile) {
1060
+ return true;
1061
+ }
1062
+ if (!isFileValid()) {
1063
+ MMKVWarning("[%s] file not valid", m_mmapID.c_str());
1064
+ return false;
1065
+ }
1066
+
1067
+ if (mmkv_unlikely(m_enableKeyExpire)) {
1068
+ auto expiredCount = filterExpiredKeys();
1069
+ if (onlyWhileExpire && expiredCount == 0) {
1070
+ return true;
1071
+ }
1072
+ }
1073
+
1074
+ auto isEmpty = m_crypter ? m_dicCrypt->empty() : m_dic->empty();
1075
+ if (isEmpty) {
1076
+ clearAll();
1077
+ return true;
1078
+ }
1079
+
1080
+ SCOPED_LOCK(m_exclusiveProcessLock);
1081
+ auto preparedData = m_crypter ? prepareEncode(*m_dicCrypt) : prepareEncode(*m_dic);
1082
+ auto sizeOfDic = preparedData.second;
1083
+ if (sizeOfDic > 0) {
1084
+ auto fileSize = m_file->getFileSize();
1085
+ if (sizeOfDic + Fixed32Size <= fileSize) {
1086
+ return doFullWriteBack(std::move(preparedData), newCrypter);
1087
+ } else {
1088
+ assert(0);
1089
+ assert(newCrypter == nullptr);
1090
+ // expandAndWriteBack() will extend file & full rewrite, no need to write back again
1091
+ auto newSize = sizeOfDic + Fixed32Size - fileSize;
1092
+ return expandAndWriteBack(newSize, std::move(preparedData));
1093
+ }
1094
+ }
1095
+ return false;
1096
+ }
1097
+
1098
+ // we don't need to really serialize the dictionary, just reuse what's already in the file
1099
+ static void
1100
+ memmoveDictionary(MMKVMap &dic, CodedOutputData *output, uint8_t *ptr, AESCrypt *encrypter, size_t totalSize) {
1101
+ auto originOutputPtr = output->curWritePointer();
1102
+ // make space to hold the fake size of dictionary's serialization result
1103
+ auto writePtr = originOutputPtr + ItemSizeHolderSize;
1104
+ // reuse what's already in the file
1105
+ if (!dic.empty()) {
1106
+ // sort by offset
1107
+ vector<KeyValueHolder *> vec;
1108
+ vec.reserve(dic.size());
1109
+ for (auto &itr : dic) {
1110
+ vec.push_back(&itr.second);
1111
+ }
1112
+ sort(vec.begin(), vec.end(), [](const auto &left, const auto &right) { return left->offset < right->offset; });
1113
+
1114
+ // merge nearby items to make memmove quicker
1115
+ vector<pair<uint32_t, uint32_t>> dataSections; // pair(offset, size)
1116
+ dataSections.emplace_back(vec.front()->offset, vec.front()->computedKVSize + vec.front()->valueSize);
1117
+ for (size_t index = 1, total = vec.size(); index < total; index++) {
1118
+ auto kvHolder = vec[index];
1119
+ auto &lastSection = dataSections.back();
1120
+ if (kvHolder->offset == lastSection.first + lastSection.second) {
1121
+ lastSection.second += kvHolder->computedKVSize + kvHolder->valueSize;
1122
+ } else {
1123
+ dataSections.emplace_back(kvHolder->offset, kvHolder->computedKVSize + kvHolder->valueSize);
1124
+ }
1125
+ }
1126
+ // do the move
1127
+ auto basePtr = ptr + Fixed32Size;
1128
+ for (auto &section : dataSections) {
1129
+ // memmove() should handle this well: src == dst
1130
+ memmove(writePtr, basePtr + section.first, section.second);
1131
+ writePtr += section.second;
1132
+ }
1133
+ // update offset
1134
+ if (!encrypter) {
1135
+ auto offset = ItemSizeHolderSize;
1136
+ for (auto kvHolder : vec) {
1137
+ kvHolder->offset = offset;
1138
+ offset += kvHolder->computedKVSize + kvHolder->valueSize;
1139
+ }
1140
+ }
1141
+ }
1142
+ // hold the fake size of dictionary's serialization result
1143
+ output->writeUInt32(AESCrypt::randomItemSizeHolder(ItemSizeHolderSize));
1144
+ auto writtenSize = static_cast<size_t>(writePtr - originOutputPtr);
1145
+ #ifndef MMKV_DISABLE_CRYPT
1146
+ if (encrypter) {
1147
+ encrypter->encrypt(originOutputPtr, originOutputPtr, writtenSize);
1148
+ }
1149
+ #endif
1150
+ assert(writtenSize == totalSize);
1151
+ output->seek(writtenSize - ItemSizeHolderSize);
1152
+ }
1153
+
1154
+ #ifndef MMKV_DISABLE_CRYPT
1155
+
1156
+ static void memmoveDictionary(MMKVMapCrypt &dic,
1157
+ CodedOutputData *output,
1158
+ uint8_t *ptr,
1159
+ AESCrypt *decrypter,
1160
+ AESCrypt *encrypter,
1161
+ pair<MMBuffer, size_t> &preparedData) {
1162
+ // reuse what's already in the file
1163
+ vector<KeyValueHolderCrypt *> vec;
1164
+ if (!dic.empty()) {
1165
+ // sort by offset
1166
+ vec.reserve(dic.size());
1167
+ for (auto &itr : dic) {
1168
+ if (itr.second.type == KeyValueHolderType_Offset) {
1169
+ vec.push_back(&itr.second);
1170
+ }
1171
+ }
1172
+ sort(vec.begin(), vec.end(), [](auto left, auto right) { return left->offset < right->offset; });
1173
+ }
1174
+ auto sizeHolderSize = ItemSizeHolderSize;
1175
+ auto sizeHolder = AESCrypt::randomItemSizeHolder(sizeHolderSize);
1176
+ if (!vec.empty()) {
1177
+ auto smallestOffset = vec.front()->offset;
1178
+ if (smallestOffset != ItemSizeHolderSize && smallestOffset <= 5) {
1179
+ sizeHolderSize = smallestOffset;
1180
+ assert(sizeHolderSize != 0);
1181
+ static const uint32_t ItemSizeHolders[] = {0, 0x0f, 0xff, 0xffff, 0xffffff, 0xffffffff};
1182
+ sizeHolder = AESCrypt::randomItemSizeHolder(sizeHolderSize);
1183
+ assert(sizeHolder >= ItemSizeHolders[sizeHolderSize] && sizeHolder <= ItemSizeHolders[sizeHolderSize]);
1184
+ }
1185
+ }
1186
+ output->writeRawVarint32(static_cast<int32_t>(sizeHolder));
1187
+ auto writePtr = output->curWritePointer();
1188
+ if (encrypter) {
1189
+ encrypter->encrypt(writePtr - sizeHolderSize, writePtr - sizeHolderSize, sizeHolderSize);
1190
+ }
1191
+ if (!vec.empty()) {
1192
+ // merge nearby items to make memmove quicker
1193
+ vector<tuple<uint32_t, uint32_t, AESCryptStatus *>> dataSections; // pair(offset, size)
1194
+ dataSections.push_back(vec.front()->toTuple());
1195
+ for (size_t index = 1, total = vec.size(); index < total; index++) {
1196
+ auto kvHolder = vec[index];
1197
+ auto &lastSection = dataSections.back();
1198
+ if (kvHolder->offset == get<0>(lastSection) + get<1>(lastSection)) {
1199
+ get<1>(lastSection) += kvHolder->pbKeyValueSize + kvHolder->keySize + kvHolder->valueSize;
1200
+ } else {
1201
+ dataSections.push_back(kvHolder->toTuple());
1202
+ }
1203
+ }
1204
+ // do the move
1205
+ auto basePtr = ptr + Fixed32Size;
1206
+ for (auto &section : dataSections) {
1207
+ auto crypter = decrypter->cloneWithStatus(*get<2>(section));
1208
+ crypter.decrypt(basePtr + get<0>(section), writePtr, get<1>(section));
1209
+ writePtr += get<1>(section);
1210
+ }
1211
+ // update offset & AESCryptStatus
1212
+ if (encrypter) {
1213
+ auto offset = sizeHolderSize;
1214
+ for (auto kvHolder : vec) {
1215
+ kvHolder->offset = offset;
1216
+ auto size = kvHolder->pbKeyValueSize + kvHolder->keySize + kvHolder->valueSize;
1217
+ encrypter->getCurStatus(kvHolder->cryptStatus);
1218
+ encrypter->encrypt(basePtr + offset, basePtr + offset, size);
1219
+ offset += size;
1220
+ }
1221
+ }
1222
+ }
1223
+ auto &data = preparedData.first;
1224
+ if (data.length() > 0) {
1225
+ auto dataSize = CodedInputData(data.getPtr(), data.length()).readUInt32();
1226
+ if (dataSize > 0) {
1227
+ auto dataPtr = (uint8_t *) data.getPtr() + pbRawVarint32Size(dataSize);
1228
+ if (encrypter) {
1229
+ encrypter->encrypt(dataPtr, writePtr, dataSize);
1230
+ } else {
1231
+ memcpy(writePtr, dataPtr, dataSize);
1232
+ }
1233
+ writePtr += dataSize;
1234
+ }
1235
+ }
1236
+ auto writtenSize = static_cast<size_t>(writePtr - output->curWritePointer());
1237
+ assert(writtenSize + sizeHolderSize == preparedData.second);
1238
+ output->seek(writtenSize);
1239
+ }
1240
+
1241
+ # define InvalidCryptPtr ((AESCrypt *) (void *) (1))
1242
+
1243
+ #endif // MMKV_DISABLE_CRYPT
1244
+
1245
+ static void fullWriteBackWholeData(MMBuffer allData, size_t totalSize, CodedOutputData *output) {
1246
+ auto originOutputPtr = output->curWritePointer();
1247
+ output->writeUInt32(AESCrypt::randomItemSizeHolder(ItemSizeHolderSize));
1248
+ if (allData.length() > 0) {
1249
+ auto dataSize = CodedInputData(allData.getPtr(), allData.length()).readUInt32();
1250
+ if (dataSize > 0) {
1251
+ auto dataPtr = (uint8_t *) allData.getPtr() + pbRawVarint32Size(dataSize);
1252
+ memcpy(output->curWritePointer(), dataPtr, dataSize);
1253
+ output->seek(dataSize);
1254
+ }
1255
+ }
1256
+ [[maybe_unused]] auto writtenSize = (size_t)(output->curWritePointer() - originOutputPtr);
1257
+ assert(writtenSize == totalSize);
1258
+ }
1259
+
1260
+ #ifndef MMKV_DISABLE_CRYPT
1261
+ bool MMKV::doFullWriteBack(pair<MMBuffer, size_t> prepared, AESCrypt *newCrypter, bool needSync) {
1262
+ auto ptr = (uint8_t *) m_file->getMemory();
1263
+ auto totalSize = prepared.second;
1264
+ # ifdef MMKV_IOS
1265
+ auto ret = guardForBackgroundWriting(ptr + Fixed32Size, totalSize);
1266
+ if (!ret.first) {
1267
+ return false;
1268
+ }
1269
+ # endif
1270
+
1271
+ uint8_t newIV[AES_KEY_LEN];
1272
+ auto encrypter = (newCrypter == InvalidCryptPtr) ? nullptr : (newCrypter ? newCrypter : m_crypter);
1273
+ if (encrypter) {
1274
+ AESCrypt::fillRandomIV(newIV);
1275
+ encrypter->resetIV(newIV, sizeof(newIV));
1276
+ }
1277
+
1278
+ delete m_output;
1279
+ m_output = new CodedOutputData(ptr + Fixed32Size, m_file->getFileSize() - Fixed32Size);
1280
+ if (m_crypter) {
1281
+ auto decrypter = m_crypter;
1282
+ memmoveDictionary(*m_dicCrypt, m_output, ptr, decrypter, encrypter, prepared);
1283
+ } else if (prepared.first.length() != 0) {
1284
+ auto &preparedData = prepared.first;
1285
+ fullWriteBackWholeData(std::move(preparedData), totalSize, m_output);
1286
+ if (encrypter) {
1287
+ encrypter->encrypt(ptr + Fixed32Size, ptr + Fixed32Size, totalSize);
1288
+ }
1289
+ } else {
1290
+ memmoveDictionary(*m_dic, m_output, ptr, encrypter, totalSize);
1291
+ }
1292
+
1293
+ m_actualSize = totalSize;
1294
+ if (encrypter) {
1295
+ recalculateCRCDigestWithIV(newIV);
1296
+ } else {
1297
+ recalculateCRCDigestWithIV(nullptr);
1298
+ }
1299
+ m_hasFullWriteback = true;
1300
+ // make sure lastConfirmedMetaInfo is saved if needed
1301
+ if (needSync) {
1302
+ sync(MMKV_SYNC);
1303
+ }
1304
+ return true;
1305
+ }
1306
+
1307
+ #else // MMKV_DISABLE_CRYPT
1308
+
1309
+ bool MMKV::doFullWriteBack(pair<MMBuffer, size_t> prepared, AESCrypt *, bool needSync) {
1310
+ auto ptr = (uint8_t *) m_file->getMemory();
1311
+ auto totalSize = prepared.second;
1312
+ # ifdef MMKV_IOS
1313
+ auto ret = guardForBackgroundWriting(ptr + Fixed32Size, totalSize);
1314
+ if (!ret.first) {
1315
+ return false;
1316
+ }
1317
+ # endif
1318
+
1319
+ delete m_output;
1320
+ m_output = new CodedOutputData(ptr + Fixed32Size, m_file->getFileSize() - Fixed32Size);
1321
+ if (prepared.first.length() != 0) {
1322
+ auto &preparedData = prepared.first;
1323
+ fullWriteBackWholeData(std::move(preparedData), totalSize, m_output);
1324
+ } else {
1325
+ constexpr AESCrypt *encrypter = nullptr;
1326
+ memmoveDictionary(*m_dic, m_output, ptr, encrypter, totalSize);
1327
+ }
1328
+
1329
+ m_actualSize = totalSize;
1330
+ recalculateCRCDigestWithIV(nullptr);
1331
+ m_hasFullWriteback = true;
1332
+ // make sure lastConfirmedMetaInfo is saved if needed
1333
+ if (needSync) {
1334
+ sync(MMKV_SYNC);
1335
+ }
1336
+ return true;
1337
+ }
1338
+ #endif // MMKV_DISABLE_CRYPT
1339
+
1340
+ #ifndef MMKV_DISABLE_CRYPT
1341
+ bool MMKV::reKey(const string &cryptKey) {
1342
+ SCOPED_LOCK(m_lock);
1343
+ SCOPED_LOCK(m_exclusiveProcessLock);
1344
+ checkLoadData();
1345
+ if (!isFileValid()) {
1346
+ MMKVWarning("[%s] file not valid", m_mmapID.c_str());
1347
+ return false;
1348
+ }
1349
+ if (isReadOnly()) {
1350
+ MMKVWarning("[%s] file readonly", m_mmapID.c_str());
1351
+ return false;
1352
+ }
1353
+
1354
+ bool ret = false;
1355
+ if (m_crypter) {
1356
+ if (cryptKey.length() > 0) {
1357
+ string oldKey = this->cryptKey();
1358
+ if (cryptKey == oldKey) {
1359
+ return true;
1360
+ } else {
1361
+ // change encryption key
1362
+ MMKVInfo("reKey with new aes key");
1363
+ auto newCrypt = new AESCrypt(cryptKey.data(), cryptKey.length());
1364
+ m_hasFullWriteback = false;
1365
+ ret = fullWriteback(newCrypt);
1366
+ if (ret) {
1367
+ delete m_crypter;
1368
+ m_crypter = newCrypt;
1369
+ } else {
1370
+ delete newCrypt;
1371
+ }
1372
+ }
1373
+ } else {
1374
+ // decryption to plain text
1375
+ MMKVInfo("reKey to no aes key");
1376
+ m_hasFullWriteback = false;
1377
+ ret = fullWriteback(InvalidCryptPtr);
1378
+ if (ret) {
1379
+ delete m_crypter;
1380
+ m_crypter = nullptr;
1381
+ if (!m_dic) {
1382
+ m_dic = new MMKVMap();
1383
+ }
1384
+ }
1385
+ }
1386
+ } else {
1387
+ if (cryptKey.length() > 0) {
1388
+ // transform plain text to encrypted text
1389
+ MMKVInfo("reKey to a aes key");
1390
+ m_hasFullWriteback = false;
1391
+ auto newCrypt = new AESCrypt(cryptKey.data(), cryptKey.length());
1392
+ ret = fullWriteback(newCrypt);
1393
+ if (ret) {
1394
+ m_crypter = newCrypt;
1395
+ if (!m_dicCrypt) {
1396
+ m_dicCrypt = new MMKVMapCrypt();
1397
+ }
1398
+ } else {
1399
+ delete newCrypt;
1400
+ }
1401
+ } else {
1402
+ return true;
1403
+ }
1404
+ }
1405
+ // m_dic or m_dicCrypt is not valid after reKey
1406
+ if (ret) {
1407
+ clearMemoryCache();
1408
+ }
1409
+ return ret;
1410
+ }
1411
+ #endif
1412
+
1413
+ void MMKV::trim() {
1414
+ SCOPED_LOCK(m_lock);
1415
+ MMKVInfo("prepare to trim %s", m_mmapID.c_str());
1416
+
1417
+ SCOPED_LOCK(m_exclusiveProcessLock);
1418
+ checkLoadData();
1419
+ if (!isFileValid()) {
1420
+ MMKVWarning("[%s] file not valid", m_mmapID.c_str());
1421
+ return;
1422
+ }
1423
+ if (isReadOnly()) {
1424
+ MMKVWarning("[%s] file readonly", m_mmapID.c_str());
1425
+ return;
1426
+ }
1427
+
1428
+ if (m_actualSize == 0) {
1429
+ clearAll();
1430
+ return;
1431
+ } else if (m_file->getFileSize() <= m_expectedCapacity) {
1432
+ return;
1433
+ }
1434
+
1435
+ fullWriteback();
1436
+ auto oldSize = m_file->getFileSize();
1437
+ auto fileSize = oldSize;
1438
+ while (fileSize > (m_actualSize + Fixed32Size) * 2) {
1439
+ fileSize /= 2;
1440
+ }
1441
+ fileSize = std::max<size_t>(fileSize, m_expectedCapacity);
1442
+ if (oldSize == fileSize) {
1443
+ MMKVInfo("there's no need to trim %s with size %zu, actualSize %zu", m_mmapID.c_str(), fileSize, m_actualSize);
1444
+ return;
1445
+ }
1446
+
1447
+ MMKVInfo("trimming %s from %zu to %zu, actualSize %zu", m_mmapID.c_str(), oldSize, fileSize, m_actualSize);
1448
+
1449
+ if (!m_file->truncate(fileSize)) {
1450
+ return;
1451
+ }
1452
+ fileSize = m_file->getFileSize();
1453
+ auto ptr = (uint8_t *) m_file->getMemory();
1454
+ delete m_output;
1455
+ m_output = new CodedOutputData(ptr + pbFixed32Size(), fileSize - Fixed32Size);
1456
+ m_output->seek(m_actualSize);
1457
+
1458
+ MMKVInfo("finish trim %s from %zu to %zu", m_mmapID.c_str(), oldSize, fileSize);
1459
+ }
1460
+
1461
+ void MMKV::clearAll(bool keepSpace) {
1462
+ MMKVInfo("cleaning all key-values from [%s]", m_mmapID.c_str());
1463
+ SCOPED_LOCK(m_lock);
1464
+ SCOPED_LOCK(m_exclusiveProcessLock);
1465
+
1466
+ checkLoadData();
1467
+ if (!isFileValid()) {
1468
+ MMKVWarning("[%s] file not valid", m_mmapID.c_str());
1469
+ return;
1470
+ }
1471
+ if (isReadOnly()) {
1472
+ MMKVWarning("[%s] file readonly", m_mmapID.c_str());
1473
+ return;
1474
+ }
1475
+
1476
+ if (m_file->getFileSize() == m_expectedCapacity && m_actualSize == 0) {
1477
+ MMKVInfo("nothing to clear for [%s]", m_mmapID.c_str());
1478
+ return;
1479
+ }
1480
+
1481
+ if (!keepSpace) {
1482
+ m_file->truncate(m_expectedCapacity);
1483
+ }
1484
+
1485
+ #ifndef MMKV_DISABLE_CRYPT
1486
+ uint8_t newIV[AES_KEY_LEN];
1487
+ AESCrypt::fillRandomIV(newIV);
1488
+ if (m_crypter) {
1489
+ m_crypter->resetIV(newIV, sizeof(newIV));
1490
+ }
1491
+ writeActualSize(0, 0, newIV, IncreaseSequence);
1492
+ #else
1493
+ writeActualSize(0, 0, nullptr, IncreaseSequence);
1494
+ #endif
1495
+
1496
+ m_metaFile->msync(MMKV_SYNC);
1497
+
1498
+ clearMemoryCache(keepSpace);
1499
+ loadFromFile();
1500
+ }
1501
+
1502
+ bool MMKV::isFileValid(const string &mmapID, MMKVPath_t *relatePath) {
1503
+ MMKVPath_t kvPath = mappedKVPathWithID(mmapID, MMKV_SINGLE_PROCESS, relatePath);
1504
+ if (!isFileExist(kvPath)) {
1505
+ return true;
1506
+ }
1507
+
1508
+ MMKVPath_t crcPath = crcPathWithID(mmapID, MMKV_SINGLE_PROCESS, relatePath);
1509
+ if (!isFileExist(crcPath)) {
1510
+ return false;
1511
+ }
1512
+
1513
+ uint32_t crcFile = 0;
1514
+ MMBuffer *data = readWholeFile(crcPath);
1515
+ if (data) {
1516
+ if (data->getPtr()) {
1517
+ MMKVMetaInfo metaInfo;
1518
+ metaInfo.read(data->getPtr());
1519
+ crcFile = metaInfo.m_crcDigest;
1520
+ }
1521
+ delete data;
1522
+ } else {
1523
+ return false;
1524
+ }
1525
+
1526
+ uint32_t crcDigest = 0;
1527
+ MMBuffer *fileData = readWholeFile(kvPath);
1528
+ if (fileData) {
1529
+ if (fileData->getPtr() && (fileData->length() >= Fixed32Size)) {
1530
+ uint32_t actualSize = 0;
1531
+ memcpy(&actualSize, fileData->getPtr(), Fixed32Size);
1532
+ if (actualSize > (fileData->length() - Fixed32Size)) {
1533
+ delete fileData;
1534
+ return false;
1535
+ }
1536
+
1537
+ crcDigest = (uint32_t) CRC32(0, (const uint8_t *) fileData->getPtr() + Fixed32Size, (uint32_t) actualSize);
1538
+ }
1539
+ delete fileData;
1540
+ return crcFile == crcDigest;
1541
+ } else {
1542
+ return false;
1543
+ }
1544
+ }
1545
+
1546
+ bool MMKV::removeStorage(const std::string &mmapID, MMKVPath_t *relatePath) {
1547
+ if (!g_instanceLock) {
1548
+ return false;
1549
+ }
1550
+ auto mmapKey = mmapedKVKey(mmapID, relatePath);
1551
+ #ifdef MMKV_ANDROID
1552
+ auto &realID = mmapKey; // historically Android mistakenly use mmapKey as mmapID
1553
+ #else
1554
+ auto &realID = mmapID;
1555
+ #endif
1556
+ MMKVDebug("mmapKey %s", mmapKey.c_str());
1557
+
1558
+ MMKVPath_t kvPath = mappedKVPathWithID(realID, MMKV_SINGLE_PROCESS, relatePath);
1559
+ if (!isFileExist(kvPath)) {
1560
+ MMKVWarning("file not exist %s", kvPath.c_str());
1561
+ return false;
1562
+ }
1563
+ MMKVPath_t crcPath = crcPathWithID(realID, MMKV_SINGLE_PROCESS, relatePath);
1564
+ if (!isFileExist(crcPath)) {
1565
+ MMKVWarning("file not exist %s", crcPath.c_str());
1566
+ return false;
1567
+ }
1568
+
1569
+ MMKVInfo("remove storage [%s]", mmapID.c_str());
1570
+ SCOPED_LOCK(g_instanceLock);
1571
+
1572
+ File crcFile(crcPath, OpenFlag::ReadOnly);
1573
+ if (!crcFile.isFileValid()) {
1574
+ return false;
1575
+ }
1576
+ FileLock fileLock(crcFile.getFd());
1577
+ InterProcessLock lock(&fileLock, ExclusiveLockType);
1578
+ SCOPED_LOCK(&lock);
1579
+
1580
+ auto itr = g_instanceDic->find(mmapKey);
1581
+ if (itr != g_instanceDic->end()) {
1582
+ itr->second->close();
1583
+ // itr is not valid after this
1584
+ }
1585
+
1586
+ #ifndef MMKV_WIN32
1587
+ ::unlink(kvPath.c_str());
1588
+ ::unlink(crcPath.c_str());
1589
+ #else
1590
+ DeleteFile(kvPath.c_str());
1591
+ DeleteFile(crcPath.c_str());
1592
+ #endif
1593
+
1594
+ return true;
1595
+ }
1596
+
1597
+ // ---- auto expire ----
1598
+
1599
+ uint32_t MMKV::getCurrentTimeInSecond() {
1600
+ auto time = ::time(nullptr);
1601
+ return static_cast<uint32_t>(time);
1602
+ }
1603
+
1604
+ bool MMKV::doFullWriteBack(MMKVVector &&vec) {
1605
+ auto preparedData = prepareEncode(std::move(vec));
1606
+
1607
+ // must clean before write-back and after prepareEncode()
1608
+ if (m_crypter) {
1609
+ clearDictionary(m_dicCrypt);
1610
+ } else {
1611
+ clearDictionary(m_dic);
1612
+ }
1613
+
1614
+ bool ret = false;
1615
+ auto sizeOfDic = preparedData.second;
1616
+ auto fileSize = m_file->getFileSize();
1617
+ if (sizeOfDic + Fixed32Size <= fileSize) {
1618
+ ret = doFullWriteBack(std::move(preparedData), nullptr);
1619
+ } else {
1620
+ // expandAndWriteBack() will extend file & full rewrite, no need to write back again
1621
+ auto newSize = sizeOfDic + Fixed32Size - fileSize;
1622
+ ret = expandAndWriteBack(newSize, std::move(preparedData));
1623
+ }
1624
+
1625
+ clearMemoryCache();
1626
+ return ret;
1627
+ }
1628
+
1629
+ bool MMKV::enableAutoKeyExpire(uint32_t expiredInSeconds) {
1630
+ SCOPED_LOCK(m_lock);
1631
+ SCOPED_LOCK(m_exclusiveProcessLock);
1632
+ checkLoadData();
1633
+ if (!isFileValid() || !m_metaFile->isFileValid()) {
1634
+ MMKVWarning("[%s] file not valid", m_mmapID.c_str());
1635
+ return false;
1636
+ }
1637
+
1638
+ if (m_enableCompareBeforeSet) {
1639
+ MMKVError("enableCompareBeforeSet will be invalid when Expiration is on");
1640
+ m_enableCompareBeforeSet = false;
1641
+ }
1642
+
1643
+ if (m_expiredInSeconds != expiredInSeconds) {
1644
+ MMKVInfo("expiredInSeconds: %u", expiredInSeconds);
1645
+ m_expiredInSeconds = expiredInSeconds;
1646
+ }
1647
+ m_enableKeyExpire = true;
1648
+ if (m_metaInfo->hasFlag(MMKVMetaInfo::EnableKeyExipre)) {
1649
+ return true;
1650
+ }
1651
+ if (isReadOnly()) {
1652
+ MMKVWarning("[%s] file readonly", m_mmapID.c_str());
1653
+ return false;
1654
+ }
1655
+
1656
+ auto autoRecordExpireTime = (m_expiredInSeconds != 0);
1657
+ auto time = autoRecordExpireTime ? getCurrentTimeInSecond() + m_expiredInSeconds : 0;
1658
+ MMKVInfo("turn on recording expire date for all keys inside [%s] from now %u", m_mmapID.c_str(), time);
1659
+ m_metaInfo->setFlag(MMKVMetaInfo::EnableKeyExipre);
1660
+ m_metaInfo->m_version = MMKVVersionFlag;
1661
+
1662
+ if (m_file->getFileSize() == m_expectedCapacity && m_actualSize == 0) {
1663
+ MMKVInfo("file is new, don't need a full writeback [%s], just update meta file", m_mmapID.c_str());
1664
+ writeActualSize(0, 0, nullptr, IncreaseSequence);
1665
+ m_metaFile->msync(MMKV_SYNC);
1666
+ return true;
1667
+ }
1668
+
1669
+ MMKVVector vec;
1670
+ auto packKeyValue = [&](const MMKVKey_t &key, const MMBuffer &value) {
1671
+ MMBuffer data(value.length() + Fixed32Size);
1672
+ auto ptr = (uint8_t *) data.getPtr();
1673
+ memcpy(ptr, value.getPtr(), value.length());
1674
+ memcpy(ptr + value.length(), &time, Fixed32Size);
1675
+ vec.emplace_back(key, std::move(data));
1676
+ };
1677
+
1678
+ auto basePtr = (uint8_t *) (m_file->getMemory()) + Fixed32Size;
1679
+ #ifndef MMKV_DISABLE_CRYPT
1680
+ if (m_crypter) {
1681
+ for (auto &pair : *m_dicCrypt) {
1682
+ auto &key = pair.first;
1683
+ auto &value = pair.second;
1684
+ auto buffer = value.toMMBuffer(basePtr, m_crypter);
1685
+ packKeyValue(key, buffer);
1686
+ }
1687
+ } else
1688
+ #endif
1689
+ {
1690
+ for (auto &pair : *m_dic) {
1691
+ auto &key = pair.first;
1692
+ auto &value = pair.second;
1693
+ auto buffer = value.toMMBuffer(basePtr);
1694
+ packKeyValue(key, buffer);
1695
+ }
1696
+ }
1697
+
1698
+ return doFullWriteBack(std::move(vec));
1699
+ }
1700
+
1701
+ bool MMKV::disableAutoKeyExpire() {
1702
+ SCOPED_LOCK(m_lock);
1703
+ SCOPED_LOCK(m_exclusiveProcessLock);
1704
+ checkLoadData();
1705
+ if (!isFileValid() || !m_metaFile->isFileValid()) {
1706
+ MMKVWarning("[%s] file not valid", m_mmapID.c_str());
1707
+ return false;
1708
+ }
1709
+
1710
+ m_expiredInSeconds = 0;
1711
+ m_enableKeyExpire = false;
1712
+ if (!m_metaInfo->hasFlag(MMKVMetaInfo::EnableKeyExipre)) {
1713
+ return true;
1714
+ }
1715
+ if (isReadOnly()) {
1716
+ MMKVWarning("[%s] file readonly", m_mmapID.c_str());
1717
+ return false;
1718
+ }
1719
+
1720
+ MMKVInfo("erase previous recorded expire date for all keys inside [%s]", m_mmapID.c_str());
1721
+ m_metaInfo->unsetFlag(MMKVMetaInfo::EnableKeyExipre);
1722
+ m_metaInfo->m_version = MMKVVersionFlag;
1723
+
1724
+ if (m_file->getFileSize() == m_expectedCapacity && m_actualSize == 0) {
1725
+ MMKVInfo("file is new, don't need a full write-back [%s], just update meta file", m_mmapID.c_str());
1726
+ writeActualSize(0, 0, nullptr, IncreaseSequence);
1727
+ m_metaFile->msync(MMKV_SYNC);
1728
+ return true;
1729
+ }
1730
+
1731
+ MMKVVector vec;
1732
+ auto packKeyValue = [&](const MMKVKey_t &key, const MMBuffer &value) {
1733
+ assert(value.length() >= Fixed32Size);
1734
+ MMBuffer data(value.length() - Fixed32Size);
1735
+ auto ptr = (uint8_t *) data.getPtr();
1736
+ memcpy(ptr, value.getPtr(), value.length() - Fixed32Size);
1737
+ vec.emplace_back(key, std::move(data));
1738
+ };
1739
+
1740
+ auto basePtr = (uint8_t *) (m_file->getMemory()) + Fixed32Size;
1741
+ #ifndef MMKV_DISABLE_CRYPT
1742
+ if (m_crypter) {
1743
+ for (auto &pair : *m_dicCrypt) {
1744
+ auto &key = pair.first;
1745
+ auto &value = pair.second;
1746
+ auto buffer = value.toMMBuffer(basePtr, m_crypter);
1747
+ packKeyValue(key, buffer);
1748
+ }
1749
+ } else
1750
+ #endif
1751
+ {
1752
+ for (auto &pair : *m_dic) {
1753
+ auto &key = pair.first;
1754
+ auto &value = pair.second;
1755
+ auto buffer = value.toMMBuffer(basePtr);
1756
+ packKeyValue(key, buffer);
1757
+ }
1758
+ }
1759
+
1760
+ return doFullWriteBack(std::move(vec));
1761
+ }
1762
+
1763
+ uint32_t MMKV::getExpireTimeForKey(MMKVKey_t key) {
1764
+ SCOPED_LOCK(m_lock);
1765
+ SCOPED_LOCK(m_sharedProcessLock);
1766
+ checkLoadData();
1767
+
1768
+ if (!m_enableKeyExpire || mmkv_key_length(key) == 0) {
1769
+ return 0;
1770
+ }
1771
+ auto raw = getRawDataForKey(key);
1772
+ assert(raw.length() == 0 || raw.length() >= Fixed32Size);
1773
+ if (raw.length() < Fixed32Size) {
1774
+ return 0;
1775
+ }
1776
+ auto ptr = (const uint8_t *) raw.getPtr() + raw.length() - Fixed32Size;
1777
+ auto time = *(const uint32_t *) ptr;
1778
+ return time;
1779
+ }
1780
+
1781
+ mmkv::MMBuffer MMKV::getDataWithoutMTimeForKey(MMKVKey_t key) {
1782
+ SCOPED_LOCK(m_lock);
1783
+ SCOPED_LOCK(m_sharedProcessLock);
1784
+ checkLoadData();
1785
+
1786
+ auto raw = getRawDataForKey(key);
1787
+ assert(raw.length() == 0 || raw.length() >= Fixed32Size);
1788
+ if (raw.length() < Fixed32Size) {
1789
+ return raw;
1790
+ }
1791
+ auto newLength = raw.length() - Fixed32Size;
1792
+ if (m_enableKeyExpire) {
1793
+ auto ptr = (const uint8_t *) raw.getPtr() + newLength;
1794
+ auto time = *(const uint32_t *) ptr;
1795
+ if (time != ExpireNever && time <= getCurrentTimeInSecond()) {
1796
+ #ifdef MMKV_APPLE
1797
+ MMKVInfo("deleting expired key [%@] in mmkv [%s], due date %u", key, m_mmapID.c_str(), time);
1798
+ #else
1799
+ MMKVInfo("deleting expired key [%s] in mmkv [%s], due date %u", key.data(), m_mmapID.c_str(), time);
1800
+ #endif
1801
+ removeValueForKey(key);
1802
+ return MMBuffer();
1803
+ }
1804
+ }
1805
+ return MMBuffer(std::move(raw), newLength);
1806
+ }
1807
+
1808
+ #define NOOP ((void) 0)
1809
+
1810
+ size_t MMKV::filterExpiredKeys() {
1811
+ if (!m_enableKeyExpire || (m_crypter ? m_dicCrypt->empty() : m_dic->empty())) {
1812
+ return 0;
1813
+ }
1814
+ SCOPED_LOCK(m_sharedProcessLock);
1815
+
1816
+ auto now = getCurrentTimeInSecond();
1817
+ MMKVInfo("filtering expired keys inside [%s] now: %u, m_expiredInSeconds: %u", m_mmapID.c_str(), now,
1818
+ m_expiredInSeconds);
1819
+
1820
+ size_t count = 0;
1821
+ auto basePtr = (uint8_t *) (m_file->getMemory()) + Fixed32Size;
1822
+ #ifndef MMKV_DISABLE_CRYPT
1823
+ if (m_crypter) {
1824
+ for (auto itr = m_dicCrypt->begin(); itr != m_dicCrypt->end(); NOOP) {
1825
+ auto &kvHolder = itr->second;
1826
+ assert(kvHolder.realValueSize() >= Fixed32Size);
1827
+ auto buffer = kvHolder.toMMBuffer(basePtr, m_crypter);
1828
+ auto ptr = (uint8_t *) buffer.getPtr();
1829
+ ptr += buffer.length() - Fixed32Size;
1830
+ auto time = *(const uint32_t *) ptr;
1831
+ if (time != ExpireNever && time <= now) {
1832
+ auto oldKey = itr->first;
1833
+ itr = m_dicCrypt->erase(itr);
1834
+ # ifdef MMKV_APPLE
1835
+ MMKVInfo("deleting expired key [%@], due date %u", oldKey, time);
1836
+ [oldKey release];
1837
+ # else
1838
+ MMKVInfo("deleting expired key [%s], due date %u", oldKey.c_str(), time);
1839
+ # endif
1840
+ count++;
1841
+ } else {
1842
+ itr++;
1843
+ }
1844
+ }
1845
+ } else
1846
+ #endif // !MMKV_DISABLE_CRYPT
1847
+ {
1848
+ for (auto itr = m_dic->begin(); itr != m_dic->end(); NOOP) {
1849
+ auto &kvHolder = itr->second;
1850
+ assert(kvHolder.valueSize >= Fixed32Size);
1851
+ auto ptr = basePtr + kvHolder.offset + kvHolder.computedKVSize;
1852
+ ptr += kvHolder.valueSize - Fixed32Size;
1853
+ auto time = *(const uint32_t *) ptr;
1854
+ if (time != ExpireNever && time <= now) {
1855
+ auto oldKey = itr->first;
1856
+ itr = m_dic->erase(itr);
1857
+ #ifdef MMKV_APPLE
1858
+ MMKVInfo("deleting expired key [%@], due date %u", oldKey, time);
1859
+ [oldKey release];
1860
+ #else
1861
+ MMKVInfo("deleting expired key [%s], due date %u", oldKey.c_str(), time);
1862
+ #endif
1863
+ count++;
1864
+ } else {
1865
+ itr++;
1866
+ }
1867
+ }
1868
+ }
1869
+ if (count != 0) {
1870
+ MMKVInfo("deleted %zu expired keys inside [%s]", count, m_mmapID.c_str());
1871
+ }
1872
+ return count;
1873
+ }
1874
+
1875
+ bool MMKV::enableCompareBeforeSet() {
1876
+ MMKVInfo("enableCompareBeforeSet for [%s]", m_mmapID.c_str());
1877
+ SCOPED_LOCK(m_lock);
1878
+ SCOPED_LOCK(m_exclusiveProcessLock);
1879
+
1880
+ assert(!m_enableKeyExpire && "enableCompareBeforeSet is invalid when Expiration is on");
1881
+ assert(!m_dicCrypt && "enableCompareBeforeSet is invalid when key encryption is on");
1882
+ if (m_enableKeyExpire || m_dicCrypt) {
1883
+ return false;
1884
+ }
1885
+
1886
+ m_enableCompareBeforeSet = true;
1887
+ return true;
1888
+ }
1889
+
1890
+ bool MMKV::disableCompareBeforeSet() {
1891
+ MMKVInfo("disableCompareBeforeSet for [%s]", m_mmapID.c_str());
1892
+ SCOPED_LOCK(m_lock);
1893
+ SCOPED_LOCK(m_exclusiveProcessLock);
1894
+
1895
+ assert(!m_enableKeyExpire && "disableCompareBeforeSet is invalid when Expiration is on");
1896
+ assert(!m_dicCrypt && "disableCompareBeforeSet is invalid when key encryption is on");
1897
+ if (m_enableKeyExpire || m_dicCrypt) {
1898
+ return false;
1899
+ }
1900
+
1901
+ m_enableCompareBeforeSet = false;
1902
+ return true;
1903
+ }
1904
+
1905
+ MMKV_NAMESPACE_END