objc2-foundation 0.3.2

Bindings to the Foundation framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestore?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSUbiquitousKeyValueStore;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for NSUbiquitousKeyValueStore {}
);

impl NSUbiquitousKeyValueStore {
    extern_methods!(
        #[unsafe(method(defaultStore))]
        #[unsafe(method_family = none)]
        pub fn defaultStore() -> Retained<NSUbiquitousKeyValueStore>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(objectForKey:))]
        #[unsafe(method_family = none)]
        pub fn objectForKey(&self, a_key: &NSString) -> Option<Retained<AnyObject>>;

        #[cfg(feature = "NSString")]
        /// # Safety
        ///
        /// `an_object` should be of the correct type.
        #[unsafe(method(setObject:forKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setObject_forKey(&self, an_object: Option<&AnyObject>, a_key: &NSString);

        #[cfg(feature = "NSString")]
        #[unsafe(method(removeObjectForKey:))]
        #[unsafe(method_family = none)]
        pub fn removeObjectForKey(&self, a_key: &NSString);

        #[cfg(feature = "NSString")]
        #[unsafe(method(stringForKey:))]
        #[unsafe(method_family = none)]
        pub fn stringForKey(&self, a_key: &NSString) -> Option<Retained<NSString>>;

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[unsafe(method(arrayForKey:))]
        #[unsafe(method_family = none)]
        pub fn arrayForKey(&self, a_key: &NSString) -> Option<Retained<NSArray>>;

        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
        #[unsafe(method(dictionaryForKey:))]
        #[unsafe(method_family = none)]
        pub fn dictionaryForKey(
            &self,
            a_key: &NSString,
        ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;

        #[cfg(all(feature = "NSData", feature = "NSString"))]
        #[unsafe(method(dataForKey:))]
        #[unsafe(method_family = none)]
        pub fn dataForKey(&self, a_key: &NSString) -> Option<Retained<NSData>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(longLongForKey:))]
        #[unsafe(method_family = none)]
        pub fn longLongForKey(&self, a_key: &NSString) -> c_longlong;

        #[cfg(feature = "NSString")]
        #[unsafe(method(doubleForKey:))]
        #[unsafe(method_family = none)]
        pub fn doubleForKey(&self, a_key: &NSString) -> c_double;

        #[cfg(feature = "NSString")]
        #[unsafe(method(boolForKey:))]
        #[unsafe(method_family = none)]
        pub fn boolForKey(&self, a_key: &NSString) -> bool;

        #[cfg(feature = "NSString")]
        #[unsafe(method(setString:forKey:))]
        #[unsafe(method_family = none)]
        pub fn setString_forKey(&self, a_string: Option<&NSString>, a_key: &NSString);

        #[cfg(all(feature = "NSData", feature = "NSString"))]
        #[unsafe(method(setData:forKey:))]
        #[unsafe(method_family = none)]
        pub fn setData_forKey(&self, a_data: Option<&NSData>, a_key: &NSString);

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        /// # Safety
        ///
        /// `an_array` generic should be of the correct type.
        #[unsafe(method(setArray:forKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setArray_forKey(&self, an_array: Option<&NSArray>, a_key: &NSString);

        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
        /// # Safety
        ///
        /// `a_dictionary` generic should be of the correct type.
        #[unsafe(method(setDictionary:forKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDictionary_forKey(
            &self,
            a_dictionary: Option<&NSDictionary<NSString, AnyObject>>,
            a_key: &NSString,
        );

        #[cfg(feature = "NSString")]
        #[unsafe(method(setLongLong:forKey:))]
        #[unsafe(method_family = none)]
        pub fn setLongLong_forKey(&self, value: c_longlong, a_key: &NSString);

        #[cfg(feature = "NSString")]
        #[unsafe(method(setDouble:forKey:))]
        #[unsafe(method_family = none)]
        pub fn setDouble_forKey(&self, value: c_double, a_key: &NSString);

        #[cfg(feature = "NSString")]
        #[unsafe(method(setBool:forKey:))]
        #[unsafe(method_family = none)]
        pub fn setBool_forKey(&self, value: bool, a_key: &NSString);

        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
        #[unsafe(method(dictionaryRepresentation))]
        #[unsafe(method_family = none)]
        pub fn dictionaryRepresentation(&self) -> Retained<NSDictionary<NSString, AnyObject>>;

        #[unsafe(method(synchronize))]
        #[unsafe(method_family = none)]
        pub fn synchronize(&self) -> bool;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSUbiquitousKeyValueStore {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl DefaultRetained for NSUbiquitousKeyValueStore {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestoredidchangeexternallynotification?language=objc)
    #[cfg(all(feature = "NSNotification", feature = "NSString"))]
    pub static NSUbiquitousKeyValueStoreDidChangeExternallyNotification:
        &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestorechangereasonkey?language=objc)
    #[cfg(feature = "NSString")]
    pub static NSUbiquitousKeyValueStoreChangeReasonKey: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestorechangedkeyskey?language=objc)
    #[cfg(feature = "NSString")]
    pub static NSUbiquitousKeyValueStoreChangedKeysKey: &'static NSString;
}

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestoreserverchange?language=objc)
pub const NSUbiquitousKeyValueStoreServerChange: NSInteger = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestoreinitialsyncchange?language=objc)
pub const NSUbiquitousKeyValueStoreInitialSyncChange: NSInteger = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestorequotaviolationchange?language=objc)
pub const NSUbiquitousKeyValueStoreQuotaViolationChange: NSInteger = 2;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsubiquitouskeyvaluestoreaccountchange?language=objc)
pub const NSUbiquitousKeyValueStoreAccountChange: NSInteger = 3;