objc2-foundation 0.3.1

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/nscalendardate?language=objc)
    #[unsafe(super(NSDate, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "NSDate")]
    #[deprecated = "Use NSCalendar and NSDateComponents and NSDateFormatter instead"]
    pub struct NSCalendarDate;
);

#[cfg(all(feature = "NSDate", feature = "NSObject"))]
extern_conformance!(
    unsafe impl NSCoding for NSCalendarDate {}
);

#[cfg(all(feature = "NSDate", feature = "NSObject"))]
extern_conformance!(
    unsafe impl NSCopying for NSCalendarDate {}
);

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

#[cfg(feature = "NSDate")]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSCalendarDate {}
);

#[cfg(all(feature = "NSDate", feature = "NSObject"))]
extern_conformance!(
    unsafe impl NSSecureCoding for NSCalendarDate {}
);

#[cfg(feature = "NSDate")]
impl NSCalendarDate {
    extern_methods!(
        #[deprecated = "Use NSCalendar instead"]
        #[unsafe(method(calendarDate))]
        #[unsafe(method_family = none)]
        pub unsafe fn calendarDate() -> Retained<AnyObject>;

        #[cfg(feature = "NSString")]
        #[deprecated = "Use NSDateFormatter instead"]
        #[unsafe(method(dateWithString:calendarFormat:locale:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dateWithString_calendarFormat_locale(
            description: &NSString,
            format: &NSString,
            locale: Option<&AnyObject>,
        ) -> Option<Retained<AnyObject>>;

        #[cfg(feature = "NSString")]
        #[deprecated = "Use NSDateFormatter instead"]
        #[unsafe(method(dateWithString:calendarFormat:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dateWithString_calendarFormat(
            description: &NSString,
            format: &NSString,
        ) -> Option<Retained<AnyObject>>;

        #[cfg(feature = "NSTimeZone")]
        #[deprecated = "Use NSCalendar and NSDateComponents instead"]
        #[unsafe(method(dateWithYear:month:day:hour:minute:second:timeZone:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dateWithYear_month_day_hour_minute_second_timeZone(
            year: NSInteger,
            month: NSUInteger,
            day: NSUInteger,
            hour: NSUInteger,
            minute: NSUInteger,
            second: NSUInteger,
            a_time_zone: Option<&NSTimeZone>,
        ) -> Retained<AnyObject>;

        #[deprecated = "Use NSCalendar instead"]
        #[unsafe(method(dateByAddingYears:months:days:hours:minutes:seconds:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dateByAddingYears_months_days_hours_minutes_seconds(
            &self,
            year: NSInteger,
            month: NSInteger,
            day: NSInteger,
            hour: NSInteger,
            minute: NSInteger,
            second: NSInteger,
        ) -> Retained<NSCalendarDate>;

        #[deprecated]
        #[unsafe(method(dayOfCommonEra))]
        #[unsafe(method_family = none)]
        pub unsafe fn dayOfCommonEra(&self) -> NSInteger;

        #[deprecated]
        #[unsafe(method(dayOfMonth))]
        #[unsafe(method_family = none)]
        pub unsafe fn dayOfMonth(&self) -> NSInteger;

        #[deprecated]
        #[unsafe(method(dayOfWeek))]
        #[unsafe(method_family = none)]
        pub unsafe fn dayOfWeek(&self) -> NSInteger;

        #[deprecated]
        #[unsafe(method(dayOfYear))]
        #[unsafe(method_family = none)]
        pub unsafe fn dayOfYear(&self) -> NSInteger;

        #[deprecated]
        #[unsafe(method(hourOfDay))]
        #[unsafe(method_family = none)]
        pub unsafe fn hourOfDay(&self) -> NSInteger;

        #[deprecated]
        #[unsafe(method(minuteOfHour))]
        #[unsafe(method_family = none)]
        pub unsafe fn minuteOfHour(&self) -> NSInteger;

        #[deprecated]
        #[unsafe(method(monthOfYear))]
        #[unsafe(method_family = none)]
        pub unsafe fn monthOfYear(&self) -> NSInteger;

        #[deprecated]
        #[unsafe(method(secondOfMinute))]
        #[unsafe(method_family = none)]
        pub unsafe fn secondOfMinute(&self) -> NSInteger;

        #[deprecated]
        #[unsafe(method(yearOfCommonEra))]
        #[unsafe(method_family = none)]
        pub unsafe fn yearOfCommonEra(&self) -> NSInteger;

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

        #[cfg(feature = "NSString")]
        #[deprecated]
        #[unsafe(method(descriptionWithCalendarFormat:locale:))]
        #[unsafe(method_family = none)]
        pub unsafe fn descriptionWithCalendarFormat_locale(
            &self,
            format: &NSString,
            locale: Option<&AnyObject>,
        ) -> Retained<NSString>;

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

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

        #[cfg(feature = "NSTimeZone")]
        #[deprecated]
        #[unsafe(method(timeZone))]
        #[unsafe(method_family = none)]
        pub unsafe fn timeZone(&self) -> Retained<NSTimeZone>;

        #[cfg(feature = "NSString")]
        #[deprecated = "Use NSDateFormatter instead"]
        #[unsafe(method(initWithString:calendarFormat:locale:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithString_calendarFormat_locale(
            this: Allocated<Self>,
            description: &NSString,
            format: &NSString,
            locale: Option<&AnyObject>,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "NSString")]
        #[deprecated = "Use NSDateFormatter instead"]
        #[unsafe(method(initWithString:calendarFormat:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithString_calendarFormat(
            this: Allocated<Self>,
            description: &NSString,
            format: &NSString,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "NSString")]
        #[deprecated = "Use NSDateFormatter instead"]
        #[unsafe(method(initWithString:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithString(
            this: Allocated<Self>,
            description: &NSString,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "NSTimeZone")]
        #[deprecated = "Use NSCalendar and NSDateComponents instead"]
        #[unsafe(method(initWithYear:month:day:hour:minute:second:timeZone:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithYear_month_day_hour_minute_second_timeZone(
            this: Allocated<Self>,
            year: NSInteger,
            month: NSUInteger,
            day: NSUInteger,
            hour: NSUInteger,
            minute: NSUInteger,
            second: NSUInteger,
            a_time_zone: Option<&NSTimeZone>,
        ) -> Retained<Self>;

        #[cfg(feature = "NSString")]
        #[deprecated]
        #[unsafe(method(setCalendarFormat:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCalendarFormat(&self, format: Option<&NSString>);

        #[cfg(feature = "NSTimeZone")]
        #[deprecated]
        #[unsafe(method(setTimeZone:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTimeZone(&self, a_time_zone: Option<&NSTimeZone>);

        #[deprecated]
        #[unsafe(method(years:months:days:hours:minutes:seconds:sinceDate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn years_months_days_hours_minutes_seconds_sinceDate(
            &self,
            yp: *mut NSInteger,
            mop: *mut NSInteger,
            dp: *mut NSInteger,
            hp: *mut NSInteger,
            mip: *mut NSInteger,
            sp: *mut NSInteger,
            date: &NSCalendarDate,
        );

        #[deprecated]
        #[unsafe(method(distantFuture))]
        #[unsafe(method_family = none)]
        pub unsafe fn distantFuture() -> Retained<Self>;

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

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

        #[unsafe(method(initWithTimeIntervalSinceReferenceDate:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithTimeIntervalSinceReferenceDate(
            this: Allocated<Self>,
            ti: NSTimeInterval,
        ) -> Retained<Self>;

        #[cfg(feature = "NSCoder")]
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "NSDate")]
impl NSCalendarDate {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

/// NSCalendarDateExtras.
#[cfg(feature = "NSDate")]
impl NSDate {
    extern_methods!(
        #[cfg(feature = "NSString")]
        #[deprecated = "Create an NSDateFormatter with `init` and set the dateFormat property instead."]
        #[unsafe(method(dateWithNaturalLanguageString:locale:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dateWithNaturalLanguageString_locale(
            string: &NSString,
            locale: Option<&AnyObject>,
        ) -> Option<Retained<AnyObject>>;

