NSError.odin 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package objc_Foundation
  2. foreign import "system:Foundation.framework"
  3. ErrorDomain :: ^String
  4. foreign Foundation {
  5. @(linkage="weak") CocoaErrorDomain: ErrorDomain
  6. @(linkage="weak") POSIXErrorDomain: ErrorDomain
  7. @(linkage="weak") OSStatusErrorDomain: ErrorDomain
  8. @(linkage="weak") MachErrorDomain: ErrorDomain
  9. }
  10. ErrorUserInfoKey :: ^String
  11. foreign Foundation {
  12. @(linkage="weak") UnderlyingErrorKey: ErrorUserInfoKey
  13. @(linkage="weak") LocalizedDescriptionKey: ErrorUserInfoKey
  14. @(linkage="weak") LocalizedFailureReasonErrorKey: ErrorUserInfoKey
  15. @(linkage="weak") LocalizedRecoverySuggestionErrorKey: ErrorUserInfoKey
  16. @(linkage="weak") LocalizedRecoveryOptionsErrorKey: ErrorUserInfoKey
  17. @(linkage="weak") RecoveryAttempterErrorKey: ErrorUserInfoKey
  18. @(linkage="weak") HelpAnchorErrorKey: ErrorUserInfoKey
  19. @(linkage="weak") DebugDescriptionErrorKey: ErrorUserInfoKey
  20. @(linkage="weak") LocalizedFailureErrorKey: ErrorUserInfoKey
  21. @(linkage="weak") StringEncodingErrorKey: ErrorUserInfoKey
  22. @(linkage="weak") URLErrorKey: ErrorUserInfoKey
  23. @(linkage="weak") FilePathErrorKey: ErrorUserInfoKey
  24. }
  25. @(objc_class="NSError")
  26. Error :: struct { using _: Copying(Error) }
  27. @(objc_type=Error, objc_name="alloc", objc_is_class_method=true)
  28. Error_alloc :: proc "c" () -> ^Error {
  29. return msgSend(^Error, Error, "alloc")
  30. }
  31. @(objc_type=Error, objc_name="init")
  32. Error_init :: proc "c" (self: ^Error) -> ^Error {
  33. return msgSend(^Error, self, "init")
  34. }
  35. @(objc_type=Error, objc_name="errorWithDomain", objc_is_class_method=true)
  36. Error_errorWithDomain :: proc "c" (domain: ErrorDomain, code: Integer, userInfo: ^Dictionary) -> ^Error {
  37. return msgSend(^Error, Error, "errorWithDomain:code:userInfo:", domain, code, userInfo)
  38. }
  39. @(objc_type=Error, objc_name="initWithDomain")
  40. Error_initWithDomain :: proc "c" (self: ^Error, domain: ErrorDomain, code: Integer, userInfo: ^Dictionary) -> ^Error {
  41. return msgSend(^Error, self, "initWithDomain:code:userInfo:", domain, code, userInfo)
  42. }
  43. @(objc_type=Error, objc_name="code")
  44. Error_code :: proc "c" (self: ^Error) -> Integer {
  45. return msgSend(Integer, self, "code")
  46. }
  47. @(objc_type=Error, objc_name="domain")
  48. Error_domain :: proc "c" (self: ^Error) -> ErrorDomain {
  49. return msgSend(ErrorDomain, self, "domain")
  50. }
  51. @(objc_type=Error, objc_name="userInfo")
  52. Error_userInfo :: proc "c" (self: ^Error) -> ^Dictionary {
  53. return msgSend(^Dictionary, self, "userInfo")
  54. }
  55. @(objc_type=Error, objc_name="localizedDescription")
  56. Error_localizedDescription :: proc "c" (self: ^Error) -> ^String {
  57. return msgSend(^String, self, "localizedDescription")
  58. }
  59. @(objc_type=Error, objc_name="localizedRecoveryOptions")
  60. Error_localizedRecoveryOptions :: proc "c" (self: ^Error) -> (options: ^Array) {
  61. return msgSend(type_of(options), self, "localizedRecoveryOptions")
  62. }
  63. @(objc_type=Error, objc_name="localizedRecoverySuggestion")
  64. Error_localizedRecoverySuggestion :: proc "c" (self: ^Error) -> ^String {
  65. return msgSend(^String, self, "localizedRecoverySuggestion")
  66. }
  67. @(objc_type=Error, objc_name="localizedFailureReason")
  68. Error_localizedFailureReason :: proc "c" (self: ^Error) -> ^String {
  69. return msgSend(^String, self, "localizedFailureReason")
  70. }