objc2_foundation/generated/
NSUbiquitousKeyValueStore.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
7use crate::*;
8
9extern_class!(
10    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestore?language=objc)
11    #[unsafe(super(NSObject))]
12    #[derive(Debug, PartialEq, Eq, Hash)]
13    pub struct NSUbiquitousKeyValueStore;
14);
15
16extern_conformance!(
17    unsafe impl NSObjectProtocol for NSUbiquitousKeyValueStore {}
18);
19
20impl NSUbiquitousKeyValueStore {
21    extern_methods!(
22        #[unsafe(method(defaultStore))]
23        #[unsafe(method_family = none)]
24        pub fn defaultStore() -> Retained<NSUbiquitousKeyValueStore>;
25
26        #[cfg(feature = "NSString")]
27        #[unsafe(method(objectForKey:))]
28        #[unsafe(method_family = none)]
29        pub fn objectForKey(&self, a_key: &NSString) -> Option<Retained<AnyObject>>;
30
31        #[cfg(feature = "NSString")]
32        /// # Safety
33        ///
34        /// `an_object` should be of the correct type.
35        #[unsafe(method(setObject:forKey:))]
36        #[unsafe(method_family = none)]
37        pub unsafe fn setObject_forKey(&self, an_object: Option<&AnyObject>, a_key: &NSString);
38
39        #[cfg(feature = "NSString")]
40        #[unsafe(method(removeObjectForKey:))]
41        #[unsafe(method_family = none)]
42        pub fn removeObjectForKey(&self, a_key: &NSString);
43
44        #[cfg(feature = "NSString")]
45        #[unsafe(method(stringForKey:))]
46        #[unsafe(method_family = none)]
47        pub fn stringForKey(&self, a_key: &NSString) -> Option<Retained<NSString>>;
48
49        #[cfg(all(feature = "NSArray", feature = "NSString"))]
50        #[unsafe(method(arrayForKey:))]
51        #[unsafe(method_family = none)]
52        pub fn arrayForKey(&self, a_key: &NSString) -> Option<Retained<NSArray>>;
53
54        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
55        #[unsafe(method(dictionaryForKey:))]
56        #[unsafe(method_family = none)]
57        pub fn dictionaryForKey(
58            &self,
59            a_key: &NSString,
60        ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
61
62        #[cfg(all(feature = "NSData", feature = "NSString"))]
63        #[unsafe(method(dataForKey:))]
64        #[unsafe(method_family = none)]
65        pub fn dataForKey(&self, a_key: &NSString) -> Option<Retained<NSData>>;
66
67        #[cfg(feature = "NSString")]
68        #[unsafe(method(longLongForKey:))]
69        #[unsafe(method_family = none)]
70        pub fn longLongForKey(&self, a_key: &NSString) -> c_longlong;
71
72        #[cfg(feature = "NSString")]
73        #[unsafe(method(doubleForKey:))]
74        #[unsafe(method_family = none)]
75        pub fn doubleForKey(&self, a_key: &NSString) -> c_double;
76
77        #[cfg(feature = "NSString")]
78        #[unsafe(method(boolForKey:))]
79        #[unsafe(method_family = none)]
80        pub fn boolForKey(&self, a_key: &NSString) -> bool;
81
82        #[cfg(feature = "NSString")]
83        #[unsafe(method(setString:forKey:))]
84        #[unsafe(method_family = none)]
85        pub fn setString_forKey(&self, a_string: Option<&NSString>, a_key: &NSString);
86
87        #[cfg(all(feature = "NSData", feature = "NSString"))]
88        #[unsafe(method(setData:forKey:))]
89        #[unsafe(method_family = none)]
90        pub fn setData_forKey(&self, a_data: Option<&NSData>, a_key: &NSString);
91
92        #[cfg(all(feature = "NSArray", feature = "NSString"))]
93        /// # Safety
94        ///
95        /// `an_array` generic should be of the correct type.
96        #[unsafe(method(setArray:forKey:))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn setArray_forKey(&self, an_array: Option<&NSArray>, a_key: &NSString);
99
100        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
101        /// # Safety
102        ///
103        /// `a_dictionary` generic should be of the correct type.
104        #[unsafe(method(setDictionary:forKey:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn setDictionary_forKey(
107            &self,
108            a_dictionary: Option<&NSDictionary<NSString, AnyObject>>,
109            a_key: &NSString,
110        );
111
112        #[cfg(feature = "NSString")]
113        #[unsafe(method(setLongLong:forKey:))]
114        #[unsafe(method_family = none)]
115        pub fn setLongLong_forKey(&self, value: c_longlong, a_key: &NSString);
116
117        #[cfg(feature = "NSString")]
118        #[unsafe(method(setDouble:forKey:))]
119        #[unsafe(method_family = none)]
120        pub fn setDouble_forKey(&self, value: c_double, a_key: &NSString);
121
122        #[cfg(feature = "NSString")]
123        #[unsafe(method(setBool:forKey:))]
124        #[unsafe(method_family = none)]
125        pub fn setBool_forKey(&self, value: bool, a_key: &NSString);
126
127        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
128        #[unsafe(method(dictionaryRepresentation))]
129        #[unsafe(method_family = none)]
130        pub fn dictionaryRepresentation(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
131
132        #[unsafe(method(synchronize))]
133        #[unsafe(method_family = none)]
134        pub fn synchronize(&self) -> bool;
135    );
136}
137
138/// Methods declared on superclass `NSObject`.
139impl NSUbiquitousKeyValueStore {
140    extern_methods!(
141        #[unsafe(method(init))]
142        #[unsafe(method_family = init)]
143        pub fn init(this: Allocated<Self>) -> Retained<Self>;
144
145        #[unsafe(method(new))]
146        #[unsafe(method_family = new)]
147        pub fn new() -> Retained<Self>;
148    );
149}
150
151impl DefaultRetained for NSUbiquitousKeyValueStore {
152    #[inline]
153    fn default_retained() -> Retained<Self> {
154        Self::new()
155    }
156}
157
158extern "C" {
159    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestoredidchangeexternallynotification?language=objc)
160    #[cfg(all(feature = "NSNotification", feature = "NSString"))]
161    pub static NSUbiquitousKeyValueStoreDidChangeExternallyNotification:
162        &'static NSNotificationName;
163}
164
165extern "C" {
166    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestorechangereasonkey?language=objc)
167    #[cfg(feature = "NSString")]
168    pub static NSUbiquitousKeyValueStoreChangeReasonKey: &'static NSString;
169}
170
171extern "C" {
172    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestorechangedkeyskey?language=objc)
173    #[cfg(feature = "NSString")]
174    pub static NSUbiquitousKeyValueStoreChangedKeysKey: &'static NSString;
175}
176
177/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestoreserverchange?language=objc)
178pub const NSUbiquitousKeyValueStoreServerChange: NSInteger = 0;
179/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestoreinitialsyncchange?language=objc)
180pub const NSUbiquitousKeyValueStoreInitialSyncChange: NSInteger = 1;
181/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestorequotaviolationchange?language=objc)
182pub const NSUbiquitousKeyValueStoreQuotaViolationChange: NSInteger = 2;
183/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestoreaccountchange?language=objc)
184pub const NSUbiquitousKeyValueStoreAccountChange: NSInteger = 3;