icrate/generated/Foundation/
NSBundle.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use crate::common::*;
4use crate::Foundation::*;
5
6extern_enum!(
7    #[underlying(c_uint)]
8    pub enum __anonymous__ {
9        NSBundleExecutableArchitectureI386 = 0x00000007,
10        NSBundleExecutableArchitecturePPC = 0x00000012,
11        NSBundleExecutableArchitectureX86_64 = 0x01000007,
12        NSBundleExecutableArchitecturePPC64 = 0x01000012,
13        NSBundleExecutableArchitectureARM64 = 0x0100000c,
14    }
15);
16
17extern_class!(
18    #[derive(PartialEq, Eq, Hash)]
19    #[cfg(feature = "Foundation_NSBundle")]
20    pub struct NSBundle;
21
22    #[cfg(feature = "Foundation_NSBundle")]
23    unsafe impl ClassType for NSBundle {
24        type Super = NSObject;
25        type Mutability = InteriorMutable;
26    }
27);
28
29#[cfg(feature = "Foundation_NSBundle")]
30unsafe impl Send for NSBundle {}
31
32#[cfg(feature = "Foundation_NSBundle")]
33unsafe impl Sync for NSBundle {}
34
35#[cfg(feature = "Foundation_NSBundle")]
36unsafe impl NSObjectProtocol for NSBundle {}
37
38extern_methods!(
39    #[cfg(feature = "Foundation_NSBundle")]
40    unsafe impl NSBundle {
41        #[method_id(@__retain_semantics Other mainBundle)]
42        pub fn mainBundle() -> Id<NSBundle>;
43
44        #[cfg(feature = "Foundation_NSString")]
45        #[method_id(@__retain_semantics Other bundleWithPath:)]
46        pub unsafe fn bundleWithPath(path: &NSString) -> Option<Id<Self>>;
47
48        #[cfg(feature = "Foundation_NSString")]
49        #[method_id(@__retain_semantics Init initWithPath:)]
50        pub unsafe fn initWithPath(this: Allocated<Self>, path: &NSString) -> Option<Id<Self>>;
51
52        #[cfg(feature = "Foundation_NSURL")]
53        #[method_id(@__retain_semantics Other bundleWithURL:)]
54        pub unsafe fn bundleWithURL(url: &NSURL) -> Option<Id<Self>>;
55
56        #[cfg(feature = "Foundation_NSURL")]
57        #[method_id(@__retain_semantics Init initWithURL:)]
58        pub unsafe fn initWithURL(this: Allocated<Self>, url: &NSURL) -> Option<Id<Self>>;
59
60        #[method_id(@__retain_semantics Other bundleForClass:)]
61        pub unsafe fn bundleForClass(a_class: &AnyClass) -> Id<NSBundle>;
62
63        #[cfg(feature = "Foundation_NSString")]
64        #[method_id(@__retain_semantics Other bundleWithIdentifier:)]
65        pub unsafe fn bundleWithIdentifier(identifier: &NSString) -> Option<Id<NSBundle>>;
66
67        #[cfg(feature = "Foundation_NSArray")]
68        #[method_id(@__retain_semantics Other allBundles)]
69        pub unsafe fn allBundles() -> Id<NSArray<NSBundle>>;
70
71        #[cfg(feature = "Foundation_NSArray")]
72        #[method_id(@__retain_semantics Other allFrameworks)]
73        pub unsafe fn allFrameworks() -> Id<NSArray<NSBundle>>;
74
75        #[method(load)]
76        pub unsafe fn load(&self) -> bool;
77
78        #[method(isLoaded)]
79        pub unsafe fn isLoaded(&self) -> bool;
80
81        #[method(unload)]
82        pub unsafe fn unload(&self) -> bool;
83
84        #[cfg(feature = "Foundation_NSError")]
85        #[method(preflightAndReturnError:_)]
86        pub unsafe fn preflightAndReturnError(&self) -> Result<(), Id<NSError>>;
87
88        #[cfg(feature = "Foundation_NSError")]
89        #[method(loadAndReturnError:_)]
90        pub unsafe fn loadAndReturnError(&self) -> Result<(), Id<NSError>>;
91
92        #[cfg(feature = "Foundation_NSURL")]
93        #[method_id(@__retain_semantics Other bundleURL)]
94        pub unsafe fn bundleURL(&self) -> Id<NSURL>;
95
96        #[cfg(feature = "Foundation_NSURL")]
97        #[method_id(@__retain_semantics Other resourceURL)]
98        pub unsafe fn resourceURL(&self) -> Option<Id<NSURL>>;
99
100        #[cfg(feature = "Foundation_NSURL")]
101        #[method_id(@__retain_semantics Other executableURL)]
102        pub unsafe fn executableURL(&self) -> Option<Id<NSURL>>;
103
104        #[cfg(all(feature = "Foundation_NSString", feature = "Foundation_NSURL"))]
105        #[method_id(@__retain_semantics Other URLForAuxiliaryExecutable:)]
106        pub unsafe fn URLForAuxiliaryExecutable(
107            &self,
108            executable_name: &NSString,
109        ) -> Option<Id<NSURL>>;
110
111        #[cfg(feature = "Foundation_NSURL")]
112        #[method_id(@__retain_semantics Other privateFrameworksURL)]
113        pub unsafe fn privateFrameworksURL(&self) -> Option<Id<NSURL>>;
114
115        #[cfg(feature = "Foundation_NSURL")]
116        #[method_id(@__retain_semantics Other sharedFrameworksURL)]
117        pub unsafe fn sharedFrameworksURL(&self) -> Option<Id<NSURL>>;
118
119        #[cfg(feature = "Foundation_NSURL")]
120        #[method_id(@__retain_semantics Other sharedSupportURL)]
121        pub unsafe fn sharedSupportURL(&self) -> Option<Id<NSURL>>;
122
123        #[cfg(feature = "Foundation_NSURL")]
124        #[method_id(@__retain_semantics Other builtInPlugInsURL)]
125        pub unsafe fn builtInPlugInsURL(&self) -> Option<Id<NSURL>>;
126
127        #[cfg(feature = "Foundation_NSURL")]
128        #[method_id(@__retain_semantics Other appStoreReceiptURL)]
129        pub unsafe fn appStoreReceiptURL(&self) -> Option<Id<NSURL>>;
130
131        #[cfg(feature = "Foundation_NSString")]
132        #[method_id(@__retain_semantics Other bundlePath)]
133        pub unsafe fn bundlePath(&self) -> Id<NSString>;
134
135        #[cfg(feature = "Foundation_NSString")]
136        #[method_id(@__retain_semantics Other resourcePath)]
137        pub unsafe fn resourcePath(&self) -> Option<Id<NSString>>;
138
139        #[cfg(feature = "Foundation_NSString")]
140        #[method_id(@__retain_semantics Other executablePath)]
141        pub unsafe fn executablePath(&self) -> Option<Id<NSString>>;
142
143        #[cfg(feature = "Foundation_NSString")]
144        #[method_id(@__retain_semantics Other pathForAuxiliaryExecutable:)]
145        pub unsafe fn pathForAuxiliaryExecutable(
146            &self,
147            executable_name: &NSString,
148        ) -> Option<Id<NSString>>;
149
150        #[cfg(feature = "Foundation_NSString")]
151        #[method_id(@__retain_semantics Other privateFrameworksPath)]
152        pub unsafe fn privateFrameworksPath(&self) -> Option<Id<NSString>>;
153
154        #[cfg(feature = "Foundation_NSString")]
155        #[method_id(@__retain_semantics Other sharedFrameworksPath)]
156        pub unsafe fn sharedFrameworksPath(&self) -> Option<Id<NSString>>;
157
158        #[cfg(feature = "Foundation_NSString")]
159        #[method_id(@__retain_semantics Other sharedSupportPath)]
160        pub unsafe fn sharedSupportPath(&self) -> Option<Id<NSString>>;
161
162        #[cfg(feature = "Foundation_NSString")]
163        #[method_id(@__retain_semantics Other builtInPlugInsPath)]
164        pub unsafe fn builtInPlugInsPath(&self) -> Option<Id<NSString>>;
165
166        #[cfg(all(feature = "Foundation_NSString", feature = "Foundation_NSURL"))]
167        #[method_id(@__retain_semantics Other URLForResource:withExtension:subdirectory:inBundleWithURL:)]
168        pub unsafe fn URLForResource_withExtension_subdirectory_inBundleWithURL(
169            name: Option<&NSString>,
170            ext: Option<&NSString>,
171            subpath: Option<&NSString>,
172            bundle_url: &NSURL,
173        ) -> Option<Id<NSURL>>;
174
175        #[cfg(all(
176            feature = "Foundation_NSArray",
177            feature = "Foundation_NSString",
178            feature = "Foundation_NSURL"
179        ))]
180        #[method_id(@__retain_semantics Other URLsForResourcesWithExtension:subdirectory:inBundleWithURL:)]
181        pub unsafe fn URLsForResourcesWithExtension_subdirectory_inBundleWithURL(
182            ext: Option<&NSString>,
183            subpath: Option<&NSString>,
184            bundle_url: &NSURL,
185        ) -> Option<Id<NSArray<NSURL>>>;
186
187        #[cfg(all(feature = "Foundation_NSString", feature = "Foundation_NSURL"))]
188        #[method_id(@__retain_semantics Other URLForResource:withExtension:)]
189        pub unsafe fn URLForResource_withExtension(
190            &self,
191            name: Option<&NSString>,
192            ext: Option<&NSString>,
193        ) -> Option<Id<NSURL>>;
194
195        #[cfg(all(feature = "Foundation_NSString", feature = "Foundation_NSURL"))]
196        #[method_id(@__retain_semantics Other URLForResource:withExtension:subdirectory:)]
197        pub unsafe fn URLForResource_withExtension_subdirectory(
198            &self,
199            name: Option<&NSString>,
200            ext: Option<&NSString>,
201            subpath: Option<&NSString>,
202        ) -> Option<Id<NSURL>>;
203
204        #[cfg(all(feature = "Foundation_NSString", feature = "Foundation_NSURL"))]
205        #[method_id(@__retain_semantics Other URLForResource:withExtension:subdirectory:localization:)]
206        pub unsafe fn URLForResource_withExtension_subdirectory_localization(
207            &self,
208            name: Option<&NSString>,
209            ext: Option<&NSString>,
210            subpath: Option<&NSString>,
211            localization_name: Option<&NSString>,
212        ) -> Option<Id<NSURL>>;
213
214        #[cfg(all(
215            feature = "Foundation_NSArray",
216            feature = "Foundation_NSString",
217            feature = "Foundation_NSURL"
218        ))]
219        #[method_id(@__retain_semantics Other URLsForResourcesWithExtension:subdirectory:)]
220        pub unsafe fn URLsForResourcesWithExtension_subdirectory(
221            &self,
222            ext: Option<&NSString>,
223            subpath: Option<&NSString>,
224        ) -> Option<Id<NSArray<NSURL>>>;
225
226        #[cfg(all(
227            feature = "Foundation_NSArray",
228            feature = "Foundation_NSString",
229            feature = "Foundation_NSURL"
230        ))]
231        #[method_id(@__retain_semantics Other URLsForResourcesWithExtension:subdirectory:localization:)]
232        pub unsafe fn URLsForResourcesWithExtension_subdirectory_localization(
233            &self,
234            ext: Option<&NSString>,
235            subpath: Option<&NSString>,
236            localization_name: Option<&NSString>,
237        ) -> Option<Id<NSArray<NSURL>>>;
238
239        #[cfg(feature = "Foundation_NSString")]
240        #[method_id(@__retain_semantics Other pathForResource:ofType:inDirectory:)]
241        pub unsafe fn pathForResource_ofType_inDirectory_class(
242            name: Option<&NSString>,
243            ext: Option<&NSString>,
244            bundle_path: &NSString,
245        ) -> Option<Id<NSString>>;
246
247        #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSString"))]
248        #[method_id(@__retain_semantics Other pathsForResourcesOfType:inDirectory:)]
249        pub unsafe fn pathsForResourcesOfType_inDirectory_class(
250            ext: Option<&NSString>,
251            bundle_path: &NSString,
252        ) -> Id<NSArray<NSString>>;
253
254        #[cfg(feature = "Foundation_NSString")]
255        #[method_id(@__retain_semantics Other pathForResource:ofType:)]
256        pub unsafe fn pathForResource_ofType(
257            &self,
258            name: Option<&NSString>,
259            ext: Option<&NSString>,
260        ) -> Option<Id<NSString>>;
261
262        #[cfg(feature = "Foundation_NSString")]
263        #[method_id(@__retain_semantics Other pathForResource:ofType:inDirectory:)]
264        pub unsafe fn pathForResource_ofType_inDirectory(
265            &self,
266            name: Option<&NSString>,
267            ext: Option<&NSString>,
268            subpath: Option<&NSString>,
269        ) -> Option<Id<NSString>>;
270
271        #[cfg(feature = "Foundation_NSString")]
272        #[method_id(@__retain_semantics Other pathForResource:ofType:inDirectory:forLocalization:)]
273        pub unsafe fn pathForResource_ofType_inDirectory_forLocalization(
274            &self,
275            name: Option<&NSString>,
276            ext: Option<&NSString>,
277            subpath: Option<&NSString>,
278            localization_name: Option<&NSString>,
279        ) -> Option<Id<NSString>>;
280
281        #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSString"))]
282        #[method_id(@__retain_semantics Other pathsForResourcesOfType:inDirectory:)]
283        pub unsafe fn pathsForResourcesOfType_inDirectory(
284            &self,
285            ext: Option<&NSString>,
286            subpath: Option<&NSString>,
287        ) -> Id<NSArray<NSString>>;
288
289        #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSString"))]
290        #[method_id(@__retain_semantics Other pathsForResourcesOfType:inDirectory:forLocalization:)]
291        pub unsafe fn pathsForResourcesOfType_inDirectory_forLocalization(
292            &self,
293            ext: Option<&NSString>,
294            subpath: Option<&NSString>,
295            localization_name: Option<&NSString>,
296        ) -> Id<NSArray<NSString>>;
297
298        #[cfg(feature = "Foundation_NSString")]
299        #[method_id(@__retain_semantics Other localizedStringForKey:value:table:)]
300        pub unsafe fn localizedStringForKey_value_table(
301            &self,
302            key: &NSString,
303            value: Option<&NSString>,
304            table_name: Option<&NSString>,
305        ) -> Id<NSString>;
306
307        #[cfg(feature = "Foundation_NSString")]
308        #[method_id(@__retain_semantics Other bundleIdentifier)]
309        pub unsafe fn bundleIdentifier(&self) -> Option<Id<NSString>>;
310
311        #[cfg(all(feature = "Foundation_NSDictionary", feature = "Foundation_NSString"))]
312        #[method_id(@__retain_semantics Other infoDictionary)]
313        pub fn infoDictionary(&self) -> Option<Id<NSDictionary<NSString, AnyObject>>>;
314
315        #[cfg(all(feature = "Foundation_NSDictionary", feature = "Foundation_NSString"))]
316        #[method_id(@__retain_semantics Other localizedInfoDictionary)]
317        pub unsafe fn localizedInfoDictionary(
318            &self,
319        ) -> Option<Id<NSDictionary<NSString, AnyObject>>>;
320
321        #[cfg(feature = "Foundation_NSString")]
322        #[method_id(@__retain_semantics Other objectForInfoDictionaryKey:)]
323        pub unsafe fn objectForInfoDictionaryKey(&self, key: &NSString) -> Option<Id<AnyObject>>;
324
325        #[cfg(feature = "Foundation_NSString")]
326        #[method(classNamed:)]
327        pub unsafe fn classNamed(&self, class_name: &NSString) -> Option<&'static AnyClass>;
328
329        #[method(principalClass)]
330        pub unsafe fn principalClass(&self) -> Option<&'static AnyClass>;
331
332        #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSString"))]
333        #[method_id(@__retain_semantics Other preferredLocalizations)]
334        pub unsafe fn preferredLocalizations(&self) -> Id<NSArray<NSString>>;
335
336        #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSString"))]
337        #[method_id(@__retain_semantics Other localizations)]
338        pub unsafe fn localizations(&self) -> Id<NSArray<NSString>>;
339
340        #[cfg(feature = "Foundation_NSString")]
341        #[method_id(@__retain_semantics Other developmentLocalization)]
342        pub unsafe fn developmentLocalization(&self) -> Option<Id<NSString>>;
343
344        #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSString"))]
345        #[method_id(@__retain_semantics Other preferredLocalizationsFromArray:)]
346        pub unsafe fn preferredLocalizationsFromArray(
347            localizations_array: &NSArray<NSString>,
348        ) -> Id<NSArray<NSString>>;
349
350        #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSString"))]
351        #[method_id(@__retain_semantics Other preferredLocalizationsFromArray:forPreferences:)]
352        pub unsafe fn preferredLocalizationsFromArray_forPreferences(
353            localizations_array: &NSArray<NSString>,
354            preferences_array: Option<&NSArray<NSString>>,
355        ) -> Id<NSArray<NSString>>;
356
357        #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSNumber"))]
358        #[method_id(@__retain_semantics Other executableArchitectures)]
359        pub unsafe fn executableArchitectures(&self) -> Option<Id<NSArray<NSNumber>>>;
360    }
361);
362
363extern_methods!(
364    /// Methods declared on superclass `NSObject`
365    #[cfg(feature = "Foundation_NSBundle")]
366    unsafe impl NSBundle {
367        #[method_id(@__retain_semantics Init init)]
368        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
369
370        #[method_id(@__retain_semantics New new)]
371        pub unsafe fn new() -> Id<Self>;
372    }
373);
374
375extern_methods!(
376    /// NSBundleExtensionMethods
377    #[cfg(feature = "Foundation_NSString")]
378    unsafe impl NSString {
379        #[method_id(@__retain_semantics Other variantFittingPresentationWidth:)]
380        pub unsafe fn variantFittingPresentationWidth(&self, width: NSInteger) -> Id<NSString>;
381    }
382);
383
384extern_static!(NSBundleDidLoadNotification: &'static NSNotificationName);
385
386extern_static!(NSLoadedClasses: &'static NSString);
387
388extern_class!(
389    #[derive(Debug, PartialEq, Eq, Hash)]
390    #[cfg(feature = "Foundation_NSBundleResourceRequest")]
391    pub struct NSBundleResourceRequest;
392
393    #[cfg(feature = "Foundation_NSBundleResourceRequest")]
394    unsafe impl ClassType for NSBundleResourceRequest {
395        type Super = NSObject;
396        type Mutability = InteriorMutable;
397    }
398);
399
400#[cfg(feature = "Foundation_NSBundleResourceRequest")]
401unsafe impl NSObjectProtocol for NSBundleResourceRequest {}
402
403#[cfg(feature = "Foundation_NSBundleResourceRequest")]
404unsafe impl NSProgressReporting for NSBundleResourceRequest {}
405
406extern_methods!(
407    #[cfg(feature = "Foundation_NSBundleResourceRequest")]
408    unsafe impl NSBundleResourceRequest {
409        #[method_id(@__retain_semantics Init init)]
410        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
411
412        #[cfg(all(feature = "Foundation_NSSet", feature = "Foundation_NSString"))]
413        #[method_id(@__retain_semantics Init initWithTags:)]
414        pub unsafe fn initWithTags(this: Allocated<Self>, tags: &NSSet<NSString>) -> Id<Self>;
415
416        #[cfg(all(
417            feature = "Foundation_NSBundle",
418            feature = "Foundation_NSSet",
419            feature = "Foundation_NSString"
420        ))]
421        #[method_id(@__retain_semantics Init initWithTags:bundle:)]
422        pub unsafe fn initWithTags_bundle(
423            this: Allocated<Self>,
424            tags: &NSSet<NSString>,
425            bundle: &NSBundle,
426        ) -> Id<Self>;
427
428        #[method(loadingPriority)]
429        pub unsafe fn loadingPriority(&self) -> c_double;
430
431        #[method(setLoadingPriority:)]
432        pub unsafe fn setLoadingPriority(&self, loading_priority: c_double);
433
434        #[cfg(all(feature = "Foundation_NSSet", feature = "Foundation_NSString"))]
435        #[method_id(@__retain_semantics Other tags)]
436        pub unsafe fn tags(&self) -> Id<NSSet<NSString>>;
437
438        #[cfg(feature = "Foundation_NSBundle")]
439        #[method_id(@__retain_semantics Other bundle)]
440        pub unsafe fn bundle(&self) -> Id<NSBundle>;
441
442        #[cfg(feature = "Foundation_NSError")]
443        #[method(beginAccessingResourcesWithCompletionHandler:)]
444        pub unsafe fn beginAccessingResourcesWithCompletionHandler(
445            &self,
446            completion_handler: &Block<(*mut NSError,), ()>,
447        );
448
449        #[method(conditionallyBeginAccessingResourcesWithCompletionHandler:)]
450        pub unsafe fn conditionallyBeginAccessingResourcesWithCompletionHandler(
451            &self,
452            completion_handler: &Block<(Bool,), ()>,
453        );
454
455        #[method(endAccessingResources)]
456        pub unsafe fn endAccessingResources(&self);
457
458        #[cfg(feature = "Foundation_NSProgress")]
459        #[method_id(@__retain_semantics Other progress)]
460        pub unsafe fn progress(&self) -> Id<NSProgress>;
461    }
462);
463
464extern_methods!(
465    /// Methods declared on superclass `NSObject`
466    #[cfg(feature = "Foundation_NSBundleResourceRequest")]
467    unsafe impl NSBundleResourceRequest {
468        #[method_id(@__retain_semantics New new)]
469        pub unsafe fn new() -> Id<Self>;
470    }
471);
472
473extern_methods!(
474    /// NSBundleResourceRequestAdditions
475    #[cfg(feature = "Foundation_NSBundle")]
476    unsafe impl NSBundle {
477        #[cfg(all(feature = "Foundation_NSSet", feature = "Foundation_NSString"))]
478        #[method(setPreservationPriority:forTags:)]
479        pub unsafe fn setPreservationPriority_forTags(
480            &self,
481            priority: c_double,
482            tags: &NSSet<NSString>,
483        );
484
485        #[cfg(feature = "Foundation_NSString")]
486        #[method(preservationPriorityForTag:)]
487        pub unsafe fn preservationPriorityForTag(&self, tag: &NSString) -> c_double;
488    }
489);
490
491extern_static!(NSBundleResourceRequestLowDiskSpaceNotification: &'static NSNotificationName);
492
493extern_static!(NSBundleResourceRequestLoadingPriorityUrgent: c_double);