Source code
Revision control
Copy as Markdown
Other Tools
//! 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::*;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsiso8601dateformatoptions?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSISO8601DateFormatOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSISO8601DateFormatOptions: NSUInteger {
#[doc(alias = "NSISO8601DateFormatWithYear")]
const WithYear = 1;
#[doc(alias = "NSISO8601DateFormatWithMonth")]
const WithMonth = 2;
#[doc(alias = "NSISO8601DateFormatWithWeekOfYear")]
const WithWeekOfYear = 4;
#[doc(alias = "NSISO8601DateFormatWithDay")]
const WithDay = 16;
#[doc(alias = "NSISO8601DateFormatWithTime")]
const WithTime = 32;
#[doc(alias = "NSISO8601DateFormatWithTimeZone")]
const WithTimeZone = 64;
#[doc(alias = "NSISO8601DateFormatWithSpaceBetweenDateAndTime")]
const WithSpaceBetweenDateAndTime = 128;
#[doc(alias = "NSISO8601DateFormatWithDashSeparatorInDate")]
const WithDashSeparatorInDate = 256;
#[doc(alias = "NSISO8601DateFormatWithColonSeparatorInTime")]
const WithColonSeparatorInTime = 512;
#[doc(alias = "NSISO8601DateFormatWithColonSeparatorInTimeZone")]
const WithColonSeparatorInTimeZone = 1024;
#[doc(alias = "NSISO8601DateFormatWithFractionalSeconds")]
const WithFractionalSeconds = 2048;
#[doc(alias = "NSISO8601DateFormatWithFullDate")]
const WithFullDate = 275;
#[doc(alias = "NSISO8601DateFormatWithFullTime")]
const WithFullTime = 1632;
#[doc(alias = "NSISO8601DateFormatWithInternetDateTime")]
const WithInternetDateTime = 1907;
}
}
unsafe impl Encode for NSISO8601DateFormatOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSISO8601DateFormatOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsiso8601dateformatter?language=objc)
#[unsafe(super(NSFormatter, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSFormatter")]
pub struct NSISO8601DateFormatter;
);
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
extern_conformance!(
unsafe impl NSCoding for NSISO8601DateFormatter {}
);
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
extern_conformance!(
unsafe impl NSCopying for NSISO8601DateFormatter {}
);
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl CopyingHelper for NSISO8601DateFormatter {
type Result = Self;
}
#[cfg(feature = "NSFormatter")]
extern_conformance!(
unsafe impl NSObjectProtocol for NSISO8601DateFormatter {}
);
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
extern_conformance!(
unsafe impl NSSecureCoding for NSISO8601DateFormatter {}
);
#[cfg(feature = "NSFormatter")]
impl NSISO8601DateFormatter {
extern_methods!(
#[cfg(feature = "NSTimeZone")]
#[unsafe(method(timeZone))]
#[unsafe(method_family = none)]
pub fn timeZone(&self) -> Retained<NSTimeZone>;
#[cfg(feature = "NSTimeZone")]
/// Setter for [`timeZone`][Self::timeZone].
///
/// This is [copied][crate::NSCopying::copy] when set.
#[unsafe(method(setTimeZone:))]
#[unsafe(method_family = none)]
pub fn setTimeZone(&self, time_zone: Option<&NSTimeZone>);
#[unsafe(method(formatOptions))]
#[unsafe(method_family = none)]
pub fn formatOptions(&self) -> NSISO8601DateFormatOptions;
/// Setter for [`formatOptions`][Self::formatOptions].
#[unsafe(method(setFormatOptions:))]
#[unsafe(method_family = none)]
pub fn setFormatOptions(&self, format_options: NSISO8601DateFormatOptions);
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(all(feature = "NSDate", feature = "NSString"))]
#[unsafe(method(stringFromDate:))]
#[unsafe(method_family = none)]
pub fn stringFromDate(&self, date: &NSDate) -> Retained<NSString>;
#[cfg(all(feature = "NSDate", feature = "NSString"))]
#[unsafe(method(dateFromString:))]
#[unsafe(method_family = none)]
pub fn dateFromString(&self, string: &NSString) -> Option<Retained<NSDate>>;
#[cfg(all(feature = "NSDate", feature = "NSString", feature = "NSTimeZone"))]
#[unsafe(method(stringFromDate:timeZone:formatOptions:))]
#[unsafe(method_family = none)]
pub fn stringFromDate_timeZone_formatOptions(
date: &NSDate,
time_zone: &NSTimeZone,
format_options: NSISO8601DateFormatOptions,
) -> Retained<NSString>;
);
}
/// Methods declared on superclass `NSObject`.
#[cfg(feature = "NSFormatter")]
impl NSISO8601DateFormatter {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
#[cfg(feature = "NSFormatter")]
impl DefaultRetained for NSISO8601DateFormatter {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}