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

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCoding for NSPersonNameComponents {}
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCopying for NSPersonNameComponents {}
);

#[cfg(feature = "NSObject")]
unsafe impl CopyingHelper for NSPersonNameComponents {
    type Result = Self;
}

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

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSSecureCoding for NSPersonNameComponents {}
);

impl NSPersonNameComponents {
    extern_methods!(
        #[cfg(feature = "NSString")]
        #[unsafe(method(namePrefix))]
        #[unsafe(method_family = none)]
        pub fn namePrefix(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        /// Setter for [`namePrefix`][Self::namePrefix].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setNamePrefix:))]
        #[unsafe(method_family = none)]
        pub fn setNamePrefix(&self, name_prefix: Option<&NSString>);

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

        #[cfg(feature = "NSString")]
        /// Setter for [`givenName`][Self::givenName].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setGivenName:))]
        #[unsafe(method_family = none)]
        pub fn setGivenName(&self, given_name: Option<&NSString>);

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

        #[cfg(feature = "NSString")]
        /// Setter for [`middleName`][Self::middleName].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setMiddleName:))]
        #[unsafe(method_family = none)]
        pub fn setMiddleName(&self, middle_name: Option<&NSString>);

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

        #[cfg(feature = "NSString")]
        /// Setter for [`familyName`][Self::familyName].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setFamilyName:))]
        #[unsafe(method_family = none)]
        pub fn setFamilyName(&self, family_name: Option<&NSString>);

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

        #[cfg(feature = "NSString")]
        /// Setter for [`nameSuffix`][Self::nameSuffix].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setNameSuffix:))]
        #[unsafe(method_family = none)]
        pub fn setNameSuffix(&self, name_suffix: Option<&NSString>);

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

        #[cfg(feature = "NSString")]
        /// Setter for [`nickname`][Self::nickname].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setNickname:))]
        #[unsafe(method_family = none)]
        pub fn setNickname(&self, nickname: Option<&NSString>);

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

        /// Setter for [`phoneticRepresentation`][Self::phoneticRepresentation].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setPhoneticRepresentation:))]
        #[unsafe(method_family = none)]
        pub fn setPhoneticRepresentation(
            &self,
            phonetic_representation: Option<&NSPersonNameComponents>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl NSPersonNameComponents {
    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 NSPersonNameComponents {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}