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/nsentitydescription?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSEntityDescription;
);

extern_conformance!(
    unsafe impl NSCoding for NSEntityDescription {}
);

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

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

extern_conformance!(
    unsafe impl NSFastEnumeration for NSEntityDescription {}
);

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

impl NSEntityDescription {
    extern_methods!(
        #[cfg(feature = "NSManagedObjectContext")]
        #[unsafe(method(entityForName:inManagedObjectContext:))]
        #[unsafe(method_family = none)]
        pub unsafe fn entityForName_inManagedObjectContext(
            entity_name: &NSString,
            context: &NSManagedObjectContext,
        ) -> Option<Retained<NSEntityDescription>>;

        #[cfg(all(feature = "NSManagedObject", feature = "NSManagedObjectContext"))]
        #[unsafe(method(insertNewObjectForEntityForName:inManagedObjectContext:))]
        #[unsafe(method_family = none)]
        pub unsafe fn insertNewObjectForEntityForName_inManagedObjectContext(
            entity_name: &NSString,
            context: &NSManagedObjectContext,
        ) -> Retained<NSManagedObject>;

        #[cfg(feature = "NSManagedObjectModel")]
        /// # Safety
        ///
        /// This is not retained internally, you must ensure the object is still alive.
        #[unsafe(method(managedObjectModel))]
        #[unsafe(method_family = none)]
        pub unsafe fn managedObjectModel(&self) -> Retained<NSManagedObjectModel>;

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

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

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

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

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

        /// Setter for [`isAbstract`][Self::isAbstract].
        #[unsafe(method(setAbstract:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAbstract(&self, r#abstract: bool);

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

        #[unsafe(method(subentities))]
        #[unsafe(method_family = none)]
        pub unsafe fn subentities(&self) -> Retained<NSArray<NSEntityDescription>>;

        /// Setter for [`subentities`][Self::subentities].
        #[unsafe(method(setSubentities:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSubentities(&self, subentities: &NSArray<NSEntityDescription>);

        /// # Safety
        ///
        /// This is not retained internally, you must ensure the object is still alive.
        #[unsafe(method(superentity))]
        #[unsafe(method_family = none)]
        pub unsafe fn superentity(&self) -> Option<Retained<NSEntityDescription>>;

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

        #[cfg(feature = "NSPropertyDescription")]
        #[unsafe(method(properties))]
        #[unsafe(method_family = none)]
        pub unsafe fn properties(&self) -> Retained<NSArray<NSPropertyDescription>>;

        #[cfg(feature = "NSPropertyDescription")]
        /// Setter for [`properties`][Self::properties].
        #[unsafe(method(setProperties:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setProperties(&self, properties: &NSArray<NSPropertyDescription>);

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

        /// Setter for [`userInfo`][Self::userInfo].
        ///
        /// # Safety
        ///
        /// `user_info` generic should be of the correct type.
        #[unsafe(method(setUserInfo:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setUserInfo(&self, user_info: Option<&NSDictionary>);

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

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

        #[cfg(all(
            feature = "NSPropertyDescription",
            feature = "NSRelationshipDescription"
        ))]
        #[unsafe(method(relationshipsWithDestinationEntity:))]
        #[unsafe(method_family = none)]
        pub unsafe fn relationshipsWithDestinationEntity(
            &self,
            entity: &NSEntityDescription,
        ) -> Retained<NSArray<NSRelationshipDescription>>;

        #[unsafe(method(isKindOfEntity:))]
        #[unsafe(method_family = none)]
        pub unsafe fn isKindOfEntity(&self, entity: &NSEntityDescription) -> bool;

        #[unsafe(method(versionHash))]
        #[unsafe(method_family = none)]
        pub unsafe fn versionHash(&self) -> Retained<NSData>;

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

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

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

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

        #[cfg(feature = "NSFetchIndexDescription")]
        #[unsafe(method(indexes))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexes(&self) -> Retained<NSArray<NSFetchIndexDescription>>;

        #[cfg(feature = "NSFetchIndexDescription")]
        /// Setter for [`indexes`][Self::indexes].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setIndexes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setIndexes(&self, indexes: &NSArray<NSFetchIndexDescription>);

        #[unsafe(method(uniquenessConstraints))]
        #[unsafe(method_family = none)]
        pub unsafe fn uniquenessConstraints(&self) -> Retained<NSArray<NSArray<AnyObject>>>;

        /// Setter for [`uniquenessConstraints`][Self::uniquenessConstraints].
        ///
        /// # Safety
        ///
        /// `uniqueness_constraints` generic generic should be of the correct type.
        #[unsafe(method(setUniquenessConstraints:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setUniquenessConstraints(
            &self,
            uniqueness_constraints: &NSArray<NSArray<AnyObject>>,
        );

        #[deprecated = "Use NSEntityDescription.indexes instead"]
        #[unsafe(method(compoundIndexes))]
        #[unsafe(method_family = none)]
        pub unsafe fn compoundIndexes(&self) -> Retained<NSArray<NSArray<AnyObject>>>;

        /// Setter for [`compoundIndexes`][Self::compoundIndexes].
        ///
        /// # Safety
        ///
        /// `compound_indexes` generic generic should be of the correct type.
        #[deprecated = "Use NSEntityDescription.indexes instead"]
        #[unsafe(method(setCompoundIndexes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCompoundIndexes(&self, compound_indexes: &NSArray<NSArray<AnyObject>>);

        #[unsafe(method(coreSpotlightDisplayNameExpression))]
        #[unsafe(method_family = none)]
        pub unsafe fn coreSpotlightDisplayNameExpression(&self) -> Retained<NSExpression>;

        /// Setter for [`coreSpotlightDisplayNameExpression`][Self::coreSpotlightDisplayNameExpression].
        #[unsafe(method(setCoreSpotlightDisplayNameExpression:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCoreSpotlightDisplayNameExpression(
            &self,
            core_spotlight_display_name_expression: &NSExpression,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl NSEntityDescription {
    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>;
    );
}