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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
mod private_NSStringUTAdditions {
pub trait Sealed {}
}
/// Category "UTAdditions" on [`NSString`].
#[doc(alias = "UTAdditions")]
pub unsafe trait NSStringUTAdditions:
ClassType + Sized + private_NSStringUTAdditions::Sealed
{
extern_methods!(
#[cfg(feature = "UTType")]
/// Generate a path component based on a partial filename and a file
/// type, then append it to a copy of the receiver.
///
///
/// Parameter `partialName`: The partial filename that should be expanded upon,
/// e.g.
/// `"readme".`
/// Parameter `contentType`: The type the resulting file should conform to, e.g.
/// `UTTypePlainText.`
///
/// Returns: A complete file path. Using the argument examples above, this method
/// would return a string with a last path component of
/// `"readme.txt".`
/// Use this method when you have partial input from a user or other source and
/// need to produce a complete filename suitable for that input. For example, if
/// you are downloading a file from the Internet and know its MIME type, you can
/// use this method to ensure the correct filename extension is applied to the
/// URL where you save the file.
///
/// If
/// _partialName_already has a path extension, and that path extension is
/// valid for file system objects of type
/// _contentType,_no additional
/// extension is appended to the path component before constructing the string.
/// For example, if the inputs are
/// `"puppy.jpg"`and
/// `UTTypeImage`respectively, then the resulting string will have a last path component of
/// `"puppy.jpg"`. On the other hand, if the inputs are
/// `"puppy.jpg"`and
/// `UTTypePlainText`respectively, the resulting string will have a last path
/// component of
/// `"puppy.jpg.txt"`. If you want to ensure any existing path
/// extension is replaced, you can use the
/// `stringByDeletingPathExtension`property first.
///
/// If the path component could not be appended, this method returns a copy of
/// `self`.
#[unsafe(method(stringByAppendingPathComponent:conformingToType:))]
#[unsafe(method_family = none)]
fn stringByAppendingPathComponent_conformingToType(
&self,
partial_name: &NSString,
content_type: &UTType,
) -> Retained<NSString>;
#[cfg(feature = "UTType")]
/// Generate a string based on a partial filename or path and a
/// file type.
///
///
/// Parameter `contentType`: The type the resulting file should conform to, e.g.
/// `UTTypePlainText.`
///
/// Returns: A complete file path. Using the argument example above and assuming
/// the receiver equals
/// `"readme"`, this method would return
/// `"readme.txt".`
/// Use this method when you have partial input from a user or other source and
/// need to produce a complete filename suitable for that input. For example, if
/// you are downloading a file from the Internet and know its MIME type, you can
/// use this method to ensure the correct filename extension is applied to the
/// URL where you save the file.
///
/// If the receiver already has a path extension, and that path extension is
/// valid for file system objects of type
/// _contentType,_no additional
/// extension is appended to the receiver before constructing the result.
/// For example, if the receiver equals
/// `"puppy.jpg"`and
/// _contentType_equals
/// `UTTypeImage`, then the resulting string will equal
/// `"puppy.jpg"`. On
/// the other hand, if the inputs are
/// `"puppy.jpg"`and
/// `UTTypePlainText`respectively, the resulting string will equal
/// `"puppy.jpg.txt"`. If you
/// want to ensure any existing path extension is replaced, you can use the
/// `stringByDeletingPathExtension`property first.
///
/// If the extension could not be appended, this method returns a copy of
/// `self`.
#[unsafe(method(stringByAppendingPathExtensionForType:))]
#[unsafe(method_family = none)]
fn stringByAppendingPathExtensionForType(
&self,
content_type: &UTType,
) -> Retained<NSString>;
);
}
impl private_NSStringUTAdditions::Sealed for NSString {}
unsafe impl NSStringUTAdditions for NSString {}
mod private_NSURLUTAdditions {
pub trait Sealed {}
}
/// Category "UTAdditions" on [`NSURL`].
#[doc(alias = "UTAdditions")]
pub unsafe trait NSURLUTAdditions:
ClassType + Sized + private_NSURLUTAdditions::Sealed
{
extern_methods!(
#[cfg(feature = "UTType")]
/// Generate a path component based on a partial filename and a file
/// type, then append it to a copy of the receiver.
///
///
/// Parameter `partialName`: The partial filename that should be expanded upon,
/// e.g.
/// `"readme".`
/// Parameter `contentType`: The type the resulting file should conform to, e.g.
/// `UTTypePlainText.`
///
/// Returns: A complete URL. Using the argument examples above, this method would
/// return a URL with a last path component of
/// `"readme.txt".`
/// Use this method when you have partial input from a user or other source and
/// need to produce a complete filename suitable for that input. For example, if
/// you are downloading a file from the Internet and know its MIME type, you can
/// use this method to ensure the correct filename extension is applied to the
/// URL where you save the file.
///
/// If
/// _partialName_already has a path extension, and that path extension is
/// valid for file system objects of type
/// _contentType,_no additional
/// extension is appended to the path component before constructing the URL. For
/// example, if the inputs are
/// `"puppy.jpg"`and
/// `UTTypeImage`respectively,
/// then the resulting URL will have a last path component of
/// `"puppy.jpg"`.
/// On the other hand, if the inputs are
/// `"puppy.jpg"`and
/// `UTTypePlainText`respectively, the resulting URL will have a last path component of
/// `"puppy.jpg.txt"`. If you want to ensure any existing path extension is
/// replaced, you can use the
/// `URLByDeletingPathExtension`property first.
///
/// If the path component could not be appended, this method returns a copy of
/// `self`.
///
///
/// Note: The resulting URL has a directory path if
/// `contentType`conforms to
/// `UTTypeDirectory`.
#[unsafe(method(URLByAppendingPathComponent:conformingToType:))]
#[unsafe(method_family = none)]
fn URLByAppendingPathComponent_conformingToType(
&self,
partial_name: &NSString,
content_type: &UTType,
) -> Retained<NSURL>;
#[cfg(feature = "UTType")]
/// Generate a path component based on the last path component of the
/// receiver and a file type, then append it to a copy of the receiver.
///
///
/// Parameter `contentType`: The type the resulting file should conform to, e.g.
/// `UTTypePlainText.`
///
/// Returns: A complete URL. Using the argument example above and assuming
/// the receiver equals
/// `"file:///readme"`, this method would return
/// `"file:///readme.txt".`
/// Use this method when you have partial input from a user or other source and
/// need to produce a complete filename suitable for that input. For example, if
/// you are downloading a file from the Internet and know its MIME type, you can
/// use this method to ensure the correct filename extension is applied to the
/// URL where you save the file.
///
/// If the receiver already has a path extension, and that path extension is
/// valid for file system objects of type
/// _contentType,_no additional
/// extension is appended to the path component before constructing the URL.
/// For example, if the receiver's last path component equals
/// `"puppy.jpg"`and
/// _contentType_equals
/// `UTTypeImage`, then the resulting URL will have a
/// last path component of
/// `"puppy.jpg"`. On the other hand, if the inputs are
/// `"puppy.jpg"`and
/// `UTTypePlainText`respectively, the resulting URL will
/// have a last path component of
/// `"puppy.jpg.txt"`. If you want to ensure any
/// existing path extension is replaced, you can use the
/// `URLByDeletingPathExtension`property first.
///
/// If the extension could not be appended, this method returns a copy of
/// `self`.
///
///
/// Note: The resulting URL has a directory path if
/// `contentType`conforms to
/// `UTTypeDirectory`.
#[unsafe(method(URLByAppendingPathExtensionForType:))]
#[unsafe(method_family = none)]
fn URLByAppendingPathExtensionForType(&self, content_type: &UTType) -> Retained<NSURL>;
);
}
impl private_NSURLUTAdditions::Sealed for NSURL {}
unsafe impl NSURLUTAdditions for NSURL {}