objc2_app_kit/generated/
NSPersistentDocument.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-data")]
7#[cfg(target_vendor = "apple")]
8use objc2_core_data::*;
9use objc2_foundation::*;
10
11use crate::*;
12
13extern_class!(
14    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspersistentdocument?language=objc)
15    #[unsafe(super(NSDocument, NSObject))]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    #[cfg(feature = "NSDocument")]
18    pub struct NSPersistentDocument;
19);
20
21#[cfg(all(feature = "NSDocument", feature = "NSKeyValueBinding"))]
22unsafe impl NSEditorRegistration for NSPersistentDocument {}
23
24#[cfg(feature = "NSDocument")]
25unsafe impl NSFilePresenter for NSPersistentDocument {}
26
27#[cfg(all(feature = "NSDocument", feature = "NSMenu"))]
28unsafe impl NSMenuItemValidation for NSPersistentDocument {}
29
30#[cfg(feature = "NSDocument")]
31unsafe impl NSObjectProtocol for NSPersistentDocument {}
32
33#[cfg(all(feature = "NSDocument", feature = "NSUserInterfaceValidation"))]
34unsafe impl NSUserInterfaceValidations for NSPersistentDocument {}
35
36#[cfg(feature = "NSDocument")]
37impl NSPersistentDocument {
38    extern_methods!(
39        #[cfg(feature = "objc2-core-data")]
40        #[cfg(target_vendor = "apple")]
41        #[unsafe(method(managedObjectContext))]
42        #[unsafe(method_family = none)]
43        pub unsafe fn managedObjectContext(&self) -> Option<Retained<NSManagedObjectContext>>;
44
45        #[cfg(feature = "objc2-core-data")]
46        #[cfg(target_vendor = "apple")]
47        /// Setter for [`managedObjectContext`][Self::managedObjectContext].
48        #[unsafe(method(setManagedObjectContext:))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn setManagedObjectContext(
51            &self,
52            managed_object_context: Option<&NSManagedObjectContext>,
53        );
54
55        #[cfg(feature = "objc2-core-data")]
56        #[cfg(target_vendor = "apple")]
57        #[unsafe(method(managedObjectModel))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn managedObjectModel(&self) -> Option<Retained<NSManagedObjectModel>>;
60
61        #[unsafe(method(configurePersistentStoreCoordinatorForURL:ofType:modelConfiguration:storeOptions:error:_))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn configurePersistentStoreCoordinatorForURL_ofType_modelConfiguration_storeOptions_error(
64            &self,
65            url: &NSURL,
66            file_type: &NSString,
67            configuration: Option<&NSString>,
68            store_options: Option<&NSDictionary<NSString, AnyObject>>,
69        ) -> Result<(), Retained<NSError>>;
70
71        #[unsafe(method(persistentStoreTypeForFileType:))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn persistentStoreTypeForFileType(
74            &self,
75            file_type: &NSString,
76        ) -> Retained<NSString>;
77
78        #[unsafe(method(writeToURL:ofType:forSaveOperation:originalContentsURL:error:_))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn writeToURL_ofType_forSaveOperation_originalContentsURL_error(
81            &self,
82            absolute_url: &NSURL,
83            type_name: &NSString,
84            save_operation: NSSaveOperationType,
85            absolute_original_contents_url: Option<&NSURL>,
86        ) -> Result<(), Retained<NSError>>;
87
88        #[unsafe(method(readFromURL:ofType:error:_))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn readFromURL_ofType_error(
91            &self,
92            absolute_url: &NSURL,
93            type_name: &NSString,
94        ) -> Result<(), Retained<NSError>>;
95
96        #[unsafe(method(revertToContentsOfURL:ofType:error:_))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn revertToContentsOfURL_ofType_error(
99            &self,
100            in_absolute_url: &NSURL,
101            in_type_name: &NSString,
102        ) -> Result<(), Retained<NSError>>;
103    );
104}
105
106/// Methods declared on superclass `NSDocument`.
107#[cfg(feature = "NSDocument")]
108impl NSPersistentDocument {
109    extern_methods!(
110        #[unsafe(method(init))]
111        #[unsafe(method_family = init)]
112        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
113
114        #[unsafe(method(initWithType:error:_))]
115        #[unsafe(method_family = init)]
116        pub unsafe fn initWithType_error(
117            this: Allocated<Self>,
118            type_name: &NSString,
119        ) -> Result<Retained<Self>, Retained<NSError>>;
120
121        #[unsafe(method(initWithContentsOfURL:ofType:error:_))]
122        #[unsafe(method_family = init)]
123        pub unsafe fn initWithContentsOfURL_ofType_error(
124            this: Allocated<Self>,
125            url: &NSURL,
126            type_name: &NSString,
127        ) -> Result<Retained<Self>, Retained<NSError>>;
128
129        #[unsafe(method(initForURL:withContentsOfURL:ofType:error:_))]
130        #[unsafe(method_family = init)]
131        pub unsafe fn initForURL_withContentsOfURL_ofType_error(
132            this: Allocated<Self>,
133            url_or_nil: Option<&NSURL>,
134            contents_url: &NSURL,
135            type_name: &NSString,
136        ) -> Result<Retained<Self>, Retained<NSError>>;
137    );
138}
139
140/// Methods declared on superclass `NSObject`.
141#[cfg(feature = "NSDocument")]
142impl NSPersistentDocument {
143    extern_methods!(
144        #[unsafe(method(new))]
145        #[unsafe(method_family = new)]
146        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
147    );
148}
149
150/// NSDeprecated.
151#[cfg(feature = "NSDocument")]
152impl NSPersistentDocument {
153    extern_methods!(
154        #[deprecated]
155        #[unsafe(method(configurePersistentStoreCoordinatorForURL:ofType:error:_))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn configurePersistentStoreCoordinatorForURL_ofType_error(
158            &self,
159            url: Option<&NSURL>,
160            file_type: Option<&NSString>,
161        ) -> Result<(), Retained<NSError>>;
162    );
163}