@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,2604 @@
1
+ /*
2
+ pybind11/pytypes.h: Convenience wrapper classes for basic Python types
3
+
4
+ Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>
5
+
6
+ All rights reserved. Use of this source code is governed by a
7
+ BSD-style license that can be found in the LICENSE file.
8
+ */
9
+
10
+ #pragma once
11
+
12
+ #include "detail/common.h"
13
+ #include "buffer_info.h"
14
+
15
+ #include <assert.h>
16
+ #include <cstddef>
17
+ #include <exception>
18
+ #include <frameobject.h>
19
+ #include <iterator>
20
+ #include <memory>
21
+ #include <string>
22
+ #include <type_traits>
23
+ #include <typeinfo>
24
+ #include <utility>
25
+
26
+ #if defined(PYBIND11_HAS_OPTIONAL)
27
+ # include <optional>
28
+ #endif
29
+
30
+ #ifdef PYBIND11_HAS_STRING_VIEW
31
+ # include <string_view>
32
+ #endif
33
+
34
+ PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
35
+
36
+ PYBIND11_WARNING_DISABLE_MSVC(4127)
37
+
38
+ /* A few forward declarations */
39
+ class handle;
40
+ class object;
41
+ class str;
42
+ class iterator;
43
+ class type;
44
+ struct arg;
45
+ struct arg_v;
46
+
47
+ PYBIND11_NAMESPACE_BEGIN(detail)
48
+ class args_proxy;
49
+ bool isinstance_generic(handle obj, const std::type_info &tp);
50
+
51
+ // Accessor forward declarations
52
+ template <typename Policy>
53
+ class accessor;
54
+ namespace accessor_policies {
55
+ struct obj_attr;
56
+ struct str_attr;
57
+ struct generic_item;
58
+ struct sequence_item;
59
+ struct list_item;
60
+ struct tuple_item;
61
+ } // namespace accessor_policies
62
+ // PLEASE KEEP handle_type_name SPECIALIZATIONS IN SYNC.
63
+ using obj_attr_accessor = accessor<accessor_policies::obj_attr>;
64
+ using str_attr_accessor = accessor<accessor_policies::str_attr>;
65
+ using item_accessor = accessor<accessor_policies::generic_item>;
66
+ using sequence_accessor = accessor<accessor_policies::sequence_item>;
67
+ using list_accessor = accessor<accessor_policies::list_item>;
68
+ using tuple_accessor = accessor<accessor_policies::tuple_item>;
69
+
70
+ /// Tag and check to identify a class which implements the Python object API
71
+ class pyobject_tag {};
72
+ template <typename T>
73
+ using is_pyobject = std::is_base_of<pyobject_tag, remove_reference_t<T>>;
74
+
75
+ /** \rst
76
+ A mixin class which adds common functions to `handle`, `object` and various accessors.
77
+ The only requirement for `Derived` is to implement ``PyObject *Derived::ptr() const``.
78
+ \endrst */
79
+ template <typename Derived>
80
+ class object_api : public pyobject_tag {
81
+ const Derived &derived() const { return static_cast<const Derived &>(*this); }
82
+
83
+ public:
84
+ /** \rst
85
+ Return an iterator equivalent to calling ``iter()`` in Python. The object
86
+ must be a collection which supports the iteration protocol.
87
+ \endrst */
88
+ iterator begin() const;
89
+ /// Return a sentinel which ends iteration.
90
+ iterator end() const;
91
+
92
+ /** \rst
93
+ Return an internal functor to invoke the object's sequence protocol. Casting
94
+ the returned ``detail::item_accessor`` instance to a `handle` or `object`
95
+ subclass causes a corresponding call to ``__getitem__``. Assigning a `handle`
96
+ or `object` subclass causes a call to ``__setitem__``.
97
+ \endrst */
98
+ item_accessor operator[](handle key) const;
99
+ /// See above (the only difference is that the key's reference is stolen)
100
+ item_accessor operator[](object &&key) const;
101
+ /// See above (the only difference is that the key is provided as a string literal)
102
+ item_accessor operator[](const char *key) const;
103
+
104
+ /** \rst
105
+ Return an internal functor to access the object's attributes. Casting the
106
+ returned ``detail::obj_attr_accessor`` instance to a `handle` or `object`
107
+ subclass causes a corresponding call to ``getattr``. Assigning a `handle`
108
+ or `object` subclass causes a call to ``setattr``.
109
+ \endrst */
110
+ obj_attr_accessor attr(handle key) const;
111
+ /// See above (the only difference is that the key's reference is stolen)
112
+ obj_attr_accessor attr(object &&key) const;
113
+ /// See above (the only difference is that the key is provided as a string literal)
114
+ str_attr_accessor attr(const char *key) const;
115
+
116
+ /** \rst
117
+ Matches * unpacking in Python, e.g. to unpack arguments out of a ``tuple``
118
+ or ``list`` for a function call. Applying another * to the result yields
119
+ ** unpacking, e.g. to unpack a dict as function keyword arguments.
120
+ See :ref:`calling_python_functions`.
121
+ \endrst */
122
+ args_proxy operator*() const;
123
+
124
+ /// Check if the given item is contained within this object, i.e. ``item in obj``.
125
+ template <typename T>
126
+ bool contains(T &&item) const;
127
+
128
+ /** \rst
129
+ Assuming the Python object is a function or implements the ``__call__``
130
+ protocol, ``operator()`` invokes the underlying function, passing an
131
+ arbitrary set of parameters. The result is returned as a `object` and
132
+ may need to be converted back into a Python object using `handle::cast()`.
133
+
134
+ When some of the arguments cannot be converted to Python objects, the
135
+ function will throw a `cast_error` exception. When the Python function
136
+ call fails, a `error_already_set` exception is thrown.
137
+ \endrst */
138
+ template <return_value_policy policy = return_value_policy::automatic_reference,
139
+ typename... Args>
140
+ object operator()(Args &&...args) const;
141
+ template <return_value_policy policy = return_value_policy::automatic_reference,
142
+ typename... Args>
143
+ PYBIND11_DEPRECATED("call(...) was deprecated in favor of operator()(...)")
144
+ object call(Args &&...args) const;
145
+
146
+ /// Equivalent to ``obj is other`` in Python.
147
+ bool is(object_api const &other) const { return derived().ptr() == other.derived().ptr(); }
148
+ /// Equivalent to ``obj is None`` in Python.
149
+ bool is_none() const { return derived().ptr() == Py_None; }
150
+ /// Equivalent to obj == other in Python
151
+ bool equal(object_api const &other) const { return rich_compare(other, Py_EQ); }
152
+ bool not_equal(object_api const &other) const { return rich_compare(other, Py_NE); }
153
+ bool operator<(object_api const &other) const { return rich_compare(other, Py_LT); }
154
+ bool operator<=(object_api const &other) const { return rich_compare(other, Py_LE); }
155
+ bool operator>(object_api const &other) const { return rich_compare(other, Py_GT); }
156
+ bool operator>=(object_api const &other) const { return rich_compare(other, Py_GE); }
157
+
158
+ object operator-() const;
159
+ object operator~() const;
160
+ object operator+(object_api const &other) const;
161
+ object operator+=(object_api const &other);
162
+ object operator-(object_api const &other) const;
163
+ object operator-=(object_api const &other);
164
+ object operator*(object_api const &other) const;
165
+ object operator*=(object_api const &other);
166
+ object operator/(object_api const &other) const;
167
+ object operator/=(object_api const &other);
168
+ object operator|(object_api const &other) const;
169
+ object operator|=(object_api const &other);
170
+ object operator&(object_api const &other) const;
171
+ object operator&=(object_api const &other);
172
+ object operator^(object_api const &other) const;
173
+ object operator^=(object_api const &other);
174
+ object operator<<(object_api const &other) const;
175
+ object operator<<=(object_api const &other);
176
+ object operator>>(object_api const &other) const;
177
+ object operator>>=(object_api const &other);
178
+
179
+ PYBIND11_DEPRECATED("Use py::str(obj) instead")
180
+ pybind11::str str() const;
181
+
182
+ /// Get or set the object's docstring, i.e. ``obj.__doc__``.
183
+ str_attr_accessor doc() const;
184
+
185
+ /// Return the object's current reference count
186
+ ssize_t ref_count() const {
187
+ #ifdef PYPY_VERSION
188
+ // PyPy uses the top few bits for REFCNT_FROM_PYPY & REFCNT_FROM_PYPY_LIGHT
189
+ // Following pybind11 2.12.1 and older behavior and removing this part
190
+ return static_cast<ssize_t>(static_cast<int>(Py_REFCNT(derived().ptr())));
191
+ #else
192
+ return Py_REFCNT(derived().ptr());
193
+ #endif
194
+ }
195
+
196
+ // TODO PYBIND11_DEPRECATED(
197
+ // "Call py::type::handle_of(h) or py::type::of(h) instead of h.get_type()")
198
+ handle get_type() const;
199
+
200
+ private:
201
+ bool rich_compare(object_api const &other, int value) const;
202
+ };
203
+
204
+ template <typename T>
205
+ using is_pyobj_ptr_or_nullptr_t = detail::any_of<std::is_same<T, PyObject *>,
206
+ std::is_same<T, PyObject *const>,
207
+ std::is_same<T, std::nullptr_t>>;
208
+
209
+ PYBIND11_NAMESPACE_END(detail)
210
+
211
+ #if !defined(PYBIND11_HANDLE_REF_DEBUG) && !defined(NDEBUG)
212
+ # define PYBIND11_HANDLE_REF_DEBUG
213
+ #endif
214
+
215
+ /** \rst
216
+ Holds a reference to a Python object (no reference counting)
217
+
218
+ The `handle` class is a thin wrapper around an arbitrary Python object (i.e. a
219
+ ``PyObject *`` in Python's C API). It does not perform any automatic reference
220
+ counting and merely provides a basic C++ interface to various Python API functions.
221
+
222
+ .. seealso::
223
+ The `object` class inherits from `handle` and adds automatic reference
224
+ counting features.
225
+ \endrst */
226
+ class handle : public detail::object_api<handle> {
227
+ public:
228
+ /// The default constructor creates a handle with a ``nullptr``-valued pointer
229
+ handle() = default;
230
+
231
+ /// Enable implicit conversion from ``PyObject *`` and ``nullptr``.
232
+ /// Not using ``handle(PyObject *ptr)`` to avoid implicit conversion from ``0``.
233
+ template <typename T,
234
+ detail::enable_if_t<detail::is_pyobj_ptr_or_nullptr_t<T>::value, int> = 0>
235
+ // NOLINTNEXTLINE(google-explicit-constructor)
236
+ handle(T ptr) : m_ptr(ptr) {}
237
+
238
+ /// Enable implicit conversion through ``T::operator PyObject *()``.
239
+ template <
240
+ typename T,
241
+ detail::enable_if_t<detail::all_of<detail::none_of<std::is_base_of<handle, T>,
242
+ detail::is_pyobj_ptr_or_nullptr_t<T>>,
243
+ std::is_convertible<T, PyObject *>>::value,
244
+ int>
245
+ = 0>
246
+ // NOLINTNEXTLINE(google-explicit-constructor)
247
+ handle(T &obj) : m_ptr(obj) {}
248
+
249
+ /// Return the underlying ``PyObject *`` pointer
250
+ PyObject *ptr() const { return m_ptr; }
251
+ PyObject *&ptr() { return m_ptr; }
252
+
253
+ /** \rst
254
+ Manually increase the reference count of the Python object. Usually, it is
255
+ preferable to use the `object` class which derives from `handle` and calls
256
+ this function automatically. Returns a reference to itself.
257
+ \endrst */
258
+ const handle &inc_ref() const & {
259
+ #ifdef PYBIND11_HANDLE_REF_DEBUG
260
+ inc_ref_counter(1);
261
+ #endif
262
+ #ifdef PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF
263
+ if (m_ptr != nullptr && !PyGILState_Check()) {
264
+ throw_gilstate_error("pybind11::handle::inc_ref()");
265
+ }
266
+ #endif
267
+ Py_XINCREF(m_ptr);
268
+ return *this;
269
+ }
270
+
271
+ /** \rst
272
+ Manually decrease the reference count of the Python object. Usually, it is
273
+ preferable to use the `object` class which derives from `handle` and calls
274
+ this function automatically. Returns a reference to itself.
275
+ \endrst */
276
+ const handle &dec_ref() const & {
277
+ #ifdef PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF
278
+ if (m_ptr != nullptr && !PyGILState_Check()) {
279
+ throw_gilstate_error("pybind11::handle::dec_ref()");
280
+ }
281
+ #endif
282
+ Py_XDECREF(m_ptr);
283
+ return *this;
284
+ }
285
+
286
+ /** \rst
287
+ Attempt to cast the Python object into the given C++ type. A `cast_error`
288
+ will be throw upon failure.
289
+ \endrst */
290
+ template <typename T>
291
+ T cast() const;
292
+ /// Return ``true`` when the `handle` wraps a valid Python object
293
+ explicit operator bool() const { return m_ptr != nullptr; }
294
+ /** \rst
295
+ Deprecated: Check that the underlying pointers are the same.
296
+ Equivalent to ``obj1 is obj2`` in Python.
297
+ \endrst */
298
+ PYBIND11_DEPRECATED("Use obj1.is(obj2) instead")
299
+ bool operator==(const handle &h) const { return m_ptr == h.m_ptr; }
300
+ PYBIND11_DEPRECATED("Use !obj1.is(obj2) instead")
301
+ bool operator!=(const handle &h) const { return m_ptr != h.m_ptr; }
302
+ PYBIND11_DEPRECATED("Use handle::operator bool() instead")
303
+ bool check() const { return m_ptr != nullptr; }
304
+
305
+ protected:
306
+ PyObject *m_ptr = nullptr;
307
+
308
+ private:
309
+ #ifdef PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF
310
+ void throw_gilstate_error(const std::string &function_name) const {
311
+ fprintf(
312
+ stderr,
313
+ "%s is being called while the GIL is either not held or invalid. Please see "
314
+ "https://pybind11.readthedocs.io/en/stable/advanced/"
315
+ "misc.html#common-sources-of-global-interpreter-lock-errors for debugging advice.\n"
316
+ "If you are convinced there is no bug in your code, you can #define "
317
+ "PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF "
318
+ "to disable this check. In that case you have to ensure this #define is consistently "
319
+ "used for all translation units linked into a given pybind11 extension, otherwise "
320
+ "there will be ODR violations.",
321
+ function_name.c_str());
322
+ if (Py_TYPE(m_ptr)->tp_name != nullptr) {
323
+ fprintf(stderr,
324
+ " The failing %s call was triggered on a %s object.",
325
+ function_name.c_str(),
326
+ Py_TYPE(m_ptr)->tp_name);
327
+ }
328
+ fprintf(stderr, "\n");
329
+ fflush(stderr);
330
+ throw std::runtime_error(function_name + " PyGILState_Check() failure.");
331
+ }
332
+ #endif
333
+
334
+ #ifdef PYBIND11_HANDLE_REF_DEBUG
335
+ static std::size_t inc_ref_counter(std::size_t add) {
336
+ thread_local std::size_t counter = 0;
337
+ counter += add;
338
+ return counter;
339
+ }
340
+
341
+ public:
342
+ static std::size_t inc_ref_counter() { return inc_ref_counter(0); }
343
+ #endif
344
+ };
345
+
346
+ inline void set_error(const handle &type, const char *message) {
347
+ PyErr_SetString(type.ptr(), message);
348
+ }
349
+
350
+ inline void set_error(const handle &type, const handle &value) {
351
+ PyErr_SetObject(type.ptr(), value.ptr());
352
+ }
353
+
354
+ /** \rst
355
+ Holds a reference to a Python object (with reference counting)
356
+
357
+ Like `handle`, the `object` class is a thin wrapper around an arbitrary Python
358
+ object (i.e. a ``PyObject *`` in Python's C API). In contrast to `handle`, it
359
+ optionally increases the object's reference count upon construction, and it
360
+ *always* decreases the reference count when the `object` instance goes out of
361
+ scope and is destructed. When using `object` instances consistently, it is much
362
+ easier to get reference counting right at the first attempt.
363
+ \endrst */
364
+ class object : public handle {
365
+ public:
366
+ object() = default;
367
+ PYBIND11_DEPRECATED("Use reinterpret_borrow<object>() or reinterpret_steal<object>()")
368
+ object(handle h, bool is_borrowed) : handle(h) {
369
+ if (is_borrowed) {
370
+ inc_ref();
371
+ }
372
+ }
373
+ /// Copy constructor; always increases the reference count
374
+ object(const object &o) : handle(o) { inc_ref(); }
375
+ /// Move constructor; steals the object from ``other`` and preserves its reference count
376
+ object(object &&other) noexcept : handle(other) { other.m_ptr = nullptr; }
377
+ /// Destructor; automatically calls `handle::dec_ref()`
378
+ ~object() { dec_ref(); }
379
+
380
+ /** \rst
381
+ Resets the internal pointer to ``nullptr`` without decreasing the
382
+ object's reference count. The function returns a raw handle to the original
383
+ Python object.
384
+ \endrst */
385
+ handle release() {
386
+ PyObject *tmp = m_ptr;
387
+ m_ptr = nullptr;
388
+ return handle(tmp);
389
+ }
390
+
391
+ object &operator=(const object &other) {
392
+ // Skip inc_ref and dec_ref if both objects are the same
393
+ if (!this->is(other)) {
394
+ other.inc_ref();
395
+ // Use temporary variable to ensure `*this` remains valid while
396
+ // `Py_XDECREF` executes, in case `*this` is accessible from Python.
397
+ handle temp(m_ptr);
398
+ m_ptr = other.m_ptr;
399
+ temp.dec_ref();
400
+ }
401
+ return *this;
402
+ }
403
+
404
+ object &operator=(object &&other) noexcept {
405
+ if (this != &other) {
406
+ handle temp(m_ptr);
407
+ m_ptr = other.m_ptr;
408
+ other.m_ptr = nullptr;
409
+ temp.dec_ref();
410
+ }
411
+ return *this;
412
+ }
413
+
414
+ #define PYBIND11_INPLACE_OP(iop) \
415
+ object iop(object_api const &other) { return operator=(handle::iop(other)); }
416
+
417
+ PYBIND11_INPLACE_OP(operator+=)
418
+ PYBIND11_INPLACE_OP(operator-=)
419
+ PYBIND11_INPLACE_OP(operator*=)
420
+ PYBIND11_INPLACE_OP(operator/=)
421
+ PYBIND11_INPLACE_OP(operator|=)
422
+ PYBIND11_INPLACE_OP(operator&=)
423
+ PYBIND11_INPLACE_OP(operator^=)
424
+ PYBIND11_INPLACE_OP(operator<<=)
425
+ PYBIND11_INPLACE_OP(operator>>=)
426
+ #undef PYBIND11_INPLACE_OP
427
+
428
+ // Calling cast() on an object lvalue just copies (via handle::cast)
429
+ template <typename T>
430
+ T cast() const &;
431
+ // Calling on an object rvalue does a move, if needed and/or possible
432
+ template <typename T>
433
+ T cast() &&;
434
+
435
+ protected:
436
+ // Tags for choosing constructors from raw PyObject *
437
+ struct borrowed_t {};
438
+ struct stolen_t {};
439
+
440
+ /// @cond BROKEN
441
+ template <typename T>
442
+ friend T reinterpret_borrow(handle);
443
+ template <typename T>
444
+ friend T reinterpret_steal(handle);
445
+ /// @endcond
446
+
447
+ public:
448
+ // Only accessible from derived classes and the reinterpret_* functions
449
+ object(handle h, borrowed_t) : handle(h) { inc_ref(); }
450
+ object(handle h, stolen_t) : handle(h) {}
451
+ };
452
+
453
+ /** \rst
454
+ Declare that a `handle` or ``PyObject *`` is a certain type and borrow the reference.
455
+ The target type ``T`` must be `object` or one of its derived classes. The function
456
+ doesn't do any conversions or checks. It's up to the user to make sure that the
457
+ target type is correct.
458
+
459
+ .. code-block:: cpp
460
+
461
+ PyObject *p = PyList_GetItem(obj, index);
462
+ py::object o = reinterpret_borrow<py::object>(p);
463
+ // or
464
+ py::tuple t = reinterpret_borrow<py::tuple>(p); // <-- `p` must be already be a `tuple`
465
+ \endrst */
466
+ template <typename T>
467
+ T reinterpret_borrow(handle h) {
468
+ return {h, object::borrowed_t{}};
469
+ }
470
+
471
+ /** \rst
472
+ Like `reinterpret_borrow`, but steals the reference.
473
+
474
+ .. code-block:: cpp
475
+
476
+ PyObject *p = PyObject_Str(obj);
477
+ py::str s = reinterpret_steal<py::str>(p); // <-- `p` must be already be a `str`
478
+ \endrst */
479
+ template <typename T>
480
+ T reinterpret_steal(handle h) {
481
+ return {h, object::stolen_t{}};
482
+ }
483
+
484
+ PYBIND11_NAMESPACE_BEGIN(detail)
485
+
486
+ // Equivalent to obj.__class__.__name__ (or obj.__name__ if obj is a class).
487
+ inline const char *obj_class_name(PyObject *obj) {
488
+ if (PyType_Check(obj)) {
489
+ return reinterpret_cast<PyTypeObject *>(obj)->tp_name;
490
+ }
491
+ return Py_TYPE(obj)->tp_name;
492
+ }
493
+
494
+ std::string error_string();
495
+
496
+ // The code in this struct is very unusual, to minimize the chances of
497
+ // masking bugs (elsewhere) by errors during the error handling (here).
498
+ // This is meant to be a lifeline for troubleshooting long-running processes
499
+ // that crash under conditions that are virtually impossible to reproduce.
500
+ // Low-level implementation alternatives are preferred to higher-level ones
501
+ // that might raise cascading exceptions. Last-ditch-kind-of attempts are made
502
+ // to report as much of the original error as possible, even if there are
503
+ // secondary issues obtaining some of the details.
504
+ struct error_fetch_and_normalize {
505
+ // This comment only applies to Python <= 3.11:
506
+ // Immediate normalization is long-established behavior (starting with
507
+ // https://github.com/pybind/pybind11/commit/135ba8deafb8bf64a15b24d1513899eb600e2011
508
+ // from Sep 2016) and safest. Normalization could be deferred, but this could mask
509
+ // errors elsewhere, the performance gain is very minor in typical situations
510
+ // (usually the dominant bottleneck is EH unwinding), and the implementation here
511
+ // would be more complex.
512
+ // Starting with Python 3.12, PyErr_Fetch() normalizes exceptions immediately.
513
+ // Any errors during normalization are tracked under __notes__.
514
+ explicit error_fetch_and_normalize(const char *called) {
515
+ PyErr_Fetch(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr());
516
+ if (!m_type) {
517
+ pybind11_fail("Internal error: " + std::string(called)
518
+ + " called while "
519
+ "Python error indicator not set.");
520
+ }
521
+ const char *exc_type_name_orig = detail::obj_class_name(m_type.ptr());
522
+ if (exc_type_name_orig == nullptr) {
523
+ pybind11_fail("Internal error: " + std::string(called)
524
+ + " failed to obtain the name "
525
+ "of the original active exception type.");
526
+ }
527
+ m_lazy_error_string = exc_type_name_orig;
528
+ #if PY_VERSION_HEX >= 0x030C0000
529
+ // The presence of __notes__ is likely due to exception normalization
530
+ // errors, although that is not necessarily true, therefore insert a
531
+ // hint only:
532
+ if (PyObject_HasAttrString(m_value.ptr(), "__notes__")) {
533
+ m_lazy_error_string += "[WITH __notes__]";
534
+ }
535
+ #else
536
+ // PyErr_NormalizeException() may change the exception type if there are cascading
537
+ // failures. This can potentially be extremely confusing.
538
+ PyErr_NormalizeException(&m_type.ptr(), &m_value.ptr(), &m_trace.ptr());
539
+ if (m_type.ptr() == nullptr) {
540
+ pybind11_fail("Internal error: " + std::string(called)
541
+ + " failed to normalize the "
542
+ "active exception.");
543
+ }
544
+ const char *exc_type_name_norm = detail::obj_class_name(m_type.ptr());
545
+ if (exc_type_name_norm == nullptr) {
546
+ pybind11_fail("Internal error: " + std::string(called)
547
+ + " failed to obtain the name "
548
+ "of the normalized active exception type.");
549
+ }
550
+ # if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x07030a00
551
+ // This behavior runs the risk of masking errors in the error handling, but avoids a
552
+ // conflict with PyPy, which relies on the normalization here to change OSError to
553
+ // FileNotFoundError (https://github.com/pybind/pybind11/issues/4075).
554
+ m_lazy_error_string = exc_type_name_norm;
555
+ # else
556
+ if (exc_type_name_norm != m_lazy_error_string) {
557
+ std::string msg = std::string(called)
558
+ + ": MISMATCH of original and normalized "
559
+ "active exception types: ";
560
+ msg += "ORIGINAL ";
561
+ msg += m_lazy_error_string;
562
+ msg += " REPLACED BY ";
563
+ msg += exc_type_name_norm;
564
+ msg += ": " + format_value_and_trace();
565
+ pybind11_fail(msg);
566
+ }
567
+ # endif
568
+ #endif
569
+ }
570
+
571
+ error_fetch_and_normalize(const error_fetch_and_normalize &) = delete;
572
+ error_fetch_and_normalize(error_fetch_and_normalize &&) = delete;
573
+
574
+ std::string format_value_and_trace() const {
575
+ std::string result;
576
+ std::string message_error_string;
577
+ if (m_value) {
578
+ auto value_str = reinterpret_steal<object>(PyObject_Str(m_value.ptr()));
579
+ constexpr const char *message_unavailable_exc
580
+ = "<MESSAGE UNAVAILABLE DUE TO ANOTHER EXCEPTION>";
581
+ if (!value_str) {
582
+ message_error_string = detail::error_string();
583
+ result = message_unavailable_exc;
584
+ } else {
585
+ // Not using `value_str.cast<std::string>()`, to not potentially throw a secondary
586
+ // error_already_set that will then result in process termination (#4288).
587
+ auto value_bytes = reinterpret_steal<object>(
588
+ PyUnicode_AsEncodedString(value_str.ptr(), "utf-8", "backslashreplace"));
589
+ if (!value_bytes) {
590
+ message_error_string = detail::error_string();
591
+ result = message_unavailable_exc;
592
+ } else {
593
+ char *buffer = nullptr;
594
+ Py_ssize_t length = 0;
595
+ if (PyBytes_AsStringAndSize(value_bytes.ptr(), &buffer, &length) == -1) {
596
+ message_error_string = detail::error_string();
597
+ result = message_unavailable_exc;
598
+ } else {
599
+ result = std::string(buffer, static_cast<std::size_t>(length));
600
+ }
601
+ }
602
+ }
603
+ #if PY_VERSION_HEX >= 0x030B0000
604
+ auto notes
605
+ = reinterpret_steal<object>(PyObject_GetAttrString(m_value.ptr(), "__notes__"));
606
+ if (!notes) {
607
+ PyErr_Clear(); // No notes is good news.
608
+ } else {
609
+ auto len_notes = PyList_Size(notes.ptr());
610
+ if (len_notes < 0) {
611
+ result += "\nFAILURE obtaining len(__notes__): " + detail::error_string();
612
+ } else {
613
+ result += "\n__notes__ (len=" + std::to_string(len_notes) + "):";
614
+ for (ssize_t i = 0; i < len_notes; i++) {
615
+ PyObject *note = PyList_GET_ITEM(notes.ptr(), i);
616
+ auto note_bytes = reinterpret_steal<object>(
617
+ PyUnicode_AsEncodedString(note, "utf-8", "backslashreplace"));
618
+ if (!note_bytes) {
619
+ result += "\nFAILURE obtaining __notes__[" + std::to_string(i)
620
+ + "]: " + detail::error_string();
621
+ } else {
622
+ char *buffer = nullptr;
623
+ Py_ssize_t length = 0;
624
+ if (PyBytes_AsStringAndSize(note_bytes.ptr(), &buffer, &length)
625
+ == -1) {
626
+ result += "\nFAILURE formatting __notes__[" + std::to_string(i)
627
+ + "]: " + detail::error_string();
628
+ } else {
629
+ result += '\n';
630
+ result += std::string(buffer, static_cast<std::size_t>(length));
631
+ }
632
+ }
633
+ }
634
+ }
635
+ }
636
+ #endif
637
+ } else {
638
+ result = "<MESSAGE UNAVAILABLE>";
639
+ }
640
+ if (result.empty()) {
641
+ result = "<EMPTY MESSAGE>";
642
+ }
643
+
644
+ bool have_trace = false;
645
+ if (m_trace) {
646
+ #if !defined(PYPY_VERSION)
647
+ auto *tb = reinterpret_cast<PyTracebackObject *>(m_trace.ptr());
648
+
649
+ // Get the deepest trace possible.
650
+ while (tb->tb_next) {
651
+ tb = tb->tb_next;
652
+ }
653
+
654
+ PyFrameObject *frame = tb->tb_frame;
655
+ Py_XINCREF(frame);
656
+ result += "\n\nAt:\n";
657
+ while (frame) {
658
+ # if PY_VERSION_HEX >= 0x030900B1
659
+ PyCodeObject *f_code = PyFrame_GetCode(frame);
660
+ # else
661
+ PyCodeObject *f_code = frame->f_code;
662
+ Py_INCREF(f_code);
663
+ # endif
664
+ int lineno = PyFrame_GetLineNumber(frame);
665
+ result += " ";
666
+ result += handle(f_code->co_filename).cast<std::string>();
667
+ result += '(';
668
+ result += std::to_string(lineno);
669
+ result += "): ";
670
+ result += handle(f_code->co_name).cast<std::string>();
671
+ result += '\n';
672
+ Py_DECREF(f_code);
673
+ # if PY_VERSION_HEX >= 0x030900B1
674
+ auto *b_frame = PyFrame_GetBack(frame);
675
+ # else
676
+ auto *b_frame = frame->f_back;
677
+ Py_XINCREF(b_frame);
678
+ # endif
679
+ Py_DECREF(frame);
680
+ frame = b_frame;
681
+ }
682
+
683
+ have_trace = true;
684
+ #endif //! defined(PYPY_VERSION)
685
+ }
686
+
687
+ if (!message_error_string.empty()) {
688
+ if (!have_trace) {
689
+ result += '\n';
690
+ }
691
+ result += "\nMESSAGE UNAVAILABLE DUE TO EXCEPTION: " + message_error_string;
692
+ }
693
+
694
+ return result;
695
+ }
696
+
697
+ std::string const &error_string() const {
698
+ if (!m_lazy_error_string_completed) {
699
+ m_lazy_error_string += ": " + format_value_and_trace();
700
+ m_lazy_error_string_completed = true;
701
+ }
702
+ return m_lazy_error_string;
703
+ }
704
+
705
+ void restore() {
706
+ if (m_restore_called) {
707
+ pybind11_fail("Internal error: pybind11::detail::error_fetch_and_normalize::restore() "
708
+ "called a second time. ORIGINAL ERROR: "
709
+ + error_string());
710
+ }
711
+ PyErr_Restore(m_type.inc_ref().ptr(), m_value.inc_ref().ptr(), m_trace.inc_ref().ptr());
712
+ m_restore_called = true;
713
+ }
714
+
715
+ bool matches(handle exc) const {
716
+ return (PyErr_GivenExceptionMatches(m_type.ptr(), exc.ptr()) != 0);
717
+ }
718
+
719
+ // Not protecting these for simplicity.
720
+ object m_type, m_value, m_trace;
721
+
722
+ private:
723
+ // Only protecting invariants.
724
+ mutable std::string m_lazy_error_string;
725
+ mutable bool m_lazy_error_string_completed = false;
726
+ mutable bool m_restore_called = false;
727
+ };
728
+
729
+ inline std::string error_string() {
730
+ return error_fetch_and_normalize("pybind11::detail::error_string").error_string();
731
+ }
732
+
733
+ PYBIND11_NAMESPACE_END(detail)
734
+
735
+ /// Fetch and hold an error which was already set in Python. An instance of this is typically
736
+ /// thrown to propagate python-side errors back through C++ which can either be caught manually or
737
+ /// else falls back to the function dispatcher (which then raises the captured error back to
738
+ /// python).
739
+ class PYBIND11_EXPORT_EXCEPTION error_already_set : public std::exception {
740
+ public:
741
+ /// Fetches the current Python exception (using PyErr_Fetch()), which will clear the
742
+ /// current Python error indicator.
743
+ error_already_set()
744
+ : m_fetched_error{new detail::error_fetch_and_normalize("pybind11::error_already_set"),
745
+ m_fetched_error_deleter} {}
746
+
747
+ /// The what() result is built lazily on demand.
748
+ /// WARNING: This member function needs to acquire the Python GIL. This can lead to
749
+ /// crashes (undefined behavior) if the Python interpreter is finalizing.
750
+ const char *what() const noexcept override;
751
+
752
+ /// Restores the currently-held Python error (which will clear the Python error indicator first
753
+ /// if already set).
754
+ /// NOTE: This member function will always restore the normalized exception, which may or may
755
+ /// not be the original Python exception.
756
+ /// WARNING: The GIL must be held when this member function is called!
757
+ void restore() { m_fetched_error->restore(); }
758
+
759
+ /// If it is impossible to raise the currently-held error, such as in a destructor, we can
760
+ /// write it out using Python's unraisable hook (`sys.unraisablehook`). The error context
761
+ /// should be some object whose `repr()` helps identify the location of the error. Python
762
+ /// already knows the type and value of the error, so there is no need to repeat that.
763
+ void discard_as_unraisable(object err_context) {
764
+ restore();
765
+ PyErr_WriteUnraisable(err_context.ptr());
766
+ }
767
+ /// An alternate version of `discard_as_unraisable()`, where a string provides information on
768
+ /// the location of the error. For example, `__func__` could be helpful.
769
+ /// WARNING: The GIL must be held when this member function is called!
770
+ void discard_as_unraisable(const char *err_context) {
771
+ discard_as_unraisable(reinterpret_steal<object>(PYBIND11_FROM_STRING(err_context)));
772
+ }
773
+
774
+ // Does nothing; provided for backwards compatibility.
775
+ PYBIND11_DEPRECATED("Use of error_already_set.clear() is deprecated")
776
+ void clear() {}
777
+
778
+ /// Check if the currently trapped error type matches the given Python exception class (or a
779
+ /// subclass thereof). May also be passed a tuple to search for any exception class matches in
780
+ /// the given tuple.
781
+ bool matches(handle exc) const { return m_fetched_error->matches(exc); }
782
+
783
+ const object &type() const { return m_fetched_error->m_type; }
784
+ const object &value() const { return m_fetched_error->m_value; }
785
+ const object &trace() const { return m_fetched_error->m_trace; }
786
+
787
+ private:
788
+ std::shared_ptr<detail::error_fetch_and_normalize> m_fetched_error;
789
+
790
+ /// WARNING: This custom deleter needs to acquire the Python GIL. This can lead to
791
+ /// crashes (undefined behavior) if the Python interpreter is finalizing.
792
+ static void m_fetched_error_deleter(detail::error_fetch_and_normalize *raw_ptr);
793
+ };
794
+
795
+ /// Replaces the current Python error indicator with the chosen error, performing a
796
+ /// 'raise from' to indicate that the chosen error was caused by the original error.
797
+ inline void raise_from(PyObject *type, const char *message) {
798
+ // Based on _PyErr_FormatVFromCause:
799
+ // https://github.com/python/cpython/blob/467ab194fc6189d9f7310c89937c51abeac56839/Python/errors.c#L405
800
+ // See https://github.com/pybind/pybind11/pull/2112 for details.
801
+ PyObject *exc = nullptr, *val = nullptr, *val2 = nullptr, *tb = nullptr;
802
+
803
+ assert(PyErr_Occurred());
804
+ PyErr_Fetch(&exc, &val, &tb);
805
+ PyErr_NormalizeException(&exc, &val, &tb);
806
+ if (tb != nullptr) {
807
+ PyException_SetTraceback(val, tb);
808
+ Py_DECREF(tb);
809
+ }
810
+ Py_DECREF(exc);
811
+ assert(!PyErr_Occurred());
812
+
813
+ PyErr_SetString(type, message);
814
+
815
+ PyErr_Fetch(&exc, &val2, &tb);
816
+ PyErr_NormalizeException(&exc, &val2, &tb);
817
+ Py_INCREF(val);
818
+ PyException_SetCause(val2, val);
819
+ PyException_SetContext(val2, val);
820
+ PyErr_Restore(exc, val2, tb);
821
+ }
822
+
823
+ /// Sets the current Python error indicator with the chosen error, performing a 'raise from'
824
+ /// from the error contained in error_already_set to indicate that the chosen error was
825
+ /// caused by the original error.
826
+ inline void raise_from(error_already_set &err, PyObject *type, const char *message) {
827
+ err.restore();
828
+ raise_from(type, message);
829
+ }
830
+
831
+ /** \defgroup python_builtins const_name
832
+ Unless stated otherwise, the following C++ functions behave the same
833
+ as their Python counterparts.
834
+ */
835
+
836
+ /** \ingroup python_builtins
837
+ \rst
838
+ Return true if ``obj`` is an instance of ``T``. Type ``T`` must be a subclass of
839
+ `object` or a class which was exposed to Python as ``py::class_<T>``.
840
+ \endrst */
841
+ template <typename T, detail::enable_if_t<std::is_base_of<object, T>::value, int> = 0>
842
+ bool isinstance(handle obj) {
843
+ return T::check_(obj);
844
+ }
845
+
846
+ template <typename T, detail::enable_if_t<!std::is_base_of<object, T>::value, int> = 0>
847
+ bool isinstance(handle obj) {
848
+ return detail::isinstance_generic(obj, typeid(T));
849
+ }
850
+
851
+ template <>
852
+ inline bool isinstance<handle>(handle) = delete;
853
+ template <>
854
+ inline bool isinstance<object>(handle obj) {
855
+ return obj.ptr() != nullptr;
856
+ }
857
+
858
+ /// \ingroup python_builtins
859
+ /// Return true if ``obj`` is an instance of the ``type``.
860
+ inline bool isinstance(handle obj, handle type) {
861
+ const auto result = PyObject_IsInstance(obj.ptr(), type.ptr());
862
+ if (result == -1) {
863
+ throw error_already_set();
864
+ }
865
+ return result != 0;
866
+ }
867
+
868
+ /// \addtogroup python_builtins
869
+ /// @{
870
+ inline bool hasattr(handle obj, handle name) {
871
+ return PyObject_HasAttr(obj.ptr(), name.ptr()) == 1;
872
+ }
873
+
874
+ inline bool hasattr(handle obj, const char *name) {
875
+ return PyObject_HasAttrString(obj.ptr(), name) == 1;
876
+ }
877
+
878
+ inline void delattr(handle obj, handle name) {
879
+ if (PyObject_DelAttr(obj.ptr(), name.ptr()) != 0) {
880
+ throw error_already_set();
881
+ }
882
+ }
883
+
884
+ inline void delattr(handle obj, const char *name) {
885
+ if (PyObject_DelAttrString(obj.ptr(), name) != 0) {
886
+ throw error_already_set();
887
+ }
888
+ }
889
+
890
+ inline object getattr(handle obj, handle name) {
891
+ PyObject *result = PyObject_GetAttr(obj.ptr(), name.ptr());
892
+ if (!result) {
893
+ throw error_already_set();
894
+ }
895
+ return reinterpret_steal<object>(result);
896
+ }
897
+
898
+ inline object getattr(handle obj, const char *name) {
899
+ PyObject *result = PyObject_GetAttrString(obj.ptr(), name);
900
+ if (!result) {
901
+ throw error_already_set();
902
+ }
903
+ return reinterpret_steal<object>(result);
904
+ }
905
+
906
+ inline object getattr(handle obj, handle name, handle default_) {
907
+ if (PyObject *result = PyObject_GetAttr(obj.ptr(), name.ptr())) {
908
+ return reinterpret_steal<object>(result);
909
+ }
910
+ PyErr_Clear();
911
+ return reinterpret_borrow<object>(default_);
912
+ }
913
+
914
+ inline object getattr(handle obj, const char *name, handle default_) {
915
+ if (PyObject *result = PyObject_GetAttrString(obj.ptr(), name)) {
916
+ return reinterpret_steal<object>(result);
917
+ }
918
+ PyErr_Clear();
919
+ return reinterpret_borrow<object>(default_);
920
+ }
921
+
922
+ inline void setattr(handle obj, handle name, handle value) {
923
+ if (PyObject_SetAttr(obj.ptr(), name.ptr(), value.ptr()) != 0) {
924
+ throw error_already_set();
925
+ }
926
+ }
927
+
928
+ inline void setattr(handle obj, const char *name, handle value) {
929
+ if (PyObject_SetAttrString(obj.ptr(), name, value.ptr()) != 0) {
930
+ throw error_already_set();
931
+ }
932
+ }
933
+
934
+ inline ssize_t hash(handle obj) {
935
+ auto h = PyObject_Hash(obj.ptr());
936
+ if (h == -1) {
937
+ throw error_already_set();
938
+ }
939
+ return h;
940
+ }
941
+
942
+ /// @} python_builtins
943
+
944
+ PYBIND11_NAMESPACE_BEGIN(detail)
945
+ inline handle get_function(handle value) {
946
+ if (value) {
947
+ if (PyInstanceMethod_Check(value.ptr())) {
948
+ value = PyInstanceMethod_GET_FUNCTION(value.ptr());
949
+ } else if (PyMethod_Check(value.ptr())) {
950
+ value = PyMethod_GET_FUNCTION(value.ptr());
951
+ }
952
+ }
953
+ return value;
954
+ }
955
+
956
+ // Reimplementation of python's dict helper functions to ensure that exceptions
957
+ // aren't swallowed (see #2862)
958
+
959
+ // copied from cpython _PyDict_GetItemStringWithError
960
+ inline PyObject *dict_getitemstring(PyObject *v, const char *key) {
961
+ PyObject *kv = nullptr, *rv = nullptr;
962
+ kv = PyUnicode_FromString(key);
963
+ if (kv == nullptr) {
964
+ throw error_already_set();
965
+ }
966
+
967
+ rv = PyDict_GetItemWithError(v, kv);
968
+ Py_DECREF(kv);
969
+ if (rv == nullptr && PyErr_Occurred()) {
970
+ throw error_already_set();
971
+ }
972
+ return rv;
973
+ }
974
+
975
+ inline PyObject *dict_getitem(PyObject *v, PyObject *key) {
976
+ PyObject *rv = PyDict_GetItemWithError(v, key);
977
+ if (rv == nullptr && PyErr_Occurred()) {
978
+ throw error_already_set();
979
+ }
980
+ return rv;
981
+ }
982
+
983
+ inline PyObject *dict_getitemstringref(PyObject *v, const char *key) {
984
+ #if PY_VERSION_HEX >= 0x030D0000
985
+ PyObject *rv;
986
+ if (PyDict_GetItemStringRef(v, key, &rv) < 0) {
987
+ throw error_already_set();
988
+ }
989
+ return rv;
990
+ #else
991
+ PyObject *rv = dict_getitemstring(v, key);
992
+ if (rv == nullptr && PyErr_Occurred()) {
993
+ throw error_already_set();
994
+ }
995
+ Py_XINCREF(rv);
996
+ return rv;
997
+ #endif
998
+ }
999
+
1000
+ // Helper aliases/functions to support implicit casting of values given to python
1001
+ // accessors/methods. When given a pyobject, this simply returns the pyobject as-is; for other C++
1002
+ // type, the value goes through pybind11::cast(obj) to convert it to an `object`.
1003
+ template <typename T, enable_if_t<is_pyobject<T>::value, int> = 0>
1004
+ auto object_or_cast(T &&o) -> decltype(std::forward<T>(o)) {
1005
+ return std::forward<T>(o);
1006
+ }
1007
+ // The following casting version is implemented in cast.h:
1008
+ template <typename T, enable_if_t<!is_pyobject<T>::value, int> = 0>
1009
+ object object_or_cast(T &&o);
1010
+ // Match a PyObject*, which we want to convert directly to handle via its converting constructor
1011
+ inline handle object_or_cast(PyObject *ptr) { return ptr; }
1012
+
1013
+ PYBIND11_WARNING_PUSH
1014
+ PYBIND11_WARNING_DISABLE_MSVC(4522) // warning C4522: multiple assignment operators specified
1015
+ template <typename Policy>
1016
+ class accessor : public object_api<accessor<Policy>> {
1017
+ using key_type = typename Policy::key_type;
1018
+
1019
+ public:
1020
+ accessor(handle obj, key_type key) : obj(obj), key(std::move(key)) {}
1021
+ accessor(const accessor &) = default;
1022
+ accessor(accessor &&) noexcept = default;
1023
+
1024
+ // accessor overload required to override default assignment operator (templates are not
1025
+ // allowed to replace default compiler-generated assignments).
1026
+ void operator=(const accessor &a) && { std::move(*this).operator=(handle(a)); }
1027
+ void operator=(const accessor &a) & { operator=(handle(a)); }
1028
+
1029
+ template <typename T>
1030
+ void operator=(T &&value) && {
1031
+ Policy::set(obj, key, object_or_cast(std::forward<T>(value)));
1032
+ }
1033
+ template <typename T>
1034
+ void operator=(T &&value) & {
1035
+ get_cache() = ensure_object(object_or_cast(std::forward<T>(value)));
1036
+ }
1037
+
1038
+ template <typename T = Policy>
1039
+ PYBIND11_DEPRECATED(
1040
+ "Use of obj.attr(...) as bool is deprecated in favor of pybind11::hasattr(obj, ...)")
1041
+ explicit
1042
+ operator enable_if_t<std::is_same<T, accessor_policies::str_attr>::value
1043
+ || std::is_same<T, accessor_policies::obj_attr>::value,
1044
+ bool>() const {
1045
+ return hasattr(obj, key);
1046
+ }
1047
+ template <typename T = Policy>
1048
+ PYBIND11_DEPRECATED("Use of obj[key] as bool is deprecated in favor of obj.contains(key)")
1049
+ explicit
1050
+ operator enable_if_t<std::is_same<T, accessor_policies::generic_item>::value, bool>() const {
1051
+ return obj.contains(key);
1052
+ }
1053
+
1054
+ // NOLINTNEXTLINE(google-explicit-constructor)
1055
+ operator object() const { return get_cache(); }
1056
+ PyObject *ptr() const { return get_cache().ptr(); }
1057
+ template <typename T>
1058
+ T cast() const {
1059
+ return get_cache().template cast<T>();
1060
+ }
1061
+
1062
+ private:
1063
+ static object ensure_object(object &&o) { return std::move(o); }
1064
+ static object ensure_object(handle h) { return reinterpret_borrow<object>(h); }
1065
+
1066
+ object &get_cache() const {
1067
+ if (!cache) {
1068
+ cache = Policy::get(obj, key);
1069
+ }
1070
+ return cache;
1071
+ }
1072
+
1073
+ private:
1074
+ handle obj;
1075
+ key_type key;
1076
+ mutable object cache;
1077
+ };
1078
+ PYBIND11_WARNING_POP
1079
+
1080
+ PYBIND11_NAMESPACE_BEGIN(accessor_policies)
1081
+ struct obj_attr {
1082
+ using key_type = object;
1083
+ static object get(handle obj, handle key) { return getattr(obj, key); }
1084
+ static void set(handle obj, handle key, handle val) { setattr(obj, key, val); }
1085
+ };
1086
+
1087
+ struct str_attr {
1088
+ using key_type = const char *;
1089
+ static object get(handle obj, const char *key) { return getattr(obj, key); }
1090
+ static void set(handle obj, const char *key, handle val) { setattr(obj, key, val); }
1091
+ };
1092
+
1093
+ struct generic_item {
1094
+ using key_type = object;
1095
+
1096
+ static object get(handle obj, handle key) {
1097
+ PyObject *result = PyObject_GetItem(obj.ptr(), key.ptr());
1098
+ if (!result) {
1099
+ throw error_already_set();
1100
+ }
1101
+ return reinterpret_steal<object>(result);
1102
+ }
1103
+
1104
+ static void set(handle obj, handle key, handle val) {
1105
+ if (PyObject_SetItem(obj.ptr(), key.ptr(), val.ptr()) != 0) {
1106
+ throw error_already_set();
1107
+ }
1108
+ }
1109
+ };
1110
+
1111
+ struct sequence_item {
1112
+ using key_type = size_t;
1113
+
1114
+ template <typename IdxType, detail::enable_if_t<std::is_integral<IdxType>::value, int> = 0>
1115
+ static object get(handle obj, const IdxType &index) {
1116
+ PyObject *result = PySequence_GetItem(obj.ptr(), ssize_t_cast(index));
1117
+ if (!result) {
1118
+ throw error_already_set();
1119
+ }
1120
+ return reinterpret_steal<object>(result);
1121
+ }
1122
+
1123
+ template <typename IdxType, detail::enable_if_t<std::is_integral<IdxType>::value, int> = 0>
1124
+ static void set(handle obj, const IdxType &index, handle val) {
1125
+ // PySequence_SetItem does not steal a reference to 'val'
1126
+ if (PySequence_SetItem(obj.ptr(), ssize_t_cast(index), val.ptr()) != 0) {
1127
+ throw error_already_set();
1128
+ }
1129
+ }
1130
+ };
1131
+
1132
+ struct list_item {
1133
+ using key_type = size_t;
1134
+
1135
+ template <typename IdxType, detail::enable_if_t<std::is_integral<IdxType>::value, int> = 0>
1136
+ static object get(handle obj, const IdxType &index) {
1137
+ PyObject *result = PyList_GetItem(obj.ptr(), ssize_t_cast(index));
1138
+ if (!result) {
1139
+ throw error_already_set();
1140
+ }
1141
+ return reinterpret_borrow<object>(result);
1142
+ }
1143
+
1144
+ template <typename IdxType, detail::enable_if_t<std::is_integral<IdxType>::value, int> = 0>
1145
+ static void set(handle obj, const IdxType &index, handle val) {
1146
+ // PyList_SetItem steals a reference to 'val'
1147
+ if (PyList_SetItem(obj.ptr(), ssize_t_cast(index), val.inc_ref().ptr()) != 0) {
1148
+ throw error_already_set();
1149
+ }
1150
+ }
1151
+ };
1152
+
1153
+ struct tuple_item {
1154
+ using key_type = size_t;
1155
+
1156
+ template <typename IdxType, detail::enable_if_t<std::is_integral<IdxType>::value, int> = 0>
1157
+ static object get(handle obj, const IdxType &index) {
1158
+ PyObject *result = PyTuple_GetItem(obj.ptr(), ssize_t_cast(index));
1159
+ if (!result) {
1160
+ throw error_already_set();
1161
+ }
1162
+ return reinterpret_borrow<object>(result);
1163
+ }
1164
+
1165
+ template <typename IdxType, detail::enable_if_t<std::is_integral<IdxType>::value, int> = 0>
1166
+ static void set(handle obj, const IdxType &index, handle val) {
1167
+ // PyTuple_SetItem steals a reference to 'val'
1168
+ if (PyTuple_SetItem(obj.ptr(), ssize_t_cast(index), val.inc_ref().ptr()) != 0) {
1169
+ throw error_already_set();
1170
+ }
1171
+ }
1172
+ };
1173
+ PYBIND11_NAMESPACE_END(accessor_policies)
1174
+
1175
+ /// STL iterator template used for tuple, list, sequence and dict
1176
+ template <typename Policy>
1177
+ class generic_iterator : public Policy {
1178
+ using It = generic_iterator;
1179
+
1180
+ public:
1181
+ using difference_type = ssize_t;
1182
+ using iterator_category = typename Policy::iterator_category;
1183
+ using value_type = typename Policy::value_type;
1184
+ using reference = typename Policy::reference;
1185
+ using pointer = typename Policy::pointer;
1186
+
1187
+ generic_iterator() = default;
1188
+ generic_iterator(handle seq, ssize_t index) : Policy(seq, index) {}
1189
+
1190
+ // NOLINTNEXTLINE(readability-const-return-type) // PR #3263
1191
+ reference operator*() const { return Policy::dereference(); }
1192
+ // NOLINTNEXTLINE(readability-const-return-type) // PR #3263
1193
+ reference operator[](difference_type n) const { return *(*this + n); }
1194
+ pointer operator->() const { return **this; }
1195
+
1196
+ It &operator++() {
1197
+ Policy::increment();
1198
+ return *this;
1199
+ }
1200
+ It operator++(int) {
1201
+ auto copy = *this;
1202
+ Policy::increment();
1203
+ return copy;
1204
+ }
1205
+ It &operator--() {
1206
+ Policy::decrement();
1207
+ return *this;
1208
+ }
1209
+ It operator--(int) {
1210
+ auto copy = *this;
1211
+ Policy::decrement();
1212
+ return copy;
1213
+ }
1214
+ It &operator+=(difference_type n) {
1215
+ Policy::advance(n);
1216
+ return *this;
1217
+ }
1218
+ It &operator-=(difference_type n) {
1219
+ Policy::advance(-n);
1220
+ return *this;
1221
+ }
1222
+
1223
+ friend It operator+(const It &a, difference_type n) {
1224
+ auto copy = a;
1225
+ return copy += n;
1226
+ }
1227
+ friend It operator+(difference_type n, const It &b) { return b + n; }
1228
+ friend It operator-(const It &a, difference_type n) {
1229
+ auto copy = a;
1230
+ return copy -= n;
1231
+ }
1232
+ friend difference_type operator-(const It &a, const It &b) { return a.distance_to(b); }
1233
+
1234
+ friend bool operator==(const It &a, const It &b) { return a.equal(b); }
1235
+ friend bool operator!=(const It &a, const It &b) { return !(a == b); }
1236
+ friend bool operator<(const It &a, const It &b) { return b - a > 0; }
1237
+ friend bool operator>(const It &a, const It &b) { return b < a; }
1238
+ friend bool operator>=(const It &a, const It &b) { return !(a < b); }
1239
+ friend bool operator<=(const It &a, const It &b) { return !(a > b); }
1240
+ };
1241
+
1242
+ PYBIND11_NAMESPACE_BEGIN(iterator_policies)
1243
+ /// Quick proxy class needed to implement ``operator->`` for iterators which can't return pointers
1244
+ template <typename T>
1245
+ struct arrow_proxy {
1246
+ T value;
1247
+
1248
+ // NOLINTNEXTLINE(google-explicit-constructor)
1249
+ arrow_proxy(T &&value) noexcept : value(std::move(value)) {}
1250
+ T *operator->() const { return &value; }
1251
+ };
1252
+
1253
+ /// Lightweight iterator policy using just a simple pointer: see ``PySequence_Fast_ITEMS``
1254
+ class sequence_fast_readonly {
1255
+ protected:
1256
+ using iterator_category = std::random_access_iterator_tag;
1257
+ using value_type = handle;
1258
+ using reference = const handle; // PR #3263
1259
+ using pointer = arrow_proxy<const handle>;
1260
+
1261
+ sequence_fast_readonly(handle obj, ssize_t n) : ptr(PySequence_Fast_ITEMS(obj.ptr()) + n) {}
1262
+
1263
+ // NOLINTNEXTLINE(readability-const-return-type) // PR #3263
1264
+ reference dereference() const { return *ptr; }
1265
+ void increment() { ++ptr; }
1266
+ void decrement() { --ptr; }
1267
+ void advance(ssize_t n) { ptr += n; }
1268
+ bool equal(const sequence_fast_readonly &b) const { return ptr == b.ptr; }
1269
+ ssize_t distance_to(const sequence_fast_readonly &b) const { return ptr - b.ptr; }
1270
+
1271
+ private:
1272
+ PyObject **ptr;
1273
+ };
1274
+
1275
+ /// Full read and write access using the sequence protocol: see ``detail::sequence_accessor``
1276
+ class sequence_slow_readwrite {
1277
+ protected:
1278
+ using iterator_category = std::random_access_iterator_tag;
1279
+ using value_type = object;
1280
+ using reference = sequence_accessor;
1281
+ using pointer = arrow_proxy<const sequence_accessor>;
1282
+
1283
+ sequence_slow_readwrite(handle obj, ssize_t index) : obj(obj), index(index) {}
1284
+
1285
+ reference dereference() const { return {obj, static_cast<size_t>(index)}; }
1286
+ void increment() { ++index; }
1287
+ void decrement() { --index; }
1288
+ void advance(ssize_t n) { index += n; }
1289
+ bool equal(const sequence_slow_readwrite &b) const { return index == b.index; }
1290
+ ssize_t distance_to(const sequence_slow_readwrite &b) const { return index - b.index; }
1291
+
1292
+ private:
1293
+ handle obj;
1294
+ ssize_t index;
1295
+ };
1296
+
1297
+ /// Python's dictionary protocol permits this to be a forward iterator
1298
+ class dict_readonly {
1299
+ protected:
1300
+ using iterator_category = std::forward_iterator_tag;
1301
+ using value_type = std::pair<handle, handle>;
1302
+ using reference = const value_type; // PR #3263
1303
+ using pointer = arrow_proxy<const value_type>;
1304
+
1305
+ dict_readonly() = default;
1306
+ dict_readonly(handle obj, ssize_t pos) : obj(obj), pos(pos) { increment(); }
1307
+
1308
+ // NOLINTNEXTLINE(readability-const-return-type) // PR #3263
1309
+ reference dereference() const { return {key, value}; }
1310
+ void increment() {
1311
+ if (PyDict_Next(obj.ptr(), &pos, &key, &value) == 0) {
1312
+ pos = -1;
1313
+ }
1314
+ }
1315
+ bool equal(const dict_readonly &b) const { return pos == b.pos; }
1316
+
1317
+ private:
1318
+ handle obj;
1319
+ PyObject *key = nullptr, *value = nullptr;
1320
+ ssize_t pos = -1;
1321
+ };
1322
+ PYBIND11_NAMESPACE_END(iterator_policies)
1323
+
1324
+ #if !defined(PYPY_VERSION)
1325
+ using tuple_iterator = generic_iterator<iterator_policies::sequence_fast_readonly>;
1326
+ using list_iterator = generic_iterator<iterator_policies::sequence_fast_readonly>;
1327
+ #else
1328
+ using tuple_iterator = generic_iterator<iterator_policies::sequence_slow_readwrite>;
1329
+ using list_iterator = generic_iterator<iterator_policies::sequence_slow_readwrite>;
1330
+ #endif
1331
+
1332
+ using sequence_iterator = generic_iterator<iterator_policies::sequence_slow_readwrite>;
1333
+ using dict_iterator = generic_iterator<iterator_policies::dict_readonly>;
1334
+
1335
+ inline bool PyIterable_Check(PyObject *obj) {
1336
+ PyObject *iter = PyObject_GetIter(obj);
1337
+ if (iter) {
1338
+ Py_DECREF(iter);
1339
+ return true;
1340
+ }
1341
+ PyErr_Clear();
1342
+ return false;
1343
+ }
1344
+
1345
+ inline bool PyNone_Check(PyObject *o) { return o == Py_None; }
1346
+ inline bool PyEllipsis_Check(PyObject *o) { return o == Py_Ellipsis; }
1347
+
1348
+ #ifdef PYBIND11_STR_LEGACY_PERMISSIVE
1349
+ inline bool PyUnicode_Check_Permissive(PyObject *o) {
1350
+ return PyUnicode_Check(o) || PYBIND11_BYTES_CHECK(o);
1351
+ }
1352
+ # define PYBIND11_STR_CHECK_FUN detail::PyUnicode_Check_Permissive
1353
+ #else
1354
+ # define PYBIND11_STR_CHECK_FUN PyUnicode_Check
1355
+ #endif
1356
+
1357
+ inline bool PyStaticMethod_Check(PyObject *o) { return o->ob_type == &PyStaticMethod_Type; }
1358
+
1359
+ class kwargs_proxy : public handle {
1360
+ public:
1361
+ explicit kwargs_proxy(handle h) : handle(h) {}
1362
+ };
1363
+
1364
+ class args_proxy : public handle {
1365
+ public:
1366
+ explicit args_proxy(handle h) : handle(h) {}
1367
+ kwargs_proxy operator*() const { return kwargs_proxy(*this); }
1368
+ };
1369
+
1370
+ /// Python argument categories (using PEP 448 terms)
1371
+ template <typename T>
1372
+ using is_keyword = std::is_base_of<arg, T>;
1373
+ template <typename T>
1374
+ using is_s_unpacking = std::is_same<args_proxy, T>; // * unpacking
1375
+ template <typename T>
1376
+ using is_ds_unpacking = std::is_same<kwargs_proxy, T>; // ** unpacking
1377
+ template <typename T>
1378
+ using is_positional = satisfies_none_of<T, is_keyword, is_s_unpacking, is_ds_unpacking>;
1379
+ template <typename T>
1380
+ using is_keyword_or_ds = satisfies_any_of<T, is_keyword, is_ds_unpacking>;
1381
+
1382
+ // Call argument collector forward declarations
1383
+ template <return_value_policy policy = return_value_policy::automatic_reference>
1384
+ class simple_collector;
1385
+ template <return_value_policy policy = return_value_policy::automatic_reference>
1386
+ class unpacking_collector;
1387
+
1388
+ PYBIND11_NAMESPACE_END(detail)
1389
+
1390
+ // TODO: After the deprecated constructors are removed, this macro can be simplified by
1391
+ // inheriting ctors: `using Parent::Parent`. It's not an option right now because
1392
+ // the `using` statement triggers the parent deprecation warning even if the ctor
1393
+ // isn't even used.
1394
+ #define PYBIND11_OBJECT_COMMON(Name, Parent, CheckFun) \
1395
+ public: \
1396
+ PYBIND11_DEPRECATED("Use reinterpret_borrow<" #Name ">() or reinterpret_steal<" #Name ">()") \
1397
+ Name(handle h, bool is_borrowed) \
1398
+ : Parent(is_borrowed ? Parent(h, borrowed_t{}) : Parent(h, stolen_t{})) {} \
1399
+ Name(handle h, borrowed_t) : Parent(h, borrowed_t{}) {} \
1400
+ Name(handle h, stolen_t) : Parent(h, stolen_t{}) {} \
1401
+ PYBIND11_DEPRECATED("Use py::isinstance<py::python_type>(obj) instead") \
1402
+ bool check() const { return m_ptr != nullptr && (CheckFun(m_ptr) != 0); } \
1403
+ static bool check_(handle h) { return h.ptr() != nullptr && CheckFun(h.ptr()); } \
1404
+ template <typename Policy_> /* NOLINTNEXTLINE(google-explicit-constructor) */ \
1405
+ Name(const ::pybind11::detail::accessor<Policy_> &a) : Name(object(a)) {}
1406
+
1407
+ #define PYBIND11_OBJECT_CVT(Name, Parent, CheckFun, ConvertFun) \
1408
+ PYBIND11_OBJECT_COMMON(Name, Parent, CheckFun) \
1409
+ /* This is deliberately not 'explicit' to allow implicit conversion from object: */ \
1410
+ /* NOLINTNEXTLINE(google-explicit-constructor) */ \
1411
+ Name(const object &o) \
1412
+ : Parent(check_(o) ? o.inc_ref().ptr() : ConvertFun(o.ptr()), stolen_t{}) { \
1413
+ if (!m_ptr) \
1414
+ throw ::pybind11::error_already_set(); \
1415
+ } \
1416
+ /* NOLINTNEXTLINE(google-explicit-constructor) */ \
1417
+ Name(object &&o) : Parent(check_(o) ? o.release().ptr() : ConvertFun(o.ptr()), stolen_t{}) { \
1418
+ if (!m_ptr) \
1419
+ throw ::pybind11::error_already_set(); \
1420
+ }
1421
+
1422
+ #define PYBIND11_OBJECT_CVT_DEFAULT(Name, Parent, CheckFun, ConvertFun) \
1423
+ PYBIND11_OBJECT_CVT(Name, Parent, CheckFun, ConvertFun) \
1424
+ Name() = default;
1425
+
1426
+ #define PYBIND11_OBJECT_CHECK_FAILED(Name, o_ptr) \
1427
+ ::pybind11::type_error("Object of type '" \
1428
+ + ::pybind11::detail::get_fully_qualified_tp_name(Py_TYPE(o_ptr)) \
1429
+ + "' is not an instance of '" #Name "'")
1430
+
1431
+ #define PYBIND11_OBJECT(Name, Parent, CheckFun) \
1432
+ PYBIND11_OBJECT_COMMON(Name, Parent, CheckFun) \
1433
+ /* This is deliberately not 'explicit' to allow implicit conversion from object: */ \
1434
+ /* NOLINTNEXTLINE(google-explicit-constructor) */ \
1435
+ Name(const object &o) : Parent(o) { \
1436
+ if (m_ptr && !check_(m_ptr)) \
1437
+ throw PYBIND11_OBJECT_CHECK_FAILED(Name, m_ptr); \
1438
+ } \
1439
+ /* NOLINTNEXTLINE(google-explicit-constructor) */ \
1440
+ Name(object &&o) : Parent(std::move(o)) { \
1441
+ if (m_ptr && !check_(m_ptr)) \
1442
+ throw PYBIND11_OBJECT_CHECK_FAILED(Name, m_ptr); \
1443
+ }
1444
+
1445
+ #define PYBIND11_OBJECT_DEFAULT(Name, Parent, CheckFun) \
1446
+ PYBIND11_OBJECT(Name, Parent, CheckFun) \
1447
+ Name() = default;
1448
+
1449
+ /// \addtogroup pytypes
1450
+ /// @{
1451
+
1452
+ /** \rst
1453
+ Wraps a Python iterator so that it can also be used as a C++ input iterator
1454
+
1455
+ Caveat: copying an iterator does not (and cannot) clone the internal
1456
+ state of the Python iterable. This also applies to the post-increment
1457
+ operator. This iterator should only be used to retrieve the current
1458
+ value using ``operator*()``.
1459
+ \endrst */
1460
+ class iterator : public object {
1461
+ public:
1462
+ using iterator_category = std::input_iterator_tag;
1463
+ using difference_type = ssize_t;
1464
+ using value_type = handle;
1465
+ using reference = const handle; // PR #3263
1466
+ using pointer = const handle *;
1467
+
1468
+ PYBIND11_OBJECT_DEFAULT(iterator, object, PyIter_Check)
1469
+
1470
+ iterator &operator++() {
1471
+ advance();
1472
+ return *this;
1473
+ }
1474
+
1475
+ iterator operator++(int) {
1476
+ auto rv = *this;
1477
+ advance();
1478
+ return rv;
1479
+ }
1480
+
1481
+ // NOLINTNEXTLINE(readability-const-return-type) // PR #3263
1482
+ reference operator*() const {
1483
+ if (m_ptr && !value.ptr()) {
1484
+ auto &self = const_cast<iterator &>(*this);
1485
+ self.advance();
1486
+ }
1487
+ return value;
1488
+ }
1489
+
1490
+ pointer operator->() const {
1491
+ operator*();
1492
+ return &value;
1493
+ }
1494
+
1495
+ /** \rst
1496
+ The value which marks the end of the iteration. ``it == iterator::sentinel()``
1497
+ is equivalent to catching ``StopIteration`` in Python.
1498
+
1499
+ .. code-block:: cpp
1500
+
1501
+ void foo(py::iterator it) {
1502
+ while (it != py::iterator::sentinel()) {
1503
+ // use `*it`
1504
+ ++it;
1505
+ }
1506
+ }
1507
+ \endrst */
1508
+ static iterator sentinel() { return {}; }
1509
+
1510
+ friend bool operator==(const iterator &a, const iterator &b) { return a->ptr() == b->ptr(); }
1511
+ friend bool operator!=(const iterator &a, const iterator &b) { return a->ptr() != b->ptr(); }
1512
+
1513
+ private:
1514
+ void advance() {
1515
+ value = reinterpret_steal<object>(PyIter_Next(m_ptr));
1516
+ if (value.ptr() == nullptr && PyErr_Occurred()) {
1517
+ throw error_already_set();
1518
+ }
1519
+ }
1520
+
1521
+ private:
1522
+ object value = {};
1523
+ };
1524
+
1525
+ class type : public object {
1526
+ public:
1527
+ PYBIND11_OBJECT(type, object, PyType_Check)
1528
+
1529
+ /// Return a type handle from a handle or an object
1530
+ static handle handle_of(handle h) { return handle((PyObject *) Py_TYPE(h.ptr())); }
1531
+
1532
+ /// Return a type object from a handle or an object
1533
+ static type of(handle h) { return type(type::handle_of(h), borrowed_t{}); }
1534
+
1535
+ // Defined in pybind11/cast.h
1536
+ /// Convert C++ type to handle if previously registered. Does not convert
1537
+ /// standard types, like int, float. etc. yet.
1538
+ /// See https://github.com/pybind/pybind11/issues/2486
1539
+ template <typename T>
1540
+ static handle handle_of();
1541
+
1542
+ /// Convert C++ type to type if previously registered. Does not convert
1543
+ /// standard types, like int, float. etc. yet.
1544
+ /// See https://github.com/pybind/pybind11/issues/2486
1545
+ template <typename T>
1546
+ static type of() {
1547
+ return type(type::handle_of<T>(), borrowed_t{});
1548
+ }
1549
+ };
1550
+
1551
+ class iterable : public object {
1552
+ public:
1553
+ PYBIND11_OBJECT_DEFAULT(iterable, object, detail::PyIterable_Check)
1554
+ };
1555
+
1556
+ class bytes;
1557
+
1558
+ class str : public object {
1559
+ public:
1560
+ PYBIND11_OBJECT_CVT(str, object, PYBIND11_STR_CHECK_FUN, raw_str)
1561
+
1562
+ template <typename SzType, detail::enable_if_t<std::is_integral<SzType>::value, int> = 0>
1563
+ str(const char *c, const SzType &n)
1564
+ : object(PyUnicode_FromStringAndSize(c, ssize_t_cast(n)), stolen_t{}) {
1565
+ if (!m_ptr) {
1566
+ if (PyErr_Occurred()) {
1567
+ throw error_already_set();
1568
+ }
1569
+ pybind11_fail("Could not allocate string object!");
1570
+ }
1571
+ }
1572
+
1573
+ // 'explicit' is explicitly omitted from the following constructors to allow implicit
1574
+ // conversion to py::str from C++ string-like objects
1575
+ // NOLINTNEXTLINE(google-explicit-constructor)
1576
+ str(const char *c = "") : object(PyUnicode_FromString(c), stolen_t{}) {
1577
+ if (!m_ptr) {
1578
+ if (PyErr_Occurred()) {
1579
+ throw error_already_set();
1580
+ }
1581
+ pybind11_fail("Could not allocate string object!");
1582
+ }
1583
+ }
1584
+
1585
+ // NOLINTNEXTLINE(google-explicit-constructor)
1586
+ str(const std::string &s) : str(s.data(), s.size()) {}
1587
+
1588
+ #ifdef PYBIND11_HAS_STRING_VIEW
1589
+ // enable_if is needed to avoid "ambiguous conversion" errors (see PR #3521).
1590
+ template <typename T, detail::enable_if_t<std::is_same<T, std::string_view>::value, int> = 0>
1591
+ // NOLINTNEXTLINE(google-explicit-constructor)
1592
+ str(T s) : str(s.data(), s.size()) {}
1593
+
1594
+ # ifdef PYBIND11_HAS_U8STRING
1595
+ // reinterpret_cast here is safe (C++20 guarantees char8_t has the same size/alignment as char)
1596
+ // NOLINTNEXTLINE(google-explicit-constructor)
1597
+ str(std::u8string_view s) : str(reinterpret_cast<const char *>(s.data()), s.size()) {}
1598
+ # endif
1599
+
1600
+ #endif
1601
+
1602
+ explicit str(const bytes &b);
1603
+
1604
+ /** \rst
1605
+ Return a string representation of the object. This is analogous to
1606
+ the ``str()`` function in Python.
1607
+ \endrst */
1608
+ explicit str(handle h) : object(raw_str(h.ptr()), stolen_t{}) {
1609
+ if (!m_ptr) {
1610
+ throw error_already_set();
1611
+ }
1612
+ }
1613
+
1614
+ // NOLINTNEXTLINE(google-explicit-constructor)
1615
+ operator std::string() const {
1616
+ object temp = *this;
1617
+ if (PyUnicode_Check(m_ptr)) {
1618
+ temp = reinterpret_steal<object>(PyUnicode_AsUTF8String(m_ptr));
1619
+ if (!temp) {
1620
+ throw error_already_set();
1621
+ }
1622
+ }
1623
+ char *buffer = nullptr;
1624
+ ssize_t length = 0;
1625
+ if (PyBytes_AsStringAndSize(temp.ptr(), &buffer, &length) != 0) {
1626
+ throw error_already_set();
1627
+ }
1628
+ return std::string(buffer, (size_t) length);
1629
+ }
1630
+
1631
+ template <typename... Args>
1632
+ str format(Args &&...args) const {
1633
+ return attr("format")(std::forward<Args>(args)...);
1634
+ }
1635
+
1636
+ private:
1637
+ /// Return string representation -- always returns a new reference, even if already a str
1638
+ static PyObject *raw_str(PyObject *op) {
1639
+ PyObject *str_value = PyObject_Str(op);
1640
+ return str_value;
1641
+ }
1642
+ };
1643
+ /// @} pytypes
1644
+
1645
+ inline namespace literals {
1646
+ /** \rst
1647
+ String literal version of `str`
1648
+ \endrst */
1649
+ inline str
1650
+ #if !defined(__clang__) && defined(__GNUC__) && __GNUC__ < 5
1651
+ operator"" _s // gcc 4.8.5 insists on having a space (hard error).
1652
+ #else
1653
+ operator""_s // clang 17 generates a deprecation warning if there is a space.
1654
+ #endif
1655
+ (const char *s, size_t size) {
1656
+ return {s, size};
1657
+ }
1658
+ } // namespace literals
1659
+
1660
+ /// \addtogroup pytypes
1661
+ /// @{
1662
+ class bytes : public object {
1663
+ public:
1664
+ PYBIND11_OBJECT(bytes, object, PYBIND11_BYTES_CHECK)
1665
+
1666
+ // Allow implicit conversion:
1667
+ // NOLINTNEXTLINE(google-explicit-constructor)
1668
+ bytes(const char *c = "") : object(PYBIND11_BYTES_FROM_STRING(c), stolen_t{}) {
1669
+ if (!m_ptr) {
1670
+ pybind11_fail("Could not allocate bytes object!");
1671
+ }
1672
+ }
1673
+
1674
+ template <typename SzType, detail::enable_if_t<std::is_integral<SzType>::value, int> = 0>
1675
+ bytes(const char *c, const SzType &n)
1676
+ : object(PYBIND11_BYTES_FROM_STRING_AND_SIZE(c, ssize_t_cast(n)), stolen_t{}) {
1677
+ if (!m_ptr) {
1678
+ pybind11_fail("Could not allocate bytes object!");
1679
+ }
1680
+ }
1681
+
1682
+ // Allow implicit conversion:
1683
+ // NOLINTNEXTLINE(google-explicit-constructor)
1684
+ bytes(const std::string &s) : bytes(s.data(), s.size()) {}
1685
+
1686
+ explicit bytes(const pybind11::str &s);
1687
+
1688
+ // NOLINTNEXTLINE(google-explicit-constructor)
1689
+ operator std::string() const { return string_op<std::string>(); }
1690
+
1691
+ #ifdef PYBIND11_HAS_STRING_VIEW
1692
+ // enable_if is needed to avoid "ambiguous conversion" errors (see PR #3521).
1693
+ template <typename T, detail::enable_if_t<std::is_same<T, std::string_view>::value, int> = 0>
1694
+ // NOLINTNEXTLINE(google-explicit-constructor)
1695
+ bytes(T s) : bytes(s.data(), s.size()) {}
1696
+
1697
+ // Obtain a string view that views the current `bytes` buffer value. Note that this is only
1698
+ // valid so long as the `bytes` instance remains alive and so generally should not outlive the
1699
+ // lifetime of the `bytes` instance.
1700
+ // NOLINTNEXTLINE(google-explicit-constructor)
1701
+ operator std::string_view() const { return string_op<std::string_view>(); }
1702
+ #endif
1703
+ private:
1704
+ template <typename T>
1705
+ T string_op() const {
1706
+ char *buffer = nullptr;
1707
+ ssize_t length = 0;
1708
+ if (PyBytes_AsStringAndSize(m_ptr, &buffer, &length) != 0) {
1709
+ throw error_already_set();
1710
+ }
1711
+ return {buffer, static_cast<size_t>(length)};
1712
+ }
1713
+ };
1714
+ // Note: breathe >= 4.17.0 will fail to build docs if the below two constructors
1715
+ // are included in the doxygen group; close here and reopen after as a workaround
1716
+ /// @} pytypes
1717
+
1718
+ inline bytes::bytes(const pybind11::str &s) {
1719
+ object temp = s;
1720
+ if (PyUnicode_Check(s.ptr())) {
1721
+ temp = reinterpret_steal<object>(PyUnicode_AsUTF8String(s.ptr()));
1722
+ if (!temp) {
1723
+ throw error_already_set();
1724
+ }
1725
+ }
1726
+ char *buffer = nullptr;
1727
+ ssize_t length = 0;
1728
+ if (PyBytes_AsStringAndSize(temp.ptr(), &buffer, &length) != 0) {
1729
+ throw error_already_set();
1730
+ }
1731
+ auto obj = reinterpret_steal<object>(PYBIND11_BYTES_FROM_STRING_AND_SIZE(buffer, length));
1732
+ if (!obj) {
1733
+ pybind11_fail("Could not allocate bytes object!");
1734
+ }
1735
+ m_ptr = obj.release().ptr();
1736
+ }
1737
+
1738
+ inline str::str(const bytes &b) {
1739
+ char *buffer = nullptr;
1740
+ ssize_t length = 0;
1741
+ if (PyBytes_AsStringAndSize(b.ptr(), &buffer, &length) != 0) {
1742
+ throw error_already_set();
1743
+ }
1744
+ auto obj = reinterpret_steal<object>(PyUnicode_FromStringAndSize(buffer, length));
1745
+ if (!obj) {
1746
+ if (PyErr_Occurred()) {
1747
+ throw error_already_set();
1748
+ }
1749
+ pybind11_fail("Could not allocate string object!");
1750
+ }
1751
+ m_ptr = obj.release().ptr();
1752
+ }
1753
+
1754
+ /// \addtogroup pytypes
1755
+ /// @{
1756
+ class bytearray : public object {
1757
+ public:
1758
+ PYBIND11_OBJECT_CVT(bytearray, object, PyByteArray_Check, PyByteArray_FromObject)
1759
+
1760
+ template <typename SzType, detail::enable_if_t<std::is_integral<SzType>::value, int> = 0>
1761
+ bytearray(const char *c, const SzType &n)
1762
+ : object(PyByteArray_FromStringAndSize(c, ssize_t_cast(n)), stolen_t{}) {
1763
+ if (!m_ptr) {
1764
+ pybind11_fail("Could not allocate bytearray object!");
1765
+ }
1766
+ }
1767
+
1768
+ bytearray() : bytearray("", 0) {}
1769
+
1770
+ explicit bytearray(const std::string &s) : bytearray(s.data(), s.size()) {}
1771
+
1772
+ size_t size() const { return static_cast<size_t>(PyByteArray_Size(m_ptr)); }
1773
+
1774
+ explicit operator std::string() const {
1775
+ char *buffer = PyByteArray_AS_STRING(m_ptr);
1776
+ ssize_t size = PyByteArray_GET_SIZE(m_ptr);
1777
+ return std::string(buffer, static_cast<size_t>(size));
1778
+ }
1779
+ };
1780
+ // Note: breathe >= 4.17.0 will fail to build docs if the below two constructors
1781
+ // are included in the doxygen group; close here and reopen after as a workaround
1782
+ /// @} pytypes
1783
+
1784
+ /// \addtogroup pytypes
1785
+ /// @{
1786
+ class none : public object {
1787
+ public:
1788
+ PYBIND11_OBJECT(none, object, detail::PyNone_Check)
1789
+ none() : object(Py_None, borrowed_t{}) {}
1790
+ };
1791
+
1792
+ class ellipsis : public object {
1793
+ public:
1794
+ PYBIND11_OBJECT(ellipsis, object, detail::PyEllipsis_Check)
1795
+ ellipsis() : object(Py_Ellipsis, borrowed_t{}) {}
1796
+ };
1797
+
1798
+ class bool_ : public object {
1799
+ public:
1800
+ PYBIND11_OBJECT_CVT(bool_, object, PyBool_Check, raw_bool)
1801
+ bool_() : object(Py_False, borrowed_t{}) {}
1802
+ // Allow implicit conversion from and to `bool`:
1803
+ // NOLINTNEXTLINE(google-explicit-constructor)
1804
+ bool_(bool value) : object(value ? Py_True : Py_False, borrowed_t{}) {}
1805
+ // NOLINTNEXTLINE(google-explicit-constructor)
1806
+ operator bool() const { return (m_ptr != nullptr) && PyLong_AsLong(m_ptr) != 0; }
1807
+
1808
+ private:
1809
+ /// Return the truth value of an object -- always returns a new reference
1810
+ static PyObject *raw_bool(PyObject *op) {
1811
+ const auto value = PyObject_IsTrue(op);
1812
+ if (value == -1) {
1813
+ return nullptr;
1814
+ }
1815
+ return handle(value != 0 ? Py_True : Py_False).inc_ref().ptr();
1816
+ }
1817
+ };
1818
+
1819
+ PYBIND11_NAMESPACE_BEGIN(detail)
1820
+ // Converts a value to the given unsigned type. If an error occurs, you get back (Unsigned) -1;
1821
+ // otherwise you get back the unsigned long or unsigned long long value cast to (Unsigned).
1822
+ // (The distinction is critically important when casting a returned -1 error value to some other
1823
+ // unsigned type: (A)-1 != (B)-1 when A and B are unsigned types of different sizes).
1824
+ template <typename Unsigned>
1825
+ Unsigned as_unsigned(PyObject *o) {
1826
+ if (sizeof(Unsigned) <= sizeof(unsigned long)) {
1827
+ unsigned long v = PyLong_AsUnsignedLong(o);
1828
+ return v == (unsigned long) -1 && PyErr_Occurred() ? (Unsigned) -1 : (Unsigned) v;
1829
+ }
1830
+ unsigned long long v = PyLong_AsUnsignedLongLong(o);
1831
+ return v == (unsigned long long) -1 && PyErr_Occurred() ? (Unsigned) -1 : (Unsigned) v;
1832
+ }
1833
+ PYBIND11_NAMESPACE_END(detail)
1834
+
1835
+ class int_ : public object {
1836
+ public:
1837
+ PYBIND11_OBJECT_CVT(int_, object, PYBIND11_LONG_CHECK, PyNumber_Long)
1838
+ int_() : object(PyLong_FromLong(0), stolen_t{}) {}
1839
+ // Allow implicit conversion from C++ integral types:
1840
+ template <typename T, detail::enable_if_t<std::is_integral<T>::value, int> = 0>
1841
+ // NOLINTNEXTLINE(google-explicit-constructor)
1842
+ int_(T value) {
1843
+ if (sizeof(T) <= sizeof(long)) {
1844
+ if (std::is_signed<T>::value) {
1845
+ m_ptr = PyLong_FromLong((long) value);
1846
+ } else {
1847
+ m_ptr = PyLong_FromUnsignedLong((unsigned long) value);
1848
+ }
1849
+ } else {
1850
+ if (std::is_signed<T>::value) {
1851
+ m_ptr = PyLong_FromLongLong((long long) value);
1852
+ } else {
1853
+ m_ptr = PyLong_FromUnsignedLongLong((unsigned long long) value);
1854
+ }
1855
+ }
1856
+ if (!m_ptr) {
1857
+ pybind11_fail("Could not allocate int object!");
1858
+ }
1859
+ }
1860
+
1861
+ template <typename T, detail::enable_if_t<std::is_integral<T>::value, int> = 0>
1862
+ // NOLINTNEXTLINE(google-explicit-constructor)
1863
+ operator T() const {
1864
+ return std::is_unsigned<T>::value ? detail::as_unsigned<T>(m_ptr)
1865
+ : sizeof(T) <= sizeof(long) ? (T) PyLong_AsLong(m_ptr)
1866
+ : (T) PYBIND11_LONG_AS_LONGLONG(m_ptr);
1867
+ }
1868
+ };
1869
+
1870
+ class float_ : public object {
1871
+ public:
1872
+ PYBIND11_OBJECT_CVT(float_, object, PyFloat_Check, PyNumber_Float)
1873
+ // Allow implicit conversion from float/double:
1874
+ // NOLINTNEXTLINE(google-explicit-constructor)
1875
+ float_(float value) : object(PyFloat_FromDouble((double) value), stolen_t{}) {
1876
+ if (!m_ptr) {
1877
+ pybind11_fail("Could not allocate float object!");
1878
+ }
1879
+ }
1880
+ // NOLINTNEXTLINE(google-explicit-constructor)
1881
+ float_(double value = .0) : object(PyFloat_FromDouble((double) value), stolen_t{}) {
1882
+ if (!m_ptr) {
1883
+ pybind11_fail("Could not allocate float object!");
1884
+ }
1885
+ }
1886
+ // NOLINTNEXTLINE(google-explicit-constructor)
1887
+ operator float() const { return (float) PyFloat_AsDouble(m_ptr); }
1888
+ // NOLINTNEXTLINE(google-explicit-constructor)
1889
+ operator double() const { return (double) PyFloat_AsDouble(m_ptr); }
1890
+ };
1891
+
1892
+ class weakref : public object {
1893
+ public:
1894
+ PYBIND11_OBJECT_CVT_DEFAULT(weakref, object, PyWeakref_Check, raw_weakref)
1895
+ explicit weakref(handle obj, handle callback = {})
1896
+ : object(PyWeakref_NewRef(obj.ptr(), callback.ptr()), stolen_t{}) {
1897
+ if (!m_ptr) {
1898
+ if (PyErr_Occurred()) {
1899
+ throw error_already_set();
1900
+ }
1901
+ pybind11_fail("Could not allocate weak reference!");
1902
+ }
1903
+ }
1904
+
1905
+ private:
1906
+ static PyObject *raw_weakref(PyObject *o) { return PyWeakref_NewRef(o, nullptr); }
1907
+ };
1908
+
1909
+ class slice : public object {
1910
+ public:
1911
+ PYBIND11_OBJECT_DEFAULT(slice, object, PySlice_Check)
1912
+ slice(handle start, handle stop, handle step)
1913
+ : object(PySlice_New(start.ptr(), stop.ptr(), step.ptr()), stolen_t{}) {
1914
+ if (!m_ptr) {
1915
+ pybind11_fail("Could not allocate slice object!");
1916
+ }
1917
+ }
1918
+
1919
+ #ifdef PYBIND11_HAS_OPTIONAL
1920
+ slice(std::optional<ssize_t> start, std::optional<ssize_t> stop, std::optional<ssize_t> step)
1921
+ : slice(index_to_object(start), index_to_object(stop), index_to_object(step)) {}
1922
+ #else
1923
+ slice(ssize_t start_, ssize_t stop_, ssize_t step_)
1924
+ : slice(int_(start_), int_(stop_), int_(step_)) {}
1925
+ #endif
1926
+
1927
+ bool
1928
+ compute(size_t length, size_t *start, size_t *stop, size_t *step, size_t *slicelength) const {
1929
+ return PySlice_GetIndicesEx((PYBIND11_SLICE_OBJECT *) m_ptr,
1930
+ (ssize_t) length,
1931
+ (ssize_t *) start,
1932
+ (ssize_t *) stop,
1933
+ (ssize_t *) step,
1934
+ (ssize_t *) slicelength)
1935
+ == 0;
1936
+ }
1937
+ bool compute(
1938
+ ssize_t length, ssize_t *start, ssize_t *stop, ssize_t *step, ssize_t *slicelength) const {
1939
+ return PySlice_GetIndicesEx(
1940
+ (PYBIND11_SLICE_OBJECT *) m_ptr, length, start, stop, step, slicelength)
1941
+ == 0;
1942
+ }
1943
+
1944
+ private:
1945
+ template <typename T>
1946
+ static object index_to_object(T index) {
1947
+ return index ? object(int_(*index)) : object(none());
1948
+ }
1949
+ };
1950
+
1951
+ class capsule : public object {
1952
+ public:
1953
+ PYBIND11_OBJECT_DEFAULT(capsule, object, PyCapsule_CheckExact)
1954
+ PYBIND11_DEPRECATED("Use reinterpret_borrow<capsule>() or reinterpret_steal<capsule>()")
1955
+ capsule(PyObject *ptr, bool is_borrowed)
1956
+ : object(is_borrowed ? object(ptr, borrowed_t{}) : object(ptr, stolen_t{})) {}
1957
+
1958
+ explicit capsule(const void *value,
1959
+ const char *name = nullptr,
1960
+ PyCapsule_Destructor destructor = nullptr)
1961
+ : object(PyCapsule_New(const_cast<void *>(value), name, destructor), stolen_t{}) {
1962
+ if (!m_ptr) {
1963
+ throw error_already_set();
1964
+ }
1965
+ }
1966
+
1967
+ PYBIND11_DEPRECATED("Please use the ctor with value, name, destructor args")
1968
+ capsule(const void *value, PyCapsule_Destructor destructor)
1969
+ : object(PyCapsule_New(const_cast<void *>(value), nullptr, destructor), stolen_t{}) {
1970
+ if (!m_ptr) {
1971
+ throw error_already_set();
1972
+ }
1973
+ }
1974
+
1975
+ /// Capsule name is nullptr.
1976
+ capsule(const void *value, void (*destructor)(void *)) {
1977
+ initialize_with_void_ptr_destructor(value, nullptr, destructor);
1978
+ }
1979
+
1980
+ capsule(const void *value, const char *name, void (*destructor)(void *)) {
1981
+ initialize_with_void_ptr_destructor(value, name, destructor);
1982
+ }
1983
+
1984
+ explicit capsule(void (*destructor)()) {
1985
+ m_ptr = PyCapsule_New(reinterpret_cast<void *>(destructor), nullptr, [](PyObject *o) {
1986
+ const char *name = get_name_in_error_scope(o);
1987
+ auto destructor = reinterpret_cast<void (*)()>(PyCapsule_GetPointer(o, name));
1988
+ if (destructor == nullptr) {
1989
+ throw error_already_set();
1990
+ }
1991
+ destructor();
1992
+ });
1993
+
1994
+ if (!m_ptr) {
1995
+ throw error_already_set();
1996
+ }
1997
+ }
1998
+
1999
+ template <typename T>
2000
+ operator T *() const { // NOLINT(google-explicit-constructor)
2001
+ return get_pointer<T>();
2002
+ }
2003
+
2004
+ /// Get the pointer the capsule holds.
2005
+ template <typename T = void>
2006
+ T *get_pointer() const {
2007
+ const auto *name = this->name();
2008
+ T *result = static_cast<T *>(PyCapsule_GetPointer(m_ptr, name));
2009
+ if (!result) {
2010
+ throw error_already_set();
2011
+ }
2012
+ return result;
2013
+ }
2014
+
2015
+ /// Replaces a capsule's pointer *without* calling the destructor on the existing one.
2016
+ void set_pointer(const void *value) {
2017
+ if (PyCapsule_SetPointer(m_ptr, const_cast<void *>(value)) != 0) {
2018
+ throw error_already_set();
2019
+ }
2020
+ }
2021
+
2022
+ const char *name() const {
2023
+ const char *name = PyCapsule_GetName(m_ptr);
2024
+ if ((name == nullptr) && PyErr_Occurred()) {
2025
+ throw error_already_set();
2026
+ }
2027
+ return name;
2028
+ }
2029
+
2030
+ /// Replaces a capsule's name *without* calling the destructor on the existing one.
2031
+ void set_name(const char *new_name) {
2032
+ if (PyCapsule_SetName(m_ptr, new_name) != 0) {
2033
+ throw error_already_set();
2034
+ }
2035
+ }
2036
+
2037
+ private:
2038
+ static const char *get_name_in_error_scope(PyObject *o) {
2039
+ error_scope error_guard;
2040
+
2041
+ const char *name = PyCapsule_GetName(o);
2042
+ if ((name == nullptr) && PyErr_Occurred()) {
2043
+ // write out and consume error raised by call to PyCapsule_GetName
2044
+ PyErr_WriteUnraisable(o);
2045
+ }
2046
+
2047
+ return name;
2048
+ }
2049
+
2050
+ void initialize_with_void_ptr_destructor(const void *value,
2051
+ const char *name,
2052
+ void (*destructor)(void *)) {
2053
+ m_ptr = PyCapsule_New(const_cast<void *>(value), name, [](PyObject *o) {
2054
+ // guard if destructor called while err indicator is set
2055
+ error_scope error_guard;
2056
+ auto destructor = reinterpret_cast<void (*)(void *)>(PyCapsule_GetContext(o));
2057
+ if (destructor == nullptr && PyErr_Occurred()) {
2058
+ throw error_already_set();
2059
+ }
2060
+ const char *name = get_name_in_error_scope(o);
2061
+ void *ptr = PyCapsule_GetPointer(o, name);
2062
+ if (ptr == nullptr) {
2063
+ throw error_already_set();
2064
+ }
2065
+
2066
+ if (destructor != nullptr) {
2067
+ destructor(ptr);
2068
+ }
2069
+ });
2070
+
2071
+ if (!m_ptr || PyCapsule_SetContext(m_ptr, reinterpret_cast<void *>(destructor)) != 0) {
2072
+ throw error_already_set();
2073
+ }
2074
+ }
2075
+ };
2076
+
2077
+ class tuple : public object {
2078
+ public:
2079
+ PYBIND11_OBJECT_CVT(tuple, object, PyTuple_Check, PySequence_Tuple)
2080
+ template <typename SzType = ssize_t,
2081
+ detail::enable_if_t<std::is_integral<SzType>::value, int> = 0>
2082
+ // Some compilers generate link errors when using `const SzType &` here:
2083
+ explicit tuple(SzType size = 0) : object(PyTuple_New(ssize_t_cast(size)), stolen_t{}) {
2084
+ if (!m_ptr) {
2085
+ pybind11_fail("Could not allocate tuple object!");
2086
+ }
2087
+ }
2088
+ size_t size() const { return (size_t) PyTuple_Size(m_ptr); }
2089
+ bool empty() const { return size() == 0; }
2090
+ detail::tuple_accessor operator[](size_t index) const { return {*this, index}; }
2091
+ template <typename T, detail::enable_if_t<detail::is_pyobject<T>::value, int> = 0>
2092
+ detail::item_accessor operator[](T &&o) const {
2093
+ return object::operator[](std::forward<T>(o));
2094
+ }
2095
+ detail::tuple_iterator begin() const { return {*this, 0}; }
2096
+ detail::tuple_iterator end() const { return {*this, PyTuple_GET_SIZE(m_ptr)}; }
2097
+ };
2098
+
2099
+ // We need to put this into a separate function because the Intel compiler
2100
+ // fails to compile enable_if_t<all_of<is_keyword_or_ds<Args>...>::value> part below
2101
+ // (tested with ICC 2021.1 Beta 20200827).
2102
+ template <typename... Args>
2103
+ constexpr bool args_are_all_keyword_or_ds() {
2104
+ return detail::all_of<detail::is_keyword_or_ds<Args>...>::value;
2105
+ }
2106
+
2107
+ class dict : public object {
2108
+ public:
2109
+ PYBIND11_OBJECT_CVT(dict, object, PyDict_Check, raw_dict)
2110
+ dict() : object(PyDict_New(), stolen_t{}) {
2111
+ if (!m_ptr) {
2112
+ pybind11_fail("Could not allocate dict object!");
2113
+ }
2114
+ }
2115
+ template <typename... Args,
2116
+ typename = detail::enable_if_t<args_are_all_keyword_or_ds<Args...>()>,
2117
+ // MSVC workaround: it can't compile an out-of-line definition, so defer the
2118
+ // collector
2119
+ typename collector = detail::deferred_t<detail::unpacking_collector<>, Args...>>
2120
+ explicit dict(Args &&...args) : dict(collector(std::forward<Args>(args)...).kwargs()) {}
2121
+
2122
+ size_t size() const { return (size_t) PyDict_Size(m_ptr); }
2123
+ bool empty() const { return size() == 0; }
2124
+ detail::dict_iterator begin() const { return {*this, 0}; }
2125
+ detail::dict_iterator end() const { return {}; }
2126
+ void clear() /* py-non-const */ { PyDict_Clear(ptr()); }
2127
+ template <typename T>
2128
+ bool contains(T &&key) const {
2129
+ auto result = PyDict_Contains(m_ptr, detail::object_or_cast(std::forward<T>(key)).ptr());
2130
+ if (result == -1) {
2131
+ throw error_already_set();
2132
+ }
2133
+ return result == 1;
2134
+ }
2135
+
2136
+ private:
2137
+ /// Call the `dict` Python type -- always returns a new reference
2138
+ static PyObject *raw_dict(PyObject *op) {
2139
+ if (PyDict_Check(op)) {
2140
+ return handle(op).inc_ref().ptr();
2141
+ }
2142
+ return PyObject_CallFunctionObjArgs((PyObject *) &PyDict_Type, op, nullptr);
2143
+ }
2144
+ };
2145
+
2146
+ class sequence : public object {
2147
+ public:
2148
+ PYBIND11_OBJECT_DEFAULT(sequence, object, PySequence_Check)
2149
+ size_t size() const {
2150
+ ssize_t result = PySequence_Size(m_ptr);
2151
+ if (result == -1) {
2152
+ throw error_already_set();
2153
+ }
2154
+ return (size_t) result;
2155
+ }
2156
+ bool empty() const { return size() == 0; }
2157
+ detail::sequence_accessor operator[](size_t index) const { return {*this, index}; }
2158
+ template <typename T, detail::enable_if_t<detail::is_pyobject<T>::value, int> = 0>
2159
+ detail::item_accessor operator[](T &&o) const {
2160
+ return object::operator[](std::forward<T>(o));
2161
+ }
2162
+ detail::sequence_iterator begin() const { return {*this, 0}; }
2163
+ detail::sequence_iterator end() const { return {*this, PySequence_Size(m_ptr)}; }
2164
+ };
2165
+
2166
+ class list : public object {
2167
+ public:
2168
+ PYBIND11_OBJECT_CVT(list, object, PyList_Check, PySequence_List)
2169
+ template <typename SzType = ssize_t,
2170
+ detail::enable_if_t<std::is_integral<SzType>::value, int> = 0>
2171
+ // Some compilers generate link errors when using `const SzType &` here:
2172
+ explicit list(SzType size = 0) : object(PyList_New(ssize_t_cast(size)), stolen_t{}) {
2173
+ if (!m_ptr) {
2174
+ pybind11_fail("Could not allocate list object!");
2175
+ }
2176
+ }
2177
+ size_t size() const { return (size_t) PyList_Size(m_ptr); }
2178
+ bool empty() const { return size() == 0; }
2179
+ detail::list_accessor operator[](size_t index) const { return {*this, index}; }
2180
+ template <typename T, detail::enable_if_t<detail::is_pyobject<T>::value, int> = 0>
2181
+ detail::item_accessor operator[](T &&o) const {
2182
+ return object::operator[](std::forward<T>(o));
2183
+ }
2184
+ detail::list_iterator begin() const { return {*this, 0}; }
2185
+ detail::list_iterator end() const { return {*this, PyList_GET_SIZE(m_ptr)}; }
2186
+ template <typename T>
2187
+ void append(T &&val) /* py-non-const */ {
2188
+ if (PyList_Append(m_ptr, detail::object_or_cast(std::forward<T>(val)).ptr()) != 0) {
2189
+ throw error_already_set();
2190
+ }
2191
+ }
2192
+ template <typename IdxType,
2193
+ typename ValType,
2194
+ detail::enable_if_t<std::is_integral<IdxType>::value, int> = 0>
2195
+ void insert(const IdxType &index, ValType &&val) /* py-non-const */ {
2196
+ if (PyList_Insert(m_ptr,
2197
+ ssize_t_cast(index),
2198
+ detail::object_or_cast(std::forward<ValType>(val)).ptr())
2199
+ != 0) {
2200
+ throw error_already_set();
2201
+ }
2202
+ }
2203
+ void clear() /* py-non-const */ {
2204
+ if (PyList_SetSlice(m_ptr, 0, PyList_Size(m_ptr), nullptr) == -1) {
2205
+ throw error_already_set();
2206
+ }
2207
+ }
2208
+ };
2209
+
2210
+ class args : public tuple {
2211
+ PYBIND11_OBJECT_DEFAULT(args, tuple, PyTuple_Check)
2212
+ };
2213
+ class kwargs : public dict {
2214
+ PYBIND11_OBJECT_DEFAULT(kwargs, dict, PyDict_Check)
2215
+ };
2216
+
2217
+ class anyset : public object {
2218
+ public:
2219
+ PYBIND11_OBJECT(anyset, object, PyAnySet_Check)
2220
+ size_t size() const { return static_cast<size_t>(PySet_Size(m_ptr)); }
2221
+ bool empty() const { return size() == 0; }
2222
+ template <typename T>
2223
+ bool contains(T &&val) const {
2224
+ auto result = PySet_Contains(m_ptr, detail::object_or_cast(std::forward<T>(val)).ptr());
2225
+ if (result == -1) {
2226
+ throw error_already_set();
2227
+ }
2228
+ return result == 1;
2229
+ }
2230
+ };
2231
+
2232
+ class set : public anyset {
2233
+ public:
2234
+ PYBIND11_OBJECT_CVT(set, anyset, PySet_Check, PySet_New)
2235
+ set() : anyset(PySet_New(nullptr), stolen_t{}) {
2236
+ if (!m_ptr) {
2237
+ pybind11_fail("Could not allocate set object!");
2238
+ }
2239
+ }
2240
+ template <typename T>
2241
+ bool add(T &&val) /* py-non-const */ {
2242
+ return PySet_Add(m_ptr, detail::object_or_cast(std::forward<T>(val)).ptr()) == 0;
2243
+ }
2244
+ void clear() /* py-non-const */ { PySet_Clear(m_ptr); }
2245
+ };
2246
+
2247
+ class frozenset : public anyset {
2248
+ public:
2249
+ PYBIND11_OBJECT_CVT(frozenset, anyset, PyFrozenSet_Check, PyFrozenSet_New)
2250
+ };
2251
+
2252
+ class function : public object {
2253
+ public:
2254
+ PYBIND11_OBJECT_DEFAULT(function, object, PyCallable_Check)
2255
+ handle cpp_function() const {
2256
+ handle fun = detail::get_function(m_ptr);
2257
+ if (fun && PyCFunction_Check(fun.ptr())) {
2258
+ return fun;
2259
+ }
2260
+ return handle();
2261
+ }
2262
+ bool is_cpp_function() const { return (bool) cpp_function(); }
2263
+ };
2264
+
2265
+ class staticmethod : public object {
2266
+ public:
2267
+ PYBIND11_OBJECT_CVT(staticmethod, object, detail::PyStaticMethod_Check, PyStaticMethod_New)
2268
+ };
2269
+
2270
+ class buffer : public object {
2271
+ public:
2272
+ PYBIND11_OBJECT_DEFAULT(buffer, object, PyObject_CheckBuffer)
2273
+
2274
+ buffer_info request(bool writable = false) const {
2275
+ int flags = PyBUF_STRIDES | PyBUF_FORMAT;
2276
+ if (writable) {
2277
+ flags |= PyBUF_WRITABLE;
2278
+ }
2279
+ auto *view = new Py_buffer();
2280
+ if (PyObject_GetBuffer(m_ptr, view, flags) != 0) {
2281
+ delete view;
2282
+ throw error_already_set();
2283
+ }
2284
+ return buffer_info(view);
2285
+ }
2286
+ };
2287
+
2288
+ class memoryview : public object {
2289
+ public:
2290
+ PYBIND11_OBJECT_CVT(memoryview, object, PyMemoryView_Check, PyMemoryView_FromObject)
2291
+
2292
+ /** \rst
2293
+ Creates ``memoryview`` from ``buffer_info``.
2294
+
2295
+ ``buffer_info`` must be created from ``buffer::request()``. Otherwise
2296
+ throws an exception.
2297
+
2298
+ For creating a ``memoryview`` from objects that support buffer protocol,
2299
+ use ``memoryview(const object& obj)`` instead of this constructor.
2300
+ \endrst */
2301
+ explicit memoryview(const buffer_info &info) {
2302
+ if (!info.view()) {
2303
+ pybind11_fail("Prohibited to create memoryview without Py_buffer");
2304
+ }
2305
+ // Note: PyMemoryView_FromBuffer never increments obj reference.
2306
+ m_ptr = (info.view()->obj) ? PyMemoryView_FromObject(info.view()->obj)
2307
+ : PyMemoryView_FromBuffer(info.view());
2308
+ if (!m_ptr) {
2309
+ pybind11_fail("Unable to create memoryview from buffer descriptor");
2310
+ }
2311
+ }
2312
+
2313
+ /** \rst
2314
+ Creates ``memoryview`` from static buffer.
2315
+
2316
+ This method is meant for providing a ``memoryview`` for C/C++ buffer not
2317
+ managed by Python. The caller is responsible for managing the lifetime
2318
+ of ``ptr`` and ``format``, which MUST outlive the memoryview constructed
2319
+ here.
2320
+
2321
+ See also: Python C API documentation for `PyMemoryView_FromBuffer`_.
2322
+
2323
+ .. _PyMemoryView_FromBuffer:
2324
+ https://docs.python.org/c-api/memoryview.html#c.PyMemoryView_FromBuffer
2325
+
2326
+ :param ptr: Pointer to the buffer.
2327
+ :param itemsize: Byte size of an element.
2328
+ :param format: Pointer to the null-terminated format string. For
2329
+ homogeneous Buffers, this should be set to
2330
+ ``format_descriptor<T>::value``.
2331
+ :param shape: Shape of the tensor (1 entry per dimension).
2332
+ :param strides: Number of bytes between adjacent entries (for each
2333
+ per dimension).
2334
+ :param readonly: Flag to indicate if the underlying storage may be
2335
+ written to.
2336
+ \endrst */
2337
+ static memoryview from_buffer(void *ptr,
2338
+ ssize_t itemsize,
2339
+ const char *format,
2340
+ detail::any_container<ssize_t> shape,
2341
+ detail::any_container<ssize_t> strides,
2342
+ bool readonly = false);
2343
+
2344
+ static memoryview from_buffer(const void *ptr,
2345
+ ssize_t itemsize,
2346
+ const char *format,
2347
+ detail::any_container<ssize_t> shape,
2348
+ detail::any_container<ssize_t> strides) {
2349
+ return memoryview::from_buffer(
2350
+ const_cast<void *>(ptr), itemsize, format, std::move(shape), std::move(strides), true);
2351
+ }
2352
+
2353
+ template <typename T>
2354
+ static memoryview from_buffer(T *ptr,
2355
+ detail::any_container<ssize_t> shape,
2356
+ detail::any_container<ssize_t> strides,
2357
+ bool readonly = false) {
2358
+ return memoryview::from_buffer(reinterpret_cast<void *>(ptr),
2359
+ sizeof(T),
2360
+ format_descriptor<T>::value,
2361
+ std::move(shape),
2362
+ std::move(strides),
2363
+ readonly);
2364
+ }
2365
+
2366
+ template <typename T>
2367
+ static memoryview from_buffer(const T *ptr,
2368
+ detail::any_container<ssize_t> shape,
2369
+ detail::any_container<ssize_t> strides) {
2370
+ return memoryview::from_buffer(
2371
+ const_cast<T *>(ptr), std::move(shape), std::move(strides), true);
2372
+ }
2373
+
2374
+ /** \rst
2375
+ Creates ``memoryview`` from static memory.
2376
+
2377
+ This method is meant for providing a ``memoryview`` for C/C++ buffer not
2378
+ managed by Python. The caller is responsible for managing the lifetime
2379
+ of ``mem``, which MUST outlive the memoryview constructed here.
2380
+
2381
+ See also: Python C API documentation for `PyMemoryView_FromBuffer`_.
2382
+
2383
+ .. _PyMemoryView_FromMemory:
2384
+ https://docs.python.org/c-api/memoryview.html#c.PyMemoryView_FromMemory
2385
+ \endrst */
2386
+ static memoryview from_memory(void *mem, ssize_t size, bool readonly = false) {
2387
+ PyObject *ptr = PyMemoryView_FromMemory(
2388
+ reinterpret_cast<char *>(mem), size, (readonly) ? PyBUF_READ : PyBUF_WRITE);
2389
+ if (!ptr) {
2390
+ pybind11_fail("Could not allocate memoryview object!");
2391
+ }
2392
+ return memoryview(object(ptr, stolen_t{}));
2393
+ }
2394
+
2395
+ static memoryview from_memory(const void *mem, ssize_t size) {
2396
+ return memoryview::from_memory(const_cast<void *>(mem), size, true);
2397
+ }
2398
+
2399
+ #ifdef PYBIND11_HAS_STRING_VIEW
2400
+ static memoryview from_memory(std::string_view mem) {
2401
+ return from_memory(const_cast<char *>(mem.data()), static_cast<ssize_t>(mem.size()), true);
2402
+ }
2403
+ #endif
2404
+ };
2405
+
2406
+ /// @cond DUPLICATE
2407
+ inline memoryview memoryview::from_buffer(void *ptr,
2408
+ ssize_t itemsize,
2409
+ const char *format,
2410
+ detail::any_container<ssize_t> shape,
2411
+ detail::any_container<ssize_t> strides,
2412
+ bool readonly) {
2413
+ size_t ndim = shape->size();
2414
+ if (ndim != strides->size()) {
2415
+ pybind11_fail("memoryview: shape length doesn't match strides length");
2416
+ }
2417
+ ssize_t size = ndim != 0u ? 1 : 0;
2418
+ for (size_t i = 0; i < ndim; ++i) {
2419
+ size *= (*shape)[i];
2420
+ }
2421
+ Py_buffer view;
2422
+ view.buf = ptr;
2423
+ view.obj = nullptr;
2424
+ view.len = size * itemsize;
2425
+ view.readonly = static_cast<int>(readonly);
2426
+ view.itemsize = itemsize;
2427
+ view.format = const_cast<char *>(format);
2428
+ view.ndim = static_cast<int>(ndim);
2429
+ view.shape = shape->data();
2430
+ view.strides = strides->data();
2431
+ view.suboffsets = nullptr;
2432
+ view.internal = nullptr;
2433
+ PyObject *obj = PyMemoryView_FromBuffer(&view);
2434
+ if (!obj) {
2435
+ throw error_already_set();
2436
+ }
2437
+ return memoryview(object(obj, stolen_t{}));
2438
+ }
2439
+ /// @endcond
2440
+ /// @} pytypes
2441
+
2442
+ /// \addtogroup python_builtins
2443
+ /// @{
2444
+
2445
+ /// Get the length of a Python object.
2446
+ inline size_t len(handle h) {
2447
+ ssize_t result = PyObject_Length(h.ptr());
2448
+ if (result < 0) {
2449
+ throw error_already_set();
2450
+ }
2451
+ return (size_t) result;
2452
+ }
2453
+
2454
+ /// Get the length hint of a Python object.
2455
+ /// Returns 0 when this cannot be determined.
2456
+ inline size_t len_hint(handle h) {
2457
+ ssize_t result = PyObject_LengthHint(h.ptr(), 0);
2458
+ if (result < 0) {
2459
+ // Sometimes a length can't be determined at all (eg generators)
2460
+ // In which case simply return 0
2461
+ PyErr_Clear();
2462
+ return 0;
2463
+ }
2464
+ return (size_t) result;
2465
+ }
2466
+
2467
+ inline str repr(handle h) {
2468
+ PyObject *str_value = PyObject_Repr(h.ptr());
2469
+ if (!str_value) {
2470
+ throw error_already_set();
2471
+ }
2472
+ return reinterpret_steal<str>(str_value);
2473
+ }
2474
+
2475
+ inline iterator iter(handle obj) {
2476
+ PyObject *result = PyObject_GetIter(obj.ptr());
2477
+ if (!result) {
2478
+ throw error_already_set();
2479
+ }
2480
+ return reinterpret_steal<iterator>(result);
2481
+ }
2482
+ /// @} python_builtins
2483
+
2484
+ PYBIND11_NAMESPACE_BEGIN(detail)
2485
+ template <typename D>
2486
+ iterator object_api<D>::begin() const {
2487
+ return iter(derived());
2488
+ }
2489
+ template <typename D>
2490
+ iterator object_api<D>::end() const {
2491
+ return iterator::sentinel();
2492
+ }
2493
+ template <typename D>
2494
+ item_accessor object_api<D>::operator[](handle key) const {
2495
+ return {derived(), reinterpret_borrow<object>(key)};
2496
+ }
2497
+ template <typename D>
2498
+ item_accessor object_api<D>::operator[](object &&key) const {
2499
+ return {derived(), std::move(key)};
2500
+ }
2501
+ template <typename D>
2502
+ item_accessor object_api<D>::operator[](const char *key) const {
2503
+ return {derived(), pybind11::str(key)};
2504
+ }
2505
+ template <typename D>
2506
+ obj_attr_accessor object_api<D>::attr(handle key) const {
2507
+ return {derived(), reinterpret_borrow<object>(key)};
2508
+ }
2509
+ template <typename D>
2510
+ obj_attr_accessor object_api<D>::attr(object &&key) const {
2511
+ return {derived(), std::move(key)};
2512
+ }
2513
+ template <typename D>
2514
+ str_attr_accessor object_api<D>::attr(const char *key) const {
2515
+ return {derived(), key};
2516
+ }
2517
+ template <typename D>
2518
+ args_proxy object_api<D>::operator*() const {
2519
+ return args_proxy(derived().ptr());
2520
+ }
2521
+ template <typename D>
2522
+ template <typename T>
2523
+ bool object_api<D>::contains(T &&item) const {
2524
+ return attr("__contains__")(std::forward<T>(item)).template cast<bool>();
2525
+ }
2526
+
2527
+ template <typename D>
2528
+ pybind11::str object_api<D>::str() const {
2529
+ return pybind11::str(derived());
2530
+ }
2531
+
2532
+ template <typename D>
2533
+ str_attr_accessor object_api<D>::doc() const {
2534
+ return attr("__doc__");
2535
+ }
2536
+
2537
+ template <typename D>
2538
+ handle object_api<D>::get_type() const {
2539
+ return type::handle_of(derived());
2540
+ }
2541
+
2542
+ template <typename D>
2543
+ bool object_api<D>::rich_compare(object_api const &other, int value) const {
2544
+ int rv = PyObject_RichCompareBool(derived().ptr(), other.derived().ptr(), value);
2545
+ if (rv == -1) {
2546
+ throw error_already_set();
2547
+ }
2548
+ return rv == 1;
2549
+ }
2550
+
2551
+ #define PYBIND11_MATH_OPERATOR_UNARY(op, fn) \
2552
+ template <typename D> \
2553
+ object object_api<D>::op() const { \
2554
+ object result = reinterpret_steal<object>(fn(derived().ptr())); \
2555
+ if (!result.ptr()) \
2556
+ throw error_already_set(); \
2557
+ return result; \
2558
+ }
2559
+
2560
+ #define PYBIND11_MATH_OPERATOR_BINARY(op, fn) \
2561
+ template <typename D> \
2562
+ object object_api<D>::op(object_api const &other) const { \
2563
+ object result = reinterpret_steal<object>(fn(derived().ptr(), other.derived().ptr())); \
2564
+ if (!result.ptr()) \
2565
+ throw error_already_set(); \
2566
+ return result; \
2567
+ }
2568
+
2569
+ #define PYBIND11_MATH_OPERATOR_BINARY_INPLACE(iop, fn) \
2570
+ template <typename D> \
2571
+ object object_api<D>::iop(object_api const &other) { \
2572
+ object result = reinterpret_steal<object>(fn(derived().ptr(), other.derived().ptr())); \
2573
+ if (!result.ptr()) \
2574
+ throw error_already_set(); \
2575
+ return result; \
2576
+ }
2577
+
2578
+ PYBIND11_MATH_OPERATOR_UNARY(operator~, PyNumber_Invert)
2579
+ PYBIND11_MATH_OPERATOR_UNARY(operator-, PyNumber_Negative)
2580
+ PYBIND11_MATH_OPERATOR_BINARY(operator+, PyNumber_Add)
2581
+ PYBIND11_MATH_OPERATOR_BINARY_INPLACE(operator+=, PyNumber_InPlaceAdd)
2582
+ PYBIND11_MATH_OPERATOR_BINARY(operator-, PyNumber_Subtract)
2583
+ PYBIND11_MATH_OPERATOR_BINARY_INPLACE(operator-=, PyNumber_InPlaceSubtract)
2584
+ PYBIND11_MATH_OPERATOR_BINARY(operator*, PyNumber_Multiply)
2585
+ PYBIND11_MATH_OPERATOR_BINARY_INPLACE(operator*=, PyNumber_InPlaceMultiply)
2586
+ PYBIND11_MATH_OPERATOR_BINARY(operator/, PyNumber_TrueDivide)
2587
+ PYBIND11_MATH_OPERATOR_BINARY_INPLACE(operator/=, PyNumber_InPlaceTrueDivide)
2588
+ PYBIND11_MATH_OPERATOR_BINARY(operator|, PyNumber_Or)
2589
+ PYBIND11_MATH_OPERATOR_BINARY_INPLACE(operator|=, PyNumber_InPlaceOr)
2590
+ PYBIND11_MATH_OPERATOR_BINARY(operator&, PyNumber_And)
2591
+ PYBIND11_MATH_OPERATOR_BINARY_INPLACE(operator&=, PyNumber_InPlaceAnd)
2592
+ PYBIND11_MATH_OPERATOR_BINARY(operator^, PyNumber_Xor)
2593
+ PYBIND11_MATH_OPERATOR_BINARY_INPLACE(operator^=, PyNumber_InPlaceXor)
2594
+ PYBIND11_MATH_OPERATOR_BINARY(operator<<, PyNumber_Lshift)
2595
+ PYBIND11_MATH_OPERATOR_BINARY_INPLACE(operator<<=, PyNumber_InPlaceLshift)
2596
+ PYBIND11_MATH_OPERATOR_BINARY(operator>>, PyNumber_Rshift)
2597
+ PYBIND11_MATH_OPERATOR_BINARY_INPLACE(operator>>=, PyNumber_InPlaceRshift)
2598
+
2599
+ #undef PYBIND11_MATH_OPERATOR_UNARY
2600
+ #undef PYBIND11_MATH_OPERATOR_BINARY
2601
+ #undef PYBIND11_MATH_OPERATOR_BINARY_INPLACE
2602
+
2603
+ PYBIND11_NAMESPACE_END(detail)
2604
+ PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)