        #[cfg(feature = "NSString")]
        #[deprecated = "Create an NSDateFormatter with `init` and set the dateFormat property instead."]
        #[unsafe(method(dateWithNaturalLanguageString:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dateWithNaturalLanguageString(
            string: &NSString,
        ) -> Option<Retained<AnyObject>>;

        #[cfg(feature = "NSString")]
        #[deprecated = "Use NSDateFormatter instead"]
        #[unsafe(method(dateWithString:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dateWithString(a_string: &NSString) -> Retained<AnyObject>;

        #[cfg(all(feature = "NSString", feature = "NSTimeZone"))]
        #[deprecated]
        #[unsafe(method(dateWithCalendarFormat:timeZone:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dateWithCalendarFormat_timeZone(
            &self,
            format: Option<&NSString>,
            a_time_zone: Option<&NSTimeZone>,
        ) -> Retained<NSCalendarDate>;

        #[cfg(all(feature = "NSString", feature = "NSTimeZone"))]
        #[deprecated]
        #[unsafe(method(descriptionWithCalendarFormat:timeZone:locale:))]
        #[unsafe(method_family = none)]
        pub unsafe fn descriptionWithCalendarFormat_timeZone_locale(
            &self,
            format: Option<&NSString>,
            a_time_zone: Option<&NSTimeZone>,
            locale: Option<&AnyObject>,
        ) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        #[deprecated = "Use NSDateFormatter instead"]
        #[unsafe(method(initWithString:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithString(
            this: Allocated<Self>,
            description: &NSString,
        ) -> Option<Retained<Self>>;
    );
}