1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;

use crate::*;

extern "C" {
    pub static NSFoundationVersionNumber: c_double;
}

// NS_TYPED_EXTENSIBLE_ENUM
#[cfg(feature = "NSString")]
pub type NSExceptionName = NSString;

// NS_TYPED_EXTENSIBLE_ENUM
#[cfg(feature = "NSString")]
pub type NSRunLoopMode = NSString;

extern "C" {
    #[cfg(feature = "NSString")]
    pub fn NSStringFromSelector(a_selector: Sel) -> NonNull<NSString>;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub fn NSSelectorFromString(a_selector_name: &NSString) -> Sel;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub fn NSStringFromClass(a_class: &AnyClass) -> NonNull<NSString>;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub fn NSClassFromString(a_class_name: &NSString) -> *const AnyClass;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub fn NSStringFromProtocol(proto: &AnyProtocol) -> NonNull<NSString>;
}

extern "C" {
    #[cfg(feature = "NSString")]
    pub fn NSProtocolFromString(namestr: &NSString) -> *mut AnyProtocol;
}

extern "C" {
    pub fn NSGetSizeAndAlignment(
        type_ptr: NonNull<c_char>,
        sizep: *mut NSUInteger,
        alignp: *mut NSUInteger,
    ) -> NonNull<c_char>;
}

#[cfg(feature = "block2")]
pub type NSComparator =
    *mut block2::Block<dyn Fn(NonNull<AnyObject>, NonNull<AnyObject>) -> NSComparisonResult>;

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSEnumerationOptions(pub NSUInteger);
bitflags::bitflags! {
    impl NSEnumerationOptions: NSUInteger {
        const NSEnumerationConcurrent = 1<<0;
        const NSEnumerationReverse = 1<<1;
    }
}

unsafe impl Encode for NSEnumerationOptions {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSEnumerationOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSSortOptions(pub NSUInteger);
bitflags::bitflags! {
    impl NSSortOptions: NSUInteger {
        const NSSortConcurrent = 1<<0;
        const NSSortStable = 1<<4;
    }
}

unsafe impl Encode for NSSortOptions {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSSortOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSQualityOfService(pub NSInteger);
impl NSQualityOfService {
    #[doc(alias = "NSQualityOfServiceUserInteractive")]
    pub const UserInteractive: Self = Self(0x21);
    #[doc(alias = "NSQualityOfServiceUserInitiated")]
    pub const UserInitiated: Self = Self(0x19);
    #[doc(alias = "NSQualityOfServiceUtility")]
    pub const Utility: Self = Self(0x11);
    #[doc(alias = "NSQualityOfServiceBackground")]
    pub const Background: Self = Self(0x09);
    #[doc(alias = "NSQualityOfServiceDefault")]
    pub const Default: Self = Self(-1);
}

unsafe impl Encode for NSQualityOfService {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for NSQualityOfService {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

pub static NSNotFound: NSInteger = NSIntegerMax as _;