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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;

use crate::*;

extern_methods!(
    /// NSStringPathExtensions
    #[cfg(feature = "NSString")]
    unsafe impl NSString {
        #[cfg(feature = "NSArray")]
        #[method_id(@__retain_semantics Other pathWithComponents:)]
        pub unsafe fn pathWithComponents(components: &NSArray<NSString>) -> Retained<NSString>;

        #[cfg(feature = "NSArray")]
        #[method_id(@__retain_semantics Other pathComponents)]
        pub unsafe fn pathComponents(&self) -> Retained<NSArray<NSString>>;

        #[method(isAbsolutePath)]
        pub unsafe fn isAbsolutePath(&self) -> bool;

        #[method_id(@__retain_semantics Other lastPathComponent)]
        pub unsafe fn lastPathComponent(&self) -> Retained<NSString>;

        #[method_id(@__retain_semantics Other stringByDeletingLastPathComponent)]
        pub unsafe fn stringByDeletingLastPathComponent(&self) -> Retained<NSString>;

        #[method_id(@__retain_semantics Other stringByAppendingPathComponent:)]
        pub fn stringByAppendingPathComponent(&self, str: &NSString) -> Retained<NSString>;

        #[method_id(@__retain_semantics Other pathExtension)]
        pub unsafe fn pathExtension(&self) -> Retained<NSString>;

        #[method_id(@__retain_semantics Other stringByDeletingPathExtension)]
        pub unsafe fn stringByDeletingPathExtension(&self) -> Retained<NSString>;

        #[method_id(@__retain_semantics Other stringByAppendingPathExtension:)]
        pub unsafe fn stringByAppendingPathExtension(
            &self,
            str: &NSString,
        ) -> Option<Retained<NSString>>;

        #[method_id(@__retain_semantics Other stringByAbbreviatingWithTildeInPath)]
        pub unsafe fn stringByAbbreviatingWithTildeInPath(&self) -> Retained<NSString>;

        #[method_id(@__retain_semantics Other stringByExpandingTildeInPath)]
        pub unsafe fn stringByExpandingTildeInPath(&self) -> Retained<NSString>;

        #[method_id(@__retain_semantics Other stringByStandardizingPath)]
        pub unsafe fn stringByStandardizingPath(&self) -> Retained<NSString>;

        #[method_id(@__retain_semantics Other stringByResolvingSymlinksInPath)]
        pub unsafe fn stringByResolvingSymlinksInPath(&self) -> Retained<NSString>;

        #[cfg(feature = "NSArray")]
        #[method_id(@__retain_semantics Other stringsByAppendingPaths:)]
        pub unsafe fn stringsByAppendingPaths(
            &self,
            paths: &NSArray<NSString>,
        ) -> Retained<NSArray<NSString>>;

        #[cfg(feature = "NSArray")]
        #[method(completePathIntoString:caseSensitive:matchesIntoArray:filterTypes:)]
        pub unsafe fn completePathIntoString_caseSensitive_matchesIntoArray_filterTypes(
            &self,
            output_name: Option<&mut Option<Retained<NSString>>>,
            flag: bool,
            output_array: Option<&mut Option<Retained<NSArray<NSString>>>>,
            filter_types: Option<&NSArray<NSString>>,
        ) -> NSUInteger;

        #[method(fileSystemRepresentation)]
        pub unsafe fn fileSystemRepresentation(&self) -> NonNull<c_char>;

        #[method(getFileSystemRepresentation:maxLength:)]
        pub unsafe fn getFileSystemRepresentation_maxLength(
            &self,
            cname: NonNull<c_char>,
            max: NSUInteger,
        ) -> bool;
    }
);

extern_methods!(
    /// NSArrayPathExtensions
    #[cfg(feature = "NSArray")]
    unsafe impl<ObjectType: Message> NSArray<ObjectType> {
        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other pathsMatchingExtensions:)]
        pub unsafe fn pathsMatchingExtensions(
            &self,
            filter_types: &NSArray<NSString>,
        ) -> Retained<NSArray<NSString>>;
    }
);

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

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

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

extern "C" {
    #[cfg(feature = "NSString")]
    pub fn NSHomeDirectoryForUser(user_name: Option<&NSString>) -> *mut NSString;
}

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

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

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSSearchPathDirectory(pub NSUInteger);
impl NSSearchPathDirectory {
    pub const NSApplicationDirectory: Self = Self(1);
    pub const NSDemoApplicationDirectory: Self = Self(2);
    pub const NSDeveloperApplicationDirectory: Self = Self(3);
    pub const NSAdminApplicationDirectory: Self = Self(4);
    pub const NSLibraryDirectory: Self = Self(5);
    pub const NSDeveloperDirectory: Self = Self(6);
    pub const NSUserDirectory: Self = Self(7);
    pub const NSDocumentationDirectory: Self = Self(8);
    pub const NSDocumentDirectory: Self = Self(9);
    pub const NSCoreServiceDirectory: Self = Self(10);
    pub const NSAutosavedInformationDirectory: Self = Self(11);
    pub const NSDesktopDirectory: Self = Self(12);
    pub const NSCachesDirectory: Self = Self(13);
    pub const NSApplicationSupportDirectory: Self = Self(14);
    pub const NSDownloadsDirectory: Self = Self(15);
    pub const NSInputMethodsDirectory: Self = Self(16);
    pub const NSMoviesDirectory: Self = Self(17);
    pub const NSMusicDirectory: Self = Self(18);
    pub const NSPicturesDirectory: Self = Self(19);
    pub const NSPrinterDescriptionDirectory: Self = Self(20);
    pub const NSSharedPublicDirectory: Self = Self(21);
    pub const NSPreferencePanesDirectory: Self = Self(22);
    pub const NSApplicationScriptsDirectory: Self = Self(23);
    pub const NSItemReplacementDirectory: Self = Self(99);
    pub const NSAllApplicationsDirectory: Self = Self(100);
    pub const NSAllLibrariesDirectory: Self = Self(101);
    pub const NSTrashDirectory: Self = Self(102);
}

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

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

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSSearchPathDomainMask(pub NSUInteger);
bitflags::bitflags! {
    impl NSSearchPathDomainMask: NSUInteger {
        const NSUserDomainMask = 1;
        const NSLocalDomainMask = 2;
        const NSNetworkDomainMask = 4;
        const NSSystemDomainMask = 8;
        const NSAllDomainsMask = 0x0ffff;
    }
}

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

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

extern "C" {
    #[cfg(all(feature = "NSArray", feature = "NSString"))]
    pub fn NSSearchPathForDirectoriesInDomains(
        directory: NSSearchPathDirectory,
        domain_mask: NSSearchPathDomainMask,
        expand_tilde: Bool,
    ) -> NonNull<NSArray<NSString>>;
}