objc2-core-data 0.3.2

Bindings to the CoreData 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 objc2_foundation::*;

use crate::*;

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

extern_conformance!(
    unsafe impl NSCopying for NSPersistentStoreDescription {}
);

unsafe impl CopyingHelper for NSPersistentStoreDescription {
    type Result = Self;
}

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

impl NSPersistentStoreDescription {
    extern_methods!(
        #[unsafe(method(persistentStoreDescriptionWithURL:))]
        #[unsafe(method_family = none)]
        pub unsafe fn persistentStoreDescriptionWithURL(url: &NSURL) -> Retained<Self>;

        #[unsafe(method(type))]
        #[unsafe(method_family = none)]
        pub unsafe fn r#type(&self) -> Retained<NSString>;

        /// Setter for [`type`][Self::type].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setType(&self, r#type: &NSString);

        #[unsafe(method(configuration))]
        #[unsafe(method_family = none)]
        pub unsafe fn configuration(&self) -> Option<Retained<NSString>>;

        /// Setter for [`configuration`][Self::configuration].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setConfiguration:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setConfiguration(&self, configuration: Option<&NSString>);

        #[unsafe(method(URL))]
        #[unsafe(method_family = none)]
        pub unsafe fn URL(&self) -> Option<Retained<NSURL>>;

        /// Setter for [`URL`][Self::URL].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setURL:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setURL(&self, url: Option<&NSURL>);

        #[unsafe(method(options))]
        #[unsafe(method_family = none)]
        pub unsafe fn options(&self) -> Retained<NSDictionary<NSString, NSObject>>;

        /// # Safety
        ///
        /// `option` should be of the correct type.
        #[unsafe(method(setOption:forKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setOption_forKey(&self, option: Option<&NSObject>, key: &NSString);

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

        /// Setter for [`isReadOnly`][Self::isReadOnly].
        #[unsafe(method(setReadOnly:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setReadOnly(&self, read_only: bool);

        #[unsafe(method(timeout))]
        #[unsafe(method_family = none)]
        pub unsafe fn timeout(&self) -> NSTimeInterval;

        /// Setter for [`timeout`][Self::timeout].
        #[unsafe(method(setTimeout:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTimeout(&self, timeout: NSTimeInterval);

        #[unsafe(method(sqlitePragmas))]
        #[unsafe(method_family = none)]
        pub unsafe fn sqlitePragmas(&self) -> Retained<NSDictionary<NSString, NSObject>>;

        /// # Safety
        ///
        /// `value` should be of the correct type.
        #[unsafe(method(setValue:forPragmaNamed:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setValue_forPragmaNamed(&self, value: Option<&NSObject>, name: &NSString);

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

        /// Setter for [`shouldAddStoreAsynchronously`][Self::shouldAddStoreAsynchronously].
        #[unsafe(method(setShouldAddStoreAsynchronously:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setShouldAddStoreAsynchronously(&self, should_add_store_asynchronously: bool);

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

        /// Setter for [`shouldMigrateStoreAutomatically`][Self::shouldMigrateStoreAutomatically].
        #[unsafe(method(setShouldMigrateStoreAutomatically:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setShouldMigrateStoreAutomatically(
            &self,
            should_migrate_store_automatically: bool,
        );

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

        /// Setter for [`shouldInferMappingModelAutomatically`][Self::shouldInferMappingModelAutomatically].
        #[unsafe(method(setShouldInferMappingModelAutomatically:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setShouldInferMappingModelAutomatically(
            &self,
            should_infer_mapping_model_automatically: bool,
        );

        #[unsafe(method(initWithURL:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithURL(this: Allocated<Self>, url: &NSURL) -> Retained<Self>;
    );
}

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

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

/// NSPersistentCloudKitContainerAdditions.
impl NSPersistentStoreDescription {
    extern_methods!(
        #[cfg(feature = "NSPersistentCloudKitContainerOptions")]
        /// Use this property to apply customized instances of NSPersistentCloudKitContainerOptions to
        /// a store description you wish to use with CloudKit.
        #[unsafe(method(cloudKitContainerOptions))]
        #[unsafe(method_family = none)]
        pub unsafe fn cloudKitContainerOptions(
            &self,
        ) -> Option<Retained<NSPersistentCloudKitContainerOptions>>;

        #[cfg(feature = "NSPersistentCloudKitContainerOptions")]
        /// Setter for [`cloudKitContainerOptions`][Self::cloudKitContainerOptions].
        #[unsafe(method(setCloudKitContainerOptions:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCloudKitContainerOptions(
            &self,
            cloud_kit_container_options: Option<&NSPersistentCloudKitContainerOptions>,
        );
    );
}