OpenSwiftUIBase.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. //
  2. // OpenSwiftUIBase.h
  3. // ark_ui_basic
  4. //
  5. // Audited for 3.5.2
  6. // Status: Complete
  7. #ifndef OpenSwiftUIBase_h
  8. #define OpenSwiftUIBase_h
  9. #include <CoreFoundation/CoreFoundation.h>
  10. #include <stdint.h>
  11. #include <stdbool.h>
  12. #include <stdio.h>
  13. #include "OpenSwiftUITargetConditionals.h"
  14. #if OPENSWIFTUI_TARGET_OS_DARWIN
  15. #if (defined(__IPHONE_26_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_26_0) || \
  16. (defined(__MAC_26_0) && __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_26_0) || \
  17. (defined(__TV_26_0) && __TV_OS_VERSION_MAX_ALLOWED >= __TV_26_0) || \
  18. (defined(__WATCH_26_0) && __WATCH_OS_VERSION_MAX_ALLOWED >= __WATCH_26_0)
  19. #define OPENSWIFTUI_HAS_SDK_26_ADDITIONS 1
  20. #else
  21. #define OPENSWIFTUI_HAS_SDK_26_ADDITIONS 0
  22. #endif
  23. #if (defined(__IPHONE_27_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_27_0) || \
  24. (defined(__MAC_27_0) && __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_27_0) || \
  25. (defined(__TV_27_0) && __TV_OS_VERSION_MAX_ALLOWED >= __TV_27_0) || \
  26. (defined(__WATCH_27_0) && __WATCH_OS_VERSION_MAX_ALLOWED >= __WATCH_27_0) || \
  27. (defined(__VISIONOS_27_0) && __VISION_OS_VERSION_MAX_ALLOWED >= __VISIONOS_27_0)
  28. #define OPENSWIFTUI_HAS_SDK_27_ADDITIONS 1
  29. #else
  30. #define OPENSWIFTUI_HAS_SDK_27_ADDITIONS 0
  31. #endif
  32. #else
  33. #define OPENSWIFTUI_HAS_SDK_26_ADDITIONS 0
  34. #define OPENSWIFTUI_HAS_SDK_27_ADDITIONS 0
  35. #endif
  36. #if defined(__cplusplus)
  37. #define OPENSWIFTUI_INLINE inline
  38. #else
  39. #define OPENSWIFTUI_INLINE
  40. #endif
  41. #if defined(__cplusplus)
  42. #define OPENSWIFTUI_EXTERN_C_BEGIN extern "C" {
  43. #define OPENSWIFTUI_EXTERN_C_END }
  44. #else
  45. #define OPENSWIFTUI_EXTERN_C_BEGIN
  46. #define OPENSWIFTUI_EXTERN_C_END
  47. #endif
  48. #if __has_feature(assume_nonnull)
  49. #define OPENSWIFTUI_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
  50. #define OPENSWIFTUI_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end")
  51. #else
  52. #define OPENSWIFTUI_ASSUME_NONNULL_BEGIN
  53. #define OPENSWIFTUI_ASSUME_NONNULL_END
  54. #endif
  55. #if OPENSWIFTUI_TARGET_OS_WIN32
  56. #if defined(__cplusplus)
  57. #define _OPENSWIFTUI_EXTERN extern "C"
  58. #else
  59. #define _OPENSWIFTUI_EXTERN extern
  60. #endif
  61. #if defined(_WINDLL)
  62. #if defined(OPENSWIFTUI_EXPORTS)
  63. #define OPENSWIFTUI_EXPORT _OPENSWIFTUI_EXTERN __declspec(dllexport)
  64. #else
  65. #define OPENSWIFTUI_EXPORT _OPENSWIFTUI_EXTERN __declspec(dllimport)
  66. #endif
  67. #else
  68. #define OPENSWIFTUI_EXPORT _OPENSWIFTUI_EXTERN
  69. #endif
  70. #else
  71. #define OPENSWIFTUI_EXPORT extern
  72. #endif
  73. #if __has_attribute(swift_private)
  74. # define OPENSWIFTUI_REFINED_FOR_SWIFT __attribute__((swift_private))
  75. #else
  76. # define OPENSWIFTUI_REFINED_FOR_SWIFT
  77. #endif
  78. #if __has_attribute(swift_name)
  79. # define OPENSWIFTUI_SWIFT_NAME(_name) __attribute__((swift_name(#_name)))
  80. #else
  81. # define OPENSWIFTUI_SWIFT_NAME(_name)
  82. #endif
  83. #if __has_attribute(swift_wrapper)
  84. #define OPENSWIFTUI_SWIFT_STRUCT __attribute__((swift_wrapper(struct)))
  85. #else
  86. #define OPENSWIFTUI_SWIFT_STRUCT
  87. #endif
  88. #define OPENSWIFTUI_ENUM CF_ENUM
  89. #define OPENSWIFTUI_CLOSED_ENUM CF_CLOSED_ENUM
  90. #define OPENSWIFTUI_OPTIONS CF_OPTIONS
  91. #ifndef OPENSWIFTUI_IMPLICIT_BRIDGING_ENABLED
  92. #if __has_feature(arc_cf_code_audited)
  93. #define OPENSWIFTUI_IMPLICIT_BRIDGING_ENABLED _Pragma("clang arc_cf_code_audited begin")
  94. #else
  95. #define OPENSWIFTUI_IMPLICIT_BRIDGING_ENABLED
  96. #endif
  97. #endif
  98. #ifndef OPENSWIFTUI_IMPLICIT_BRIDGING_DISABLED
  99. #if __has_feature(arc_cf_code_audited)
  100. #define OPENSWIFTUI_IMPLICIT_BRIDGING_DISABLED _Pragma("clang arc_cf_code_audited end")
  101. #else
  102. #define OPENSWIFTUI_IMPLICIT_BRIDGING_DISABLED
  103. #endif
  104. #endif
  105. // Marks functions which return a CF type that needs to be released by the caller but whose names are not consistent with CoreFoundation naming rules. The recommended fix to this is to rename the functions, but this macro can be used to let the clang static analyzer know of any exceptions that cannot be fixed.
  106. // This macro is ONLY to be used in exceptional circumstances, not to annotate functions which conform to the CoreFoundation naming rules.
  107. #ifndef OPENSWIFTUI_RETURNS_RETAINED
  108. #if __has_feature(attribute_cf_returns_retained)
  109. #define OPENSWIFTUI_RETURNS_RETAINED __attribute__((cf_returns_retained))
  110. #else
  111. #define OPENSWIFTUI_RETURNS_RETAINED
  112. #endif
  113. #endif
  114. // Marks functions which return a CF type that may need to be retained by the caller but whose names are not consistent with CoreFoundation naming rules. The recommended fix to this is to rename the functions, but this macro can be used to let the clang static analyzer know of any exceptions that cannot be fixed.
  115. // This macro is ONLY to be used in exceptional circumstances, not to annotate functions which conform to the CoreFoundation naming rules.
  116. #ifndef OPENSWIFTUI_RETURNS_NOT_RETAINED
  117. #if __has_feature(attribute_cf_returns_not_retained)
  118. #define OPENSWIFTUI_RETURNS_NOT_RETAINED __attribute__((cf_returns_not_retained))
  119. #else
  120. #define OPENSWIFTUI_RETURNS_NOT_RETAINED
  121. #endif
  122. #endif
  123. #endif /* OpenSwiftUIBase_h